Package org.insa.graphs.model
Class Arc
- java.lang.Object
-
- org.insa.graphs.model.Arc
-
public abstract class Arc extends java.lang.ObjectInterface representing an arc in the graph.
Arcis an interface and not a class to allow us to represent two-ways roads in a memory efficient manner (without having to duplicate attributes).Arc should never be created manually but always using the
Node.linkNodes(Node, Node, float, RoadInformation, java.util.ArrayList)method to ensure proper instantiation of theArcForwardandArcBackwardclasses.
-
-
Constructor Summary
Constructors Constructor Description Arc()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract NodegetDestination()abstract floatgetLength()doublegetMinimumTravelTime()Compute and return the minimum time required to travel this arc, or the time required to travel this arc at the maximum speed allowed.abstract NodegetOrigin()abstract java.util.List<Point>getPoints()abstract RoadInformationgetRoadInformation()doublegetTravelTime(double speed)Compute the time required to travel this arc if moving at the given speed.
-
-
-
Method Detail
-
getOrigin
public abstract Node getOrigin()
- Returns:
- Origin node of this arc.
-
getDestination
public abstract Node getDestination()
- Returns:
- Destination node of this arc.
-
getLength
public abstract float getLength()
- Returns:
- Length of this arc, in meters.
-
getTravelTime
public double getTravelTime(double speed)
Compute the time required to travel this arc if moving at the given speed.- Parameters:
speed- Speed to compute the travel time.- Returns:
- Time (in seconds) required to travel this arc at the given speed (in kilometers-per-hour).
-
getMinimumTravelTime
public double getMinimumTravelTime()
Compute and return the minimum time required to travel this arc, or the time required to travel this arc at the maximum speed allowed.- Returns:
- Minimum time required to travel this arc, in seconds.
- See Also:
getTravelTime(double)
-
getRoadInformation
public abstract RoadInformation getRoadInformation()
- Returns:
- Road information for this arc.
-
getPoints
public abstract java.util.List<Point> getPoints()
- Returns:
- Points representing segments of this arc.
-
-