private void justMakeReachable(Path path) throws SOSActionException { log.info("making reachable to " + path); if (!PoliceConstants.IS_NEW_CLEAR) { ArrayList<Blockade> blocks = new ArrayList<Blockade>(); ArrayList<Blockade> blockadeEdge = reachableWithEdge.getBlockingBlockadeOfPath(path); blocks.addAll(blockadeEdge); // if (blocks.isEmpty()) { blocks.addAll(reachablityTool.getBlockingBlockadeOfPath(path)); log.debug("clearableBlockadeToReachablebyReachablityTool is " + blocks); // ArrayList<Blockade> blockadeEdge = // clearableBlockadeToFullReachable.getBlockingBlockadeOfPath(path); } log.debug("clearableBlockadeToReachableWithEdge is " + blocks); Blockade clearBlock = chooseBestBlockade(blocks); if (clearBlock != null) clear(clearBlock); else log.debug("No Blockade found---> we can move"); } else { Point next = agent.degreeClearableToPoint.nextPointToClear(path, true, true); if (next != null) { // log.warn("clear at" + next); clear(next); } } }
private void justMakeReachableWithGoodReachablity(Path path) throws SOSActionException { log.info("making reachable with good reachablity to " + path); ArrayList<Blockade> blocks = reachablityTool.getBlockingBlockadeOfPath(path); log.debug("clearableBlockadeToReachablebyReachablityTool is " + blocks); ArrayList<Blockade> blockadeEdge = reachableWithEdge.getBlockingBlockadeOfPath(path); blocks.addAll(blockadeEdge); log.debug("clearableBlockadeToReachableWithEdge is " + blocks); Blockade clearBlock = chooseBestBlockade(blocks); if (clearBlock != null) clear(clearBlock); else if (clearBlock == null && !blocks.isEmpty()) { log.debug("No blockade is in range but the path is close!!! so move to close area"); ArrayList<Pair<? extends Area, Point2D>> dest = new ArrayList<Pair<? extends Area, Point2D>>(); for (Blockade blockade : blocks) { dest.add(blockade.getPositionPair()); } path = agent.move.getPathToPoints(dest, PoliceMove.class); agent.move(path); } else log.debug("No Blockade found---> we can move"); }