@@ -40,28 +40,24 @@ public class TravellingPoint {
40
40
public boolean blocked ;
41
41
public boolean upsideDown ;
42
42
43
- public static enum SteerDirection {
43
+ public enum SteerDirection {
44
44
NONE (0 ), LEFT (-1 ), RIGHT (1 );
45
45
46
- float targetDot ;
46
+ final float targetDot ;
47
47
48
- private SteerDirection (float targetDot ) {
48
+ SteerDirection (float targetDot ) {
49
49
this .targetDot = targetDot ;
50
50
}
51
51
}
52
52
53
- public static interface ITrackSelector
54
- extends BiFunction <TrackGraph , Pair <Boolean , List <Entry <TrackNode , TrackEdge >>>, Entry <TrackNode , TrackEdge >> {
55
- };
53
+ public interface ITrackSelector
54
+ extends BiFunction <TrackGraph , Pair <Boolean , List <Entry <TrackNode , TrackEdge >>>, Entry <TrackNode , TrackEdge >> { };
56
55
57
- public static interface IEdgePointListener extends BiPredicate <Double , Pair <TrackEdgePoint , Couple <TrackNode >>> {
58
- };
56
+ public interface IEdgePointListener extends BiPredicate <Double , Pair <TrackEdgePoint , Couple <TrackNode >>> { };
59
57
60
- public static interface ITurnListener extends BiConsumer <Double , TrackEdge > {
61
- };
58
+ public interface ITurnListener extends BiConsumer <Double , TrackEdge > { };
62
59
63
- public static interface IPortalListener extends Predicate <Couple <TrackNodeLocation >> {
64
- };
60
+ public interface IPortalListener extends Predicate <Couple <TrackNodeLocation >> { };
65
61
66
62
public TravellingPoint () {}
67
63
@@ -78,8 +74,7 @@ public IEdgePointListener ignoreEdgePoints() {
78
74
}
79
75
80
76
public ITurnListener ignoreTurns () {
81
- return (d , c ) -> {
82
- };
77
+ return (d , c ) -> { };
83
78
}
84
79
85
80
public IPortalListener ignorePortals () {
@@ -113,15 +108,14 @@ public ITrackSelector follow(TravellingPoint other, @Nullable Consumer<Boolean>
113
108
Vector <List <Entry <TrackNode , TrackEdge >>> frontiers = new Vector <>(validTargets .size ());
114
109
Vector <Set <TrackEdge >> visiteds = new Vector <>(validTargets .size ());
115
110
116
- for (int j = 0 ; j < validTargets .size (); j ++) {
117
- ArrayList <Entry <TrackNode , TrackEdge >> e = new ArrayList <>();
118
- Entry <TrackNode , TrackEdge > entry = validTargets .get (j );
119
- e .add (entry );
120
- frontiers .add (e );
121
- HashSet <TrackEdge > e2 = new HashSet <>();
122
- e2 .add (entry .getValue ());
123
- visiteds .add (e2 );
124
- }
111
+ for (Entry <TrackNode , TrackEdge > validTarget : validTargets ) {
112
+ ArrayList <Entry <TrackNode , TrackEdge >> e = new ArrayList <>();
113
+ e .add (validTarget );
114
+ frontiers .add (e );
115
+ HashSet <TrackEdge > e2 = new HashSet <>();
116
+ e2 .add (validTarget .getValue ());
117
+ visiteds .add (e2 );
118
+ }
125
119
126
120
for (int i = 0 ; i < 20 ; i ++) {
127
121
for (int j = 0 ; j < validTargets .size (); j ++) {
@@ -233,7 +227,7 @@ public double travel(TrackGraph graph, double distance, ITrackSelector trackSele
233
227
Double blockedLocation =
234
228
edgeTraversedFrom (graph , forward , signalListener , turnListener , prevPos , collectedDistance );
235
229
if (blockedLocation != null ) {
236
- position = blockedLocation . doubleValue () ;
230
+ position = blockedLocation ;
237
231
traveled = position - prevPos ;
238
232
return traveled ;
239
233
}
@@ -289,7 +283,7 @@ public double travel(TrackGraph graph, double distance, ITrackSelector trackSele
289
283
290
284
if (blockedLocation != null ) {
291
285
traveled -= position ;
292
- position = blockedLocation . doubleValue () ;
286
+ position = blockedLocation ;
293
287
traveled += position ;
294
288
break ;
295
289
}
@@ -349,7 +343,7 @@ public double travel(TrackGraph graph, double distance, ITrackSelector trackSele
349
343
350
344
if (blockedLocation != null ) {
351
345
traveled -= position ;
352
- position = blockedLocation . doubleValue () ;
346
+ position = blockedLocation ;
353
347
traveled += position ;
354
348
break ;
355
349
}
0 commit comments