1 package org.opentrafficsim.core.network;
2
3 /**
4 * Interface to determine a link weight.
5 * <p>
6 * Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
7 * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
8 * <p>
9 * @version $Revision$, $LastChangedDate$, by $Author$, initial version 20 aug. 2018 <br>
10 * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
11 * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
12 * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
13 */
14 public interface LinkWeight
15 {
16
17 /** Default link weight using link length. */
18 LinkWeight LENGTH = new LinkWeight()
19 {
20 /** {@inheritDoc} */
21 @Override
22 public double getWeight(final Link link)
23 {
24 return link.getLength().si;
25 }
26
27 /** {@inheritDoc} */
28 @Override
29 public String toString()
30 {
31 return "LENGTH";
32 }
33 };
34
35 /**
36 * Returns the link weight.
37 * @param link Link; link
38 * @return double; link weight
39 */
40 double getWeight(Link link);
41 }