Exemplo n.º 1
0
  @Override
  public EdgeIteratorState getEdgeProps(int edgeId, int adjNode) {
    if (lg.isShortcut(edgeId))
      throw new IllegalStateException(
          "Do not fetch shortcuts from BaseGraph use the LevelGraph instead");

    return lg.getEdgeProps(edgeId, adjNode);
  }
Exemplo n.º 2
0
 int[] avoidWalls(int[] directions) {
   Node current = level.getNodeAt(pacX, pacY);
   Node toGoToNode = level.getNodeAt(pacX + directions[0], pacY + directions[1]);
   ArrayList<Edge> neighbourEdges = current.getEdges();
   for (int i = 0; i < neighbourEdges.size(); i++)
     if (neighbourEdges.get(i).start == current && neighbourEdges.get(i).end == toGoToNode)
       return directions;
   System.out.println("collision detected");
   System.out.println(directions[0] + " " + directions[1]);
   int randomDirection = (int) Math.signum(r.nextFloat() - .5);
   System.out.println(randomDirection);
   return new int[] {directions[1] * randomDirection, directions[0] * randomDirection};
 }
Exemplo n.º 3
0
  @Override
  public EdgeExplorer createEdgeExplorer(final EdgeFilter filter) {
    if (filter == EdgeFilter.ALL_EDGES) return createEdgeExplorer();

    return lg.createEdgeExplorer(
        new EdgeFilter() {
          @Override
          public boolean accept(EdgeIteratorState edgeIterState) {
            if (((EdgeSkipIterator) edgeIterState).isShortcut()) return false;

            return filter.accept(edgeIterState);
          }
        });
  }
Exemplo n.º 4
0
 public void eatPill(int x, int y) {
   level.eatPill(x, y);
 }
Exemplo n.º 5
0
 int[] runTowardsPillsCloserThan(int searchDepth) {
   Node current = level.getNodeAt(pacX, pacY);
   return nextPillBFS(current);
 }
Exemplo n.º 6
0
  @Override
  public AllEdgesIterator getAllEdges() {
    final AllEdgesSkipIterator tmpIter = lg.getAllEdges();
    return new AllEdgesIterator() {
      @Override
      public int getCount() {
        return tmpIter.getCount();
      }

      @Override
      public boolean next() {
        while (tmpIter.next()) {
          if (!tmpIter.isShortcut()) {
            return true;
          }
        }
        return false;
      }

      @Override
      public int getEdge() {
        return tmpIter.getEdge();
      }

      @Override
      public int getBaseNode() {
        return tmpIter.getBaseNode();
      }

      @Override
      public int getAdjNode() {
        return tmpIter.getAdjNode();
      }

      @Override
      public PointList fetchWayGeometry(int type) {
        return tmpIter.fetchWayGeometry(type);
      }

      @Override
      public EdgeIteratorState setWayGeometry(PointList list) {
        return tmpIter.setWayGeometry(list);
      }

      @Override
      public double getDistance() {
        return tmpIter.getDistance();
      }

      @Override
      public EdgeIteratorState setDistance(double dist) {
        return tmpIter.setDistance(dist);
      }

      @Override
      public long getFlags() {
        return tmpIter.getFlags();
      }

      @Override
      public EdgeIteratorState setFlags(long flags) {
        return tmpIter.setFlags(flags);
      }

      @Override
      public String getName() {
        return tmpIter.getName();
      }

      @Override
      public EdgeIteratorState setName(String name) {
        return tmpIter.setName(name);
      }

      @Override
      public boolean getBoolean(int key, boolean reverse, boolean _default) {
        return tmpIter.getBoolean(key, reverse, _default);
      }

      @Override
      public int getAdditionalField() {
        return tmpIter.getAdditionalField();
      }

      @Override
      public EdgeIteratorState setAdditionalField(int value) {
        return tmpIter.setAdditionalField(value);
      }

      @Override
      public EdgeIteratorState copyPropertiesTo(EdgeIteratorState edge) {
        return tmpIter.copyPropertiesTo(edge);
      }

      @Override
      public EdgeIteratorState detach(boolean reverse) {
        return tmpIter.detach(reverse);
      }
    };
  }
Exemplo n.º 7
0
 @Override
 public EdgeIteratorState edge(int a, int b, double distance, boolean bothDirections) {
   return lg.edge(a, b, distance, bothDirections);
 }
Exemplo n.º 8
0
 @Override
 public EdgeIteratorState edge(int a, int b) {
   return lg.edge(a, b);
 }
Exemplo n.º 9
0
 @Override
 public BBox getBounds() {
   return lg.getBounds();
 }
Exemplo n.º 10
0
 @Override
 public NodeAccess getNodeAccess() {
   return lg.getNodeAccess();
 }
Exemplo n.º 11
0
 @Override
 public int getNodes() {
   return lg.getNodes();
 }
Exemplo n.º 12
0
 @Override
 public GraphExtension getExtension() {
   return lg.getExtension();
 }
Exemplo n.º 13
0
 @Override
 public EdgeExplorer createEdgeExplorer() {
   return lg.createEdgeExplorer(NO_SHORTCUTS);
 }