Skip to content

Commit bcba361

Browse files
gretacbCameron Mace
authored andcommitted
Setters for the model classes of directions api
1 parent 9ce67ca commit bcba361

7 files changed

Lines changed: 422 additions & 2 deletions

File tree

mapbox/libjava-services/src/main/java/com/mapbox/services/api/directions/v5/models/DirectionsRoute.java

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import java.util.List;
44

55
/**
6-
* Gives detailed information about an individual route such as the duration, distance and geometry.
6+
* Detailed information about an individual route such as the duration, distance and geometry.
77
*
88
* @since 1.0.0
99
*/
@@ -27,6 +27,17 @@ public double getDistance() {
2727
return distance;
2828
}
2929

30+
/**
31+
* The distance traveled from origin to destination.
32+
* <p>
33+
* Sets a double number with unit meters.
34+
*
35+
* @since 2.0.1
36+
*/
37+
public void setDistance(double distance) {
38+
this.distance = distance;
39+
}
40+
3041
/**
3142
* The estimated travel time from origin to destination.
3243
*
@@ -37,6 +48,17 @@ public double getDuration() {
3748
return duration;
3849
}
3950

51+
/**
52+
* The estimated travel time from origin to destination.
53+
* <p>
54+
* Sets a double number with unit seconds.
55+
*
56+
* @since 2.0.1
57+
*/
58+
public void setDuration(double duration) {
59+
this.duration = duration;
60+
}
61+
4062
/**
4163
* Gives the geometry of the route. Commonly used to draw the route on the map view.
4264
*
@@ -47,6 +69,18 @@ public String getGeometry() {
4769
return geometry;
4870
}
4971

72+
/**
73+
* Sets the geometry of the route. Commonly used to draw the route on the map view.
74+
* <p>
75+
* Sets An encoded polyline string.
76+
*
77+
* @since 2.0.1
78+
*/
79+
public void setGeometry(String geometry) {
80+
this.geometry = geometry;
81+
}
82+
83+
5084
/**
5185
* A Leg is a route between only two waypoints
5286
*
@@ -56,4 +90,18 @@ public String getGeometry() {
5690
public List<RouteLeg> getLegs() {
5791
return legs;
5892
}
93+
94+
95+
/**
96+
* A Leg is a route between only two waypoints
97+
* <p>
98+
* Sets List of {@link RouteLeg} objects.
99+
*
100+
* @since 2.0.1
101+
*/
102+
public void setLegs(List<RouteLeg> legs) {
103+
this.legs = legs;
104+
}
105+
106+
59107
}

mapbox/libjava-services/src/main/java/com/mapbox/services/api/directions/v5/models/DirectionsWaypoint.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ public String getName() {
2323
return name;
2424
}
2525

26+
/**
27+
* Sets String with the name of the way the coordinate snapped to.
28+
*
29+
* @since 2.0.1
30+
*/
31+
public void setName(String name) {
32+
this.name = name;
33+
}
34+
2635
/**
2736
* @return double array of [longitude, latitude] for the snapped coordinate.
2837
* @since 1.0.0
@@ -31,6 +40,15 @@ public double[] getLocation() {
3140
return location;
3241
}
3342

43+
/**
44+
* Sets double array of [longitude, latitude] for the snapped coordinate.
45+
*
46+
* @since 2.0.1
47+
*/
48+
public void setLocation(double[] location) {
49+
this.location = location;
50+
}
51+
3452
/**
3553
* Converts double array {@link #getLocation()} to a {@link Position}. You'll typically want to
3654
* use this format instead of {@link #getLocation()} as it's easier to work with.

mapbox/libjava-services/src/main/java/com/mapbox/services/api/directions/v5/models/IntersectionLanes.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ public boolean getValid() {
2727
return valid;
2828
}
2929

30+
/**
31+
* Sets Boolean value for whether this lane can be taken to complete the maneuver. For
32+
* instance, if the lane array has four objects and the first two are marked as valid, then the
33+
* driver can take either of the left lanes and stay on the route.
34+
*
35+
* @since 2.0.1
36+
*/
37+
public void setValid(boolean valid) {
38+
this.valid = valid;
39+
}
40+
3041
/**
3142
* @return Array of signs for each turn lane. There can be multiple signs. For example, a turning
3243
* lane can have a sign with an arrow pointing left and another sign with an arrow pointing
@@ -37,4 +48,14 @@ public String[] getIndications() {
3748
return indications;
3849
}
3950

51+
/**
52+
* Sets Array of signs for each turn lane. There can be multiple signs. For example, a turning
53+
* lane can have a sign with an arrow pointing left and another sign with an arrow pointing
54+
* straight.
55+
*
56+
* @since 2.0.1
57+
*/
58+
public void setIndications(String[] indications) {
59+
this.indications = indications;
60+
}
4061
}

mapbox/libjava-services/src/main/java/com/mapbox/services/api/directions/v5/models/LegStep.java

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@ public double getDistance() {
4949
return distance;
5050
}
5151

