|
@@ -86,6 +86,9 @@ public class GraphStatistics {
|
86
|
86
|
// Bounding box for this graph.
|
87
|
87
|
private final BoundingBox boundingBox;
|
88
|
88
|
|
|
89
|
+ // Number of roads
|
|
90
|
+ private final int nbRoadOneWay, nbRoadTwoWays;
|
|
91
|
+
|
89
|
92
|
// Maximum speed on this graph (in kmph).
|
90
|
93
|
private final int maximumSpeed;
|
91
|
94
|
|
|
@@ -96,13 +99,18 @@ public class GraphStatistics {
|
96
|
99
|
* Create a new GraphStatistics instance with the given value.
|
97
|
100
|
*
|
98
|
101
|
* @param boundingBox Bounding-box for the graph.
|
|
102
|
+ * @param nbRoadOneWay Number of one-way roads in the graph.
|
|
103
|
+ * @param nbRoadTwoTayws Number of two-ways roads in the graph.
|
99
|
104
|
* @param maximumSpeed Maximum speed of any road of the graph. You can use
|
100
|
105
|
* {@link #NO_MAXIMUM_SPEED} to indicate that the graph has no maximum
|
101
|
106
|
* speed limit.
|
102
|
107
|
* @param maximumLength Maximum length of any arc of the graph.
|
103
|
108
|
*/
|
104
|
|
- public GraphStatistics(BoundingBox boundingBox, int maximumSpeed, float maximumLength) {
|
|
109
|
+ public GraphStatistics(BoundingBox boundingBox, int nbRoadOneWay, int nbRoadTwoWays,
|
|
110
|
+ int maximumSpeed, float maximumLength) {
|
105
|
111
|
this.boundingBox = boundingBox;
|
|
112
|
+ this.nbRoadOneWay = nbRoadOneWay;
|
|
113
|
+ this.nbRoadTwoWays = nbRoadTwoWays;
|
106
|
114
|
this.maximumLength = maximumLength;
|
107
|
115
|
this.maximumSpeed = maximumSpeed;
|
108
|
116
|
}
|
|
@@ -115,6 +123,30 @@ public class GraphStatistics {
|
115
|
123
|
}
|
116
|
124
|
|
117
|
125
|
/**
|
|
126
|
+ * @return Amount of one-way roads in this graph.
|
|
127
|
+ */
|
|
128
|
+ public int getOneWayRoadCount() {
|
|
129
|
+ return this.nbRoadOneWay;
|
|
130
|
+ }
|
|
131
|
+
|
|
132
|
+ /**
|
|
133
|
+ * @return Amount of two-ways roads in this graph.
|
|
134
|
+ */
|
|
135
|
+ public int getTwoWaysRoadCount() {
|
|
136
|
+ return this.nbRoadTwoWays;
|
|
137
|
+ }
|
|
138
|
+
|
|
139
|
+ /**
|
|
140
|
+ * @return Number of arcs in this graph.
|
|
141
|
+ *
|
|
142
|
+ * @see #getOneWayRoadCount()
|
|
143
|
+ * @see #getTwoWaysRoadCount()
|
|
144
|
+ */
|
|
145
|
+ public int getArcCount() {
|
|
146
|
+ return getOneWayRoadCount() + 2 * getTwoWaysRoadCount();
|
|
147
|
+ }
|
|
148
|
+
|
|
149
|
+ /**
|
118
|
150
|
* @return true if this graph has a maximum speed limit, false otherwise.
|
119
|
151
|
*/
|
120
|
152
|
public boolean hasMaximumSpeed() {
|