Package org.insa.graphs.model
Class GraphStatistics
- java.lang.Object
-
- org.insa.graphs.model.GraphStatistics
-
public class GraphStatistics extends java.lang.ObjectUtility 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 classGraphStatistics.BoundingBoxClass 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 intNO_MAXIMUM_SPEEDSpecial 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetArcCount()GraphStatistics.BoundingBoxgetBoundingBox()floatgetMaximumLength()intgetMaximumSpeed()intgetOneWayRoadCount()intgetTwoWaysRoadCount()booleanhasMaximumSpeed()
-
-
-
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 useNO_MAXIMUM_SPEEDto indicate that the graph has no maximum speed limit.maximumLength- Maximum length of any arc of the graph.
-
-
Method Detail
-
getBoundingBox
public GraphStatistics.BoundingBox 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_SPEEDif some roads have no speed limitation.
-
getMaximumLength
public float getMaximumLength()
- Returns:
- Maximum length of any arc in the graph.
-
-