3434import bwem .unit .StaticBuilding ;
3535import bwem .util .BwemExt ;
3636import bwem .util .Utils ;
37- import org .apache .commons .lang3 .mutable .MutableInt ;
38- import org .apache .commons .lang3 .tuple .ImmutablePair ;
39- import org .apache .commons .lang3 .tuple .MutablePair ;
40- import org .apache .commons .lang3 .tuple .Pair ;
37+ import bwapi .Pair ;
4138
4239import java .util .*;
4340
@@ -287,7 +284,7 @@ public List<Base> getBases() {
287284
288285 // Creates a new Area for each pair (top, miniTiles) in areasList (See Area::top() and
289286 // Area::miniTiles())
290- public void createAreas (final List <MutablePair <WalkPosition , Integer >> areasList ) {
287+ public void createAreas (final List <Pair <WalkPosition , Integer >> areasList ) {
291288 for (int id = 1 ; id <= areasList .size (); ++id ) {
292289 final WalkPosition top = areasList .get (id - 1 ).getLeft ();
293290 final int miniTileCount = areasList .get (id - 1 ).getRight ();
@@ -322,13 +319,13 @@ private void initializeChokePointsMatrix(
322319 // ----------------------------------------------------------------------
323320 // 2) Dispatch the global raw frontier between all the relevant pairs of areas:
324321 // ----------------------------------------------------------------------
325- private java .util .Map <MutablePair <AreaId , AreaId >, List <WalkPosition >>
322+ private java .util .Map <Pair <AreaId , AreaId >, List <WalkPosition >>
326323 createRawFrontierByAreaPairMap (
327- final List <MutablePair < MutablePair <AreaId , AreaId >, WalkPosition >> rawFrontier ) {
328- final java .util .Map <MutablePair <AreaId , AreaId >, List <WalkPosition >> rawFrontierByAreaPair =
324+ final List <Pair < Pair <AreaId , AreaId >, WalkPosition >> rawFrontier ) {
325+ final java .util .Map <Pair <AreaId , AreaId >, List <WalkPosition >> rawFrontierByAreaPair =
329326 new HashMap <>();
330327
331- for (final MutablePair < MutablePair <AreaId , AreaId >, WalkPosition > raw : rawFrontier ) {
328+ for (final Pair < Pair <AreaId , AreaId >, WalkPosition > raw : rawFrontier ) {
332329 int a = raw .getLeft ().getLeft ().intValue ();
333330 int b = raw .getLeft ().getRight ().intValue ();
334331 if (a > b ) {
@@ -345,7 +342,7 @@ private void initializeChokePointsMatrix(
345342 throw new IllegalStateException ();
346343 }
347344
348- final MutablePair <AreaId , AreaId > key = new MutablePair <>(new AreaId (a ), new AreaId (b ));
345+ final Pair <AreaId , AreaId > key = new Pair <>(new AreaId (a ), new AreaId (b ));
349346 rawFrontierByAreaPair .computeIfAbsent (key , mp -> new ArrayList <>()).add (raw .getRight ());
350347 }
351348
@@ -360,7 +357,7 @@ private void initializeChokePointsMatrix(
360357 public void createChokePoints (
361358 final List <StaticBuilding > staticBuildings ,
362359 final List <Mineral > minerals ,
363- final List <MutablePair < MutablePair <AreaId , AreaId >, WalkPosition >> rawFrontier ) {
360+ final List <Pair < Pair <AreaId , AreaId >, WalkPosition >> rawFrontier ) {
364361 Index newIndex = new Index (0 );
365362
366363 final List <Neutral > blockingNeutrals = new ArrayList <>();
@@ -389,13 +386,13 @@ public void createChokePoints(
389386 initializeChokePointsMatrix (this .chokePointsMatrix , getAreaCount ());
390387
391388 // 2) Dispatch the global raw frontier between all the relevant pairs of areas:
392- final java .util .Map <MutablePair <AreaId , AreaId >, List <WalkPosition >> rawFrontierByAreaPair =
389+ final java .util .Map <Pair <AreaId , AreaId >, List <WalkPosition >> rawFrontierByAreaPair =
393390 createRawFrontierByAreaPairMap (rawFrontier );
394391
395392 // 3) For each pair of areas (A, B):
396- for (final java .util .Map .Entry <MutablePair <AreaId , AreaId >, List <WalkPosition >> entry :
393+ for (final java .util .Map .Entry <Pair <AreaId , AreaId >, List <WalkPosition >> entry :
397394 rawFrontierByAreaPair .entrySet ()) {
398- MutablePair <AreaId , AreaId > rawleft = entry .getKey ();
395+ Pair <AreaId , AreaId > rawleft = entry .getKey ();
399396 final List <WalkPosition > rawFrontierAB = entry .getValue ();
400397
401398 // Because our dispatching preserved order,
@@ -709,7 +706,7 @@ private int[] computeDistances(final ChokePoint start, final List<ChokePoint> ta
709706
710707 final Queue <Pair <Integer , ChokePoint >> toVisit =
711708 new PriorityQueue <>(Comparator .comparingInt (a -> a .getLeft ()));
712- toVisit .offer (new ImmutablePair <>(0 , start ));
709+ toVisit .offer (new Pair <>(0 , start ));
713710
714711 int remainingTargets = targets .size ();
715712 while (!toVisit .isEmpty ()) {
@@ -753,18 +750,18 @@ private int[] computeDistances(final ChokePoint start, final List<ChokePoint> ta
753750 // To update next's distance, we need to remove-insert it from toVisit:
754751 // bwem_assert(iNext != range.second);
755752 final boolean removed =
756- toVisit .remove (new ImmutablePair <>(((TileImpl ) nextTile ).getInternalData (), next ));
753+ toVisit .remove (new Pair <>(((TileImpl ) nextTile ).getInternalData (), next ));
757754 if (!removed ) {
758755 throw new IllegalStateException ();
759756 }
760757 ((TileImpl ) nextTile ).setInternalData (newNextDist );
761758 ((ChokePointImpl ) next ).setPathBackTrace (current );
762- toVisit .offer (new ImmutablePair <>(newNextDist , next ));
759+ toVisit .offer (new Pair <>(newNextDist , next ));
763760 }
764761 } else {
765762 ((TileImpl ) nextTile ).setInternalData (newNextDist );
766763 ((ChokePointImpl ) next ).setPathBackTrace (current );
767- toVisit .offer (new ImmutablePair <>(newNextDist , next ));
764+ toVisit .offer (new Pair <>(newNextDist , next ));
768765 }
769766 }
770767 }
0 commit comments