Class GraphStatistics


  • public class GraphStatistics
    extends java.lang.Object

    Utility class that stores some statistics of graphs that are not easy to access.

    This class is used to provide constant (O(1)) access to information in graph that do not change, and that usually require linear complexity to compute.

    • Field Detail

      • NO_MAXIMUM_SPEED

        public static final int NO_MAXIMUM_SPEED
        Special value used to indicate that the graph has no maximum speed limit (some roads are not limited).
        See Also:
        Constant Field Values
    • Constructor Detail

      • GraphStatistics

        public GraphStatistics​(GraphStatistics.BoundingBox boundingBox,
                               int nbRoadOneWay,
                               int nbRoadTwoWays,
                               int maximumSpeed,
                               float maximumLength)
        Create a new GraphStatistics instance with the given value.
        Parameters:
        boundingBox - Bounding-box for the graph.
        nbRoadOneWay - Number of one-way roads in the graph.
        nbRoadTwoWays - Number of two-ways roads in the graph.
        maximumSpeed - Maximum speed of any road of the graph. You can use NO_MAXIMUM_SPEED to indicate that the graph has no maximum speed limit.
        maximumLength - Maximum length of any arc of the graph.
    • Method Detail

      • getOneWayRoadCount

        public int getOneWayRoadCount()
        Returns:
        Amount of one-way roads in this graph.
      • getTwoWaysRoadCount

        public int getTwoWaysRoadCount()
        Returns:
        Amount of two-ways roads in this graph.
      • hasMaximumSpeed

        public boolean hasMaximumSpeed()
        Returns:
        true if this graph has a maximum speed limit, false otherwise.
      • getMaximumSpeed

        public int getMaximumSpeed()
        Returns:
        Maximum speed of any arc in the graph, or NO_MAXIMUM_SPEED if some roads have no speed limitation.
      • getMaximumLength

        public float getMaximumLength()
        Returns:
        Maximum length of any arc in the graph.