@@ -61,19 +61,6 @@ public GHMRequest addAllPoints(List<GHPoint> points) {
61
61
return this ;
62
62
}
63
63
64
- @ Override
65
- public List <GHPoint > getPoints () {
66
- throw new IllegalStateException ("use getFromPoints or getToPoints" );
67
- }
68
-
69
- public List <GHPoint > getFromPoints () {
70
- return fromPoints ;
71
- }
72
-
73
- public List <GHPoint > getToPoints () {
74
- return toPoints ;
75
- }
76
-
77
64
/**
78
65
* This methods adds the coordinate as 'from' and 'to' to the request.
79
66
*/
@@ -84,6 +71,11 @@ public GHMRequest addPoint(GHPoint point) {
84
71
return this ;
85
72
}
86
73
74
+ @ Override
75
+ public List <GHPoint > getPoints () {
76
+ throw new IllegalStateException ("use getFromPoints or getToPoints" );
77
+ }
78
+
87
79
public GHMRequest addFromPoint (GHPoint point ) {
88
80
fromPoints .add (point );
89
81
identicalLists = false ;
@@ -96,90 +88,100 @@ public GHMRequest setFromPoints(List<GHPoint> points) {
96
88
return this ;
97
89
}
98
90
99
- public GHRequest addFromPointHint (String pointHint ) {
100
- this .fromPointHints .add (pointHint );
91
+ public List <GHPoint > getFromPoints () {
92
+ return fromPoints ;
93
+ }
94
+
95
+ public GHMRequest addToPoint (GHPoint point ) {
96
+ toPoints .add (point );
97
+ identicalLists = false ;
101
98
return this ;
102
99
}
103
100
104
- public GHRequest setFromPointHints (List <String > pointHints ) {
105
- this .fromPointHints = pointHints ;
101
+ public GHMRequest setToPoints (List <GHPoint > points ) {
102
+ toPoints = points ;
103
+ identicalLists = false ;
106
104
return this ;
107
105
}
108
106
109
- public List <String > getFromPointHints () {
110
- return fromPointHints ;
107
+ public List <GHPoint > getToPoints () {
108
+ return toPoints ;
111
109
}
112
110
113
- public GHMRequest addFromCurbside (String curbside ) {
114
- fromCurbsides .add (curbside );
111
+ @ Override
112
+ public GHRequest setPointHints (List <String > pointHints ) {
113
+ setToPointHints (pointHints );
114
+ this .fromPointHints = this .toPointHints ;
115
115
return this ;
116
116
}
117
117
118
- public GHMRequest setFromCurbsides ( List < String > curbsides ) {
119
- fromCurbsides = curbsides ;
120
- return this ;
118
+ @ Override
119
+ public List < String > getPointHints () {
120
+ throw new IllegalStateException ( "Use getFromPointHints or getToPointHints" ) ;
121
121
}
122
122
123
- public List <String > getFromCurbsides () {
124
- return fromCurbsides ;
123
+ @ Override
124
+ public boolean hasPointHints () {
125
+ return this .fromPointHints .size () == this .fromPoints .size () && !fromPoints .isEmpty () &&
126
+ this .toPointHints .size () == this .toPoints .size () && !toPoints .isEmpty ();
125
127
}
126
128
127
- public GHMRequest addToPoint (GHPoint point ) {
128
- toPoints .add (point );
129
- identicalLists = false ;
129
+ public GHRequest addFromPointHint (String pointHint ) {
130
+ this .fromPointHints .add (pointHint );
130
131
return this ;
131
132
}
132
133
133
- public GHMRequest setToPoints (List <GHPoint > points ) {
134
- toPoints = points ;
135
- identicalLists = false ;
134
+ public GHRequest setFromPointHints (List <String > pointHints ) {
135
+ // create new array as we modify pointHints in compactPointHints
136
+ this . fromPointHints = new ArrayList <>( pointHints ) ;
136
137
return this ;
137
138
}
138
139
140
+ public List <String > getFromPointHints () {
141
+ return fromPointHints ;
142
+ }
143
+
139
144
public GHRequest addToPointHint (String pointHint ) {
140
145
this .toPointHints .add (pointHint );
141
146
return this ;
142
147
}
143
148
144
149
public GHRequest setToPointHints (List <String > pointHints ) {
145
- this .toPointHints = pointHints ;
150
+ // create new array as we modify pointHints in compactPointHints
151
+ this .toPointHints = new ArrayList <>(pointHints );
146
152
return this ;
147
153
}
148
154
149
155
public List <String > getToPointHints () {
150
156
return toPointHints ;
151
157
}
152
158
153
- public GHMRequest addToCurbside (String curbside ) {
154
- toCurbsides .add (curbside );
159
+ public GHMRequest addFromCurbside (String curbside ) {
160
+ fromCurbsides .add (curbside );
155
161
return this ;
156
162
}
157
163
158
- public GHMRequest setToCurbsides (List <String > curbsides ) {
159
- toCurbsides = curbsides ;
164
+ public GHMRequest setFromCurbsides (List <String > curbsides ) {
165
+ fromCurbsides = curbsides ;
160
166
return this ;
161
167
}
162
168
163
- public List <String > getToCurbsides () {
164
- return toCurbsides ;
169
+ public List <String > getFromCurbsides () {
170
+ return fromCurbsides ;
165
171
}
166
172
167
- @ Override
168
- public GHRequest setPointHints (List <String > pointHints ) {
169
- this .fromPointHints = pointHints ;
170
- this .toPointHints = pointHints ;
173
+ public GHMRequest addToCurbside (String curbside ) {
174
+ toCurbsides .add (curbside );
171
175
return this ;
172
176
}
173
177
174
- @ Override
175
- public List < String > getPointHints () {
176
- throw new IllegalStateException ( "Use getFromPointHints or getToPointHints" ) ;
178
+ public GHMRequest setToCurbsides ( List < String > curbsides ) {
179
+ toCurbsides = curbsides ;
180
+ return this ;
177
181
}
178
182
179
- @ Override
180
- public boolean hasPointHints () {
181
- return this .fromPointHints .size () == this .fromPoints .size () && !fromPoints .isEmpty () &&
182
- this .toPointHints .size () == this .toPoints .size () && !toPoints .isEmpty ();
183
+ public List <String > getToCurbsides () {
184
+ return toCurbsides ;
183
185
}
184
186
185
187
@ Override
0 commit comments