|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.webstersmalley.chessweb.model.Position
public final class Position
Simple coordinate system for the position of a piece on the board.
| Constructor Summary | |
|---|---|
Position()
Default constructor. |
|
Position(int file,
int rank)
Create a Position based on file and rank (0-index) coordinates. |
|
Position(java.lang.String algebraicNotation)
Convenience constructor. |
|
Position(java.lang.String file,
int rank)
Convenience constructor. |
|
| Method Summary | |
|---|---|
void |
add(int fileIncrement,
int rankIncrement)
Adds a vector onto the position. |
java.lang.Object |
clone()
Create a clone of this position. |
boolean |
equals(java.lang.Object obj)
Whether two objects are equal. |
java.lang.String |
getAlgebraicNotation()
Returns the algebraic notation of this position. |
java.lang.String |
getFile()
|
int |
getFileNumber()
Return the file number. |
int |
getModulus()
Return the modulus of the square number. |
int |
getRank()
|
int |
hashCode()
Get the hash code of the Object. |
void |
setAlgebraicNotation(java.lang.String algebraicNotation)
Resets the position based on the algebraic notation. |
void |
setFile(java.lang.String file)
|
void |
setRank(int rank)
|
java.lang.String |
toString()
Returns a String representation. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Position()
public Position(java.lang.String file,
int rank)
file - the file coordinaterank - the rank coordinatepublic Position(java.lang.String algebraicNotation)
algebraicNotation - the algebraicNotation
public Position(int file,
int rank)
file - the filerank - the rank| Method Detail |
|---|
public java.lang.String getFile()
public void setFile(java.lang.String file)
file - The file to set.public int getRank()
public void setRank(int rank)
rank - The rank to set.public java.lang.String toString()
toString in class java.lang.Objectpublic int getModulus()
public int getFileNumber()
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedException - (This should not happen!)public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - the comparator
public int hashCode()
hashCode in class java.lang.Object
public void add(int fileIncrement,
int rankIncrement)
fileIncrement - the change in filerankIncrement - the change in rankpublic java.lang.String getAlgebraicNotation()
public void setAlgebraicNotation(java.lang.String algebraicNotation)
algebraicNotation - the position
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||