Пример #1
0
 public boolean isReachableTo(StandardEntity se) {
   if (se instanceof Human) {
     Human hum = (Human) se;
     if (agent.getVisibleEntities(Human.class).contains(hum)
         && hum.isPositionDefined()
         && hum.getAreaPosition().isBlockadesDefined()) {
       for (Blockade blockade : hum.getAreaPosition().getBlockades()) {
         if (blockade.getShape().contains(hum.getPositionPoint().toGeomPoint())) return false;
       }
     }
     if (!hum.getImReachableToEdges().isEmpty())
       return agent
           .move
           .getMoveType(PoliceReachablityMove.class)
           .isReallyReachableTo(hum.getImReachableToEdges());
   }
   return isReachableTo(se.getPositionPair());
 }
Пример #2
0
 public void makeReachableTo(List<? extends StandardEntity> targets) throws SOSActionException {
   log.info("makeReachableTo " + targets);
   ArrayList<Pair<? extends Area, Point2D>> reachableAreas =
       new ArrayList<Pair<? extends Area, Point2D>>();
   for (StandardEntity entity : targets) {
     if (entity == null) {
       log.error("A null entity passed to makeReachableTo!!! WHY?");
       continue;
     }
     if (entity.getPositionPair() == null) {
       log.error("A null position entity(" + entity + ") passed to makeReachableTo!!! WHY?");
       continue;
     }
     if (!isReachableTo(entity)) {
       reachableAreas.addAll(PoliceUtils.getReachableAreasPair(entity));
     }
   }
   log.debug("reachableAreas = " + reachableAreas);
   if (!reachableAreas.isEmpty()) {
     moveToPoint(reachableAreas);
   }
 }