52+
/**
53+
* The distance traveled from the maneuver to the next {@link LegStep}.
54+
* <p>
55+
* Sets a double number with unit meters.
56+
*
57+
* @since 2.0.1
58+
*/
59+
public void setDistance(double distance) {
60+
this.distance = distance;
61+
}
62+
5263
/**
5364
* The estimated travel time from the maneuver to the next {@link LegStep}.
5465
*
@@ -59,6 +70,17 @@ public double getDuration() {
5970
return duration;
6071
}
6172

73+
/**
74+
* The estimated travel time from the maneuver to the next {@link LegStep}.
75+
* <p>
76+
* Sets a double number with unit seconds.
77+
*
78+
* @since 2.0.1
79+
*/
80+
public void setDuration(double duration) {
81+
this.duration = duration;
82+
}
83+
6284
/**
6385
* Gives the geometry of the leg step.
6486
*
@@ -69,6 +91,17 @@ public String getGeometry() {
6991
return geometry;
7092
}
7193

94+
/**
95+
* Sets the geometry of the leg step.
96+
* <p>
97+
* Sets An encoded polyline string.
98+
*
99+
* @since 2.0.1
100+
*/
101+
public void setGeometry(String geometry) {
102+
this.geometry = geometry;
103+
}
104+
72105
/**
73106
* @return String with the name of the way along which the travel proceeds.
74107
* @since 1.0.0
@@ -77,6 +110,15 @@ public String getName() {
77110
return name;
78111
}
79112

113+
/**
114+
* Sets String with the name of the way along which the travel proceeds.
115+
*
116+
* @since 2.0.0
117+
*/
118+
public void setName(String name) {
119+
this.name = name;
120+
}
121+
80122
/**
81123
* @return String with reference number or code of the way along which the travel proceeds.
82124
* Optionally included, if data is available.
@@ -86,6 +128,16 @@ public String getRef() {
86128
return ref;
87129
}
88130

131+
/**
132+
* Sets String with reference number or code of the way along which the travel proceeds.
133+
* Optionally included, if data is available.
134+
*
135+
* @since 2.0.1
136+
*/
137+
public void setRef(String ref) {
138+
this.ref = ref;
139+
}
140+
89141
/**
90142
* @return String with the destinations of the way along which the travel proceeds.
91143
* Optionally included, if data is available.
@@ -95,6 +147,17 @@ public String getDestinations() {
95147
return destinations;
96148
}
97149

150+
/**
151+
* Sets String with the destinations of the way along which the travel proceeds.
152+
* Optionally included, if data is available.
153+
*
154+
* @since 2.0.1
155+
*/
156+
157+
public void setDestinations(String destinations) {
158+
this.destinations = destinations;
159+
}
160+
98161
/**
99162
* @return String indicating the mode of transportation.
100163
* @since 1.0.0
@@ -103,6 +166,15 @@ public String getMode() {
103166
return mode;
104167
}
105168

169+
/**
170+
* Sets String indicating the mode of transportation.
171+
*
172+
* @since 2.0.1
173+
*/
174+
public void setMode(String mode) {
175+
this.mode = mode;
176+
}
177+
106178
/**
107179
* @return One {@link StepManeuver} object.
108180
* @since 1.0.0
@@ -111,6 +183,15 @@ public StepManeuver getManeuver() {
111183
return maneuver;
112184
}
113185

186+
/**
187+
* Sets One {@link StepManeuver} object.
188+
*
189+
* @since 2.0.1
190+
*/
191+
public void setManeuver(StepManeuver maneuver) {
192+
this.maneuver = maneuver;
193+
}
194+
114195
/**
115196
* @return Array of objects representing all intersections along the step.
116197
* @since 1.3.0
@@ -119,6 +200,14 @@ public List<StepIntersection> getIntersections() {
119200
return intersections;
120201
}
121202

203+
/**
204+
* Sets {@code List} of objects representing all intersections along the step.
205+
*
206+
* @since 2.0.1
207+
*/
208+
public void setIntersections(List<StepIntersection> intersections) {
209+
this.intersections = intersections;
210+
}
122211

123212
/**
124213
* An optional string indicating the name of the rotary.
@@ -130,6 +219,17 @@ public String getRotaryName() {
130219
return rotaryName;
131220
}
132221

222+
/**
223+
* An optional string indicating the name of the rotary.
224+
* <p>
225+
* Sets String with the rotary name
226+
*
227+
* @since 2.0.1
228+
*/
229+
public void setRotaryName(String rotaryName) {
230+
this.rotaryName = rotaryName;
231+
}
232+
133233
/**
134234
* An optional string indicating the pronunciation of the name of the rotary.
135235
*
@@ -140,6 +240,17 @@ public String getRotaryPronunciation() {
140240
return rotaryPronunciation;
141241
}
142242

243+
/**
244+
* An optional string indicating the pronunciation of the name of the rotary.
245+
* <p>
246+
* Sets String in IPA with the rotary name's pronunciation
247+
*
248+
* @since 2.0.1
249+
*/
250+
public void setRotaryPronunciation(String rotaryPronunciation) {
251+
this.rotaryPronunciation = rotaryPronunciation;
252+
}
253+
143254
/**
144255
* The pronunciation hint of the way name. Will be undefined if no pronunciation is hit.
145256
*
@@ -150,4 +261,14 @@ public String getPronunciation() {
150261
return pronunciation;
151262
}
152263

264+
/**
265+
* The pronunciation hint of the way name. Will be undefined if no pronunciation is hit.
266+
* <p>
267+
* Sets String with the pronunciation
268+
*
269+
* @since 2.0.1
270+
*/
271+
public void setPronunciation(String pronunciation) {
272+
this.pronunciation = pronunciation;
273+
}
153274
}

0 commit comments

Comments
 (0)