Package org.insa.graphs.model
Class GraphStatistics
java.lang.Object
org.insa.graphs.model.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.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GraphStatistics.BoundingBox
Class representing a bounding box for a graph (a rectangle that contains all nodes in the graph). -
Field Summary
Fields Modifier and Type Field Description static int
NO_MAXIMUM_SPEED
Special value used to indicate that the graph has no maximum speed limit (some roads are not limited). -
Constructor Summary
Constructors Constructor Description GraphStatistics(GraphStatistics.BoundingBox boundingBox, int nbRoadOneWay, int nbRoadTwoWays, int maximumSpeed, float maximumLength)
Create a new GraphStatistics instance with the given value. -
Method Summary
Modifier and Type Method Description int
getArcCount()
GraphStatistics.BoundingBox
getBoundingBox()
float
getMaximumLength()
int
getMaximumSpeed()
int
getOneWayRoadCount()
int
getTwoWaysRoadCount()
boolean
hasMaximumSpeed()
-
Field Details
-
NO_MAXIMUM_SPEED
public static final int NO_MAXIMUM_SPEEDSpecial value used to indicate that the graph has no maximum speed limit (some roads are not limited).- See Also:
- Constant Field Values
-
-
Constructor Details
-
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 useNO_MAXIMUM_SPEED
to indicate that the graph has no maximum speed limit.maximumLength
- Maximum length of any arc of the graph.
-
-
Method Details
-
getBoundingBox
- Returns:
- The bounding box for this graph.
-
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.
-
getArcCount
public int getArcCount()- Returns:
- Number of arcs in this graph.
- See Also:
getOneWayRoadCount()
,getTwoWaysRoadCount()
-
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.
-