add java examples

This commit is contained in:
hpid91 2020-06-25 16:00:13 +02:00 committed by nojhan
commit d345f67212
19 changed files with 1208 additions and 0 deletions

25
java/crtp/OctoGrid.java Normal file
View file

@ -0,0 +1,25 @@
package patterns.crtp;
import java.util.Arrays;
import java.util.List;
import patterns.Point;
/**
*
* @author pouyllau
*
*/
public class OctoGrid extends Neighborhood<OctoGrid> {
public OctoGrid(double step, Point pMin, Point pMax) {
super(step, pMin, pMax);
this.t = this;
}
public List<Point> get(Point p) {
return Point.neighbors_grid(p, step, pMin, pMax,
Arrays.asList(new Point(1, 0), new Point(1, -1), new Point(0, -1), new Point(-1, -1), new Point(-1, 0),
new Point(-1, 1), new Point(0, 1), new Point(1, 1)));
}
}