add Save Text support and rework package
- move maze within package maze
This commit is contained in:
58
java/org/artisanlogiciel/games/maze/Position.java
Normal file
58
java/org/artisanlogiciel/games/maze/Position.java
Normal file
@@ -0,0 +1,58 @@
|
||||
package org.artisanlogiciel.games.maze;
|
||||
|
||||
/** position of a cell with maze */
|
||||
public class Position
|
||||
{
|
||||
private int x, y;
|
||||
private int depth;
|
||||
|
||||
public Position(int x, int y, int depth)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.depth = depth;
|
||||
}
|
||||
|
||||
public Position(int x, int y)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.depth = 0;
|
||||
}
|
||||
|
||||
public int getX()
|
||||
{
|
||||
return this.x;
|
||||
}
|
||||
|
||||
public int getY()
|
||||
{
|
||||
return this.y;
|
||||
}
|
||||
|
||||
public int getDepth()
|
||||
{
|
||||
return depth;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "(" + x + "," + y + ")" + "/" + depth;
|
||||
}
|
||||
|
||||
public boolean equals(Object other)
|
||||
{
|
||||
// disregards depth
|
||||
if (other instanceof Position )
|
||||
{
|
||||
Position p = (Position) other;
|
||||
return (p.getX() == x) && (p.getY() == y);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user