add java examples
This commit is contained in:
parent
624c92e934
commit
d345f67212
19 changed files with 1208 additions and 0 deletions
24
java/strategy/OctoGrid.java
Normal file
24
java/strategy/OctoGrid.java
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package patterns.strategy;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import patterns.Point;
|
||||
/**
|
||||
*
|
||||
* @author pouyllau
|
||||
*
|
||||
*/
|
||||
public class OctoGrid extends Neighborhood {
|
||||
|
||||
public OctoGrid(double step, Point pMin, Point pMax) {
|
||||
super(step, pMin, pMax);
|
||||
this.directions = 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));
|
||||
}
|
||||
|
||||
public List<Point> get(Point p) {
|
||||
|
||||
return Point.neighbors_grid(p, step,pMin, pMax, directions);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue