@@ -40,28 +40,24 @@ public class TravellingPoint {
4040 public boolean blocked ;
4141 public boolean upsideDown ;
4242
43- public static enum SteerDirection {
43+ public enum SteerDirection {
4444 NONE (0 ), LEFT (-1 ), RIGHT (1 );
4545
46- float targetDot ;
46+ final float targetDot ;
4747
48- private SteerDirection (float targetDot ) {
48+ SteerDirection (float targetDot ) {
4949 this .targetDot = targetDot ;
5050 }
5151 }
5252
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 >> { };
5655
57- public static interface IEdgePointListener extends BiPredicate <Double , Pair <TrackEdgePoint , Couple <TrackNode >>> {
58- };
56+ public interface IEdgePointListener extends BiPredicate <Double , Pair <TrackEdgePoint , Couple <TrackNode >>> { };
5957
60- public static interface ITurnListener extends BiConsumer <Double , TrackEdge > {
61- };
58+ public interface ITurnListener extends BiConsumer <Double , TrackEdge > { };
6259
63- public static interface IPortalListener extends Predicate <Couple <TrackNodeLocation >> {
64- };
60+ public interface IPortalListener extends Predicate <Couple <TrackNodeLocation >> { };
6561
6662 public TravellingPoint () {}
6763
@@ -78,8 +74,7 @@ public IEdgePointListener ignoreEdgePoints() {
7874 }
7975
8076 public ITurnListener ignoreTurns () {
81- return (d , c ) -> {
82- };
77+ return (d , c ) -> { };
8378 }
8479
8580 public IPortalListener ignorePortals () {
@@ -113,15 +108,14 @@ public ITrackSelector follow(TravellingPoint other, @Nullable Consumer<Boolean>
113108 Vector <List <Entry <TrackNode , TrackEdge >>> frontiers = new Vector <>(validTargets .size ());
114109 Vector <Set <TrackEdge >> visiteds = new Vector <>(validTargets .size ());
115110
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+ }
125119
126120 for (int i = 0 ; i < 20 ; i ++) {
127121 for (int j = 0 ; j < validTargets .size (); j ++) {
@@ -233,7 +227,7 @@ public double travel(TrackGraph graph, double distance, ITrackSelector trackSele
233227 Double blockedLocation =
234228 edgeTraversedFrom (graph , forward , signalListener , turnListener , prevPos , collectedDistance );
235229 if (blockedLocation != null ) {
236- position = blockedLocation . doubleValue () ;
230+ position = blockedLocation ;
237231 traveled = position - prevPos ;
238232 return traveled ;
239233 }
@@ -289,7 +283,7 @@ public double travel(TrackGraph graph, double distance, ITrackSelector trackSele
289283
290284 if (blockedLocation != null ) {
291285 traveled -= position ;
292- position = blockedLocation . doubleValue () ;
286+ position = blockedLocation ;
293287 traveled += position ;
294288 break ;
295289 }
@@ -349,7 +343,7 @@ public double travel(TrackGraph graph, double distance, ITrackSelector trackSele
349343
350344 if (blockedLocation != null ) {
351345 traveled -= position ;
352- position = blockedLocation . doubleValue () ;
346+ position = blockedLocation ;
353347 traveled += position ;
354348 break ;
355349 }
0 commit comments