jackson databind import

- and some reowrk to use Position more than (x,y) parameters
This commit is contained in:
philippe lhardy
2021-11-03 08:30:30 +01:00
parent 02fda1fc2e
commit 619e9b9f19
9 changed files with 126 additions and 75 deletions

View File

@@ -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));
}
}