Class Arc


  • public abstract class Arc
    extends java.lang.Object

    Interface representing an arc in the graph. Arc is 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 the ArcForward and ArcBackward classes.

    • Constructor Detail

      • Arc

        public Arc()
    • 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.