@Override public String toString() { StringBuilder sb = new StringBuilder(); for (Tile t : this.map.values()) { sb.append("x: " + t.getPoint().x); sb.append("y: " + t.getPoint().y); sb.append(" obs: " + t.isObstacle()); sb.append(" dirty: " + t.isDirty()); sb.append(" base: " + t.isBase()); sb.append("\n"); } return sb.toString(); }
private void updateMinMax(Tile t) { if (t.isObstacle()) return; if (!rowsWallsDetected) { if (t.getPoint().x < minX) minX = t.getPoint().x; if (t.getPoint().x > maxX) maxX = t.getPoint().x; } if (!colsWallsDetected) { if (t.getPoint().y < minY) minY = t.getPoint().y; if (t.getPoint().y > maxY) maxY = t.getPoint().y; } }
public boolean isVisited(Tile t) { return this.map.containsKey(t.getPoint()); }
public void setTile(Tile t) { updateMinMax(t); /* TODO check, will hashCode of points works? */ this.map.put(t.getPoint(), t); }
public boolean isWall(Tile t) { if (this.isVisited(t)) return this.map.get(t.getPoint()).isWall(); return false; }