@Override public boolean contains(int x, int y) { return 0 <= x && x < width && 0 <= y && y < height && base.contains(x, y); }
/** * This method checks if the point is contained by the map and by the shape. */ @Override public boolean contains(ShortPoint2D position) { return inMap(position) && base.contains(position); }
private void testShapeIterator(IMapArea circle) { boolean[][] foundByIterator = new boolean[TEST_WIDTH][TEST_WIDTH]; for (ShortPoint2D pos : circle) { foundByIterator[pos.x][pos.y] = true; } for (int x = 0; x < TEST_WIDTH; x++) { for (int y = 0; y < TEST_WIDTH; y++) { assertEquals("contains() inconsistent with iterator for " + x + "," + y, circle.contains(new ShortPoint2D(x, y)), foundByIterator[x][y]); } } }
/** * Removes all construction marks in the given area. * * @param area * The area to remove the marks * @param notIn * The area of marks that should be skipped. */ private void removeConstructionMarks(IMapArea area, IMapArea notIn) { area.stream() .filterBounds(map.getWidth(), map.getHeight()) .filter((x, y) -> !notIn.contains(x, y)) .forEach((x, y) -> map.setConstructMarking(x, y, false, false, null)); } }
for (int x = xmin; x < xmax; x++) { if (area.contains(new ShortPoint2D(x, y))) { for (EDirection dir : EDirection.VALUES) { int tx = x + dir.getGridDeltaX();