|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.htwdd.rosenkoenig.game.Position
public class Position
This class wraps a position for the game. A position can be two things: either an x-y-position or an offset in x-y-direction. Either way, two values, thus only one class.
| Field Summary | |
|---|---|
private int |
x
|
private int |
y
|
| Constructor Summary | |
|---|---|
Position(int x,
int y)
Ctor, set x and y distance |
|
| Method Summary | |
|---|---|
Position |
add(Position pos)
Calculate a new position depending on this object and another position. |
int |
getX()
Getter of the property x |
int |
getY()
Getter of the property y |
boolean |
isOnBoard()
Check if this position is on the game board. |
void |
setX(int x)
Setter of the property x |
void |
setY(int y)
Setter of the property y |
java.lang.String |
toString()
Output the value of Position in a human readable fashion. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private int x
private int y
| Constructor Detail |
|---|
public Position(int x,
int y)
x - distance xy - distance y| Method Detail |
|---|
public int getX()
public void setX(int x)
x - The x to set.public int getY()
public void setY(int y)
y - The y to set.public java.lang.String toString()
toString in class java.lang.Objectpublic Position add(Position pos)
pos - offset to object's position
public boolean isOnBoard()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||