jackson databind import
- and some reowrk to use Position more than (x,y) parameters
This commit is contained in:
@@ -3,6 +3,9 @@ package org.artisanlogiciel.games.maze;
|
||||
/** position of a cell with maze */
|
||||
public class Position
|
||||
{
|
||||
public final static Position stepX = new Position(1,0);
|
||||
public final static Position stepY = new Position( 0,1);
|
||||
|
||||
private int x, y;
|
||||
|
||||
public Position(int x, int y)
|
||||
@@ -38,6 +41,12 @@ public class Position
|
||||
return this;
|
||||
}
|
||||
|
||||
public Position doReverseTranslate(Position other) {
|
||||
x -= other.x;
|
||||
y -= other.y;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public void limitToMax(int mx, int my)
|
||||
{
|
||||
@@ -82,4 +91,8 @@ public class Position
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean within(int a, int b, int width, int height) {
|
||||
return ((x > a) && (x < width) && (y > b) && (y < height));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user