core
Class Position
java.lang.Object
   core.Position
core.Position
- public class Position 
- extends Object
Position on the board.
- Specification Fields
-  
  -  x: int // x location of piece
-  y: int // y location of piece
 
 Abstract Invariant: 0 <= x <= 7 0 <= y <= 7
 
 
 
 
pos
public static final Position[][] pos
ALL
public static final Collection<Position> ALL
ALLarray
public static Position[][] ALLarray()
- 
 
ALLfn
public static Collection<Position> ALLfn()
- 
 
isValid
public static boolean isValid(int x,
                              int y)
- 
 
isValid
public boolean isValid()
- 
 
get
public static Position get(int x,
                           int y)
- 
 
getX
public int getX()
- 
- Returns:
- x of this position
 
getY
public int getY()
- 
- Returns:
- y of this position
 
equals
public boolean equals(Object o)
- 
- Overrides:
- equalsin class- Object
 
- 
- See Also:
- Object
 
hashCode
public int hashCode()
- 
- Overrides:
- hashCodein class- Object
 
- 
- See Also:
- Object
 
fromString
public static Position fromString(String s)
- 
- Parameters:
- s- is a String representing a chess position
- Requires:
- s is of the form [row][column], where the row is a character
           from a to h and the column is a number from 1 to 8. For
           example, c7 is a legal argument to this method, as is h4.
- Returns:
- a Position corresponding to the String s. Its toString method
          will return a String equal to s.
 
validPosition
public static boolean validPosition(String s)
- 
- Returns:
- true if s is of the form [row][column], where the row is a
          character from a to h and the column is a number from 1 to 8.
          For example, c7 is a valid position String, as is h4.
 
toString
public String toString()
- 
- Overrides:
- toStringin class- Object
 
- 
- Returns:
- a String representation of this, of the form [column][row]. The
          columns are represented by letters from a to h, where a
          corresponds to a column argument of 1 to the constructor. The
          rows are numbered from 1 to 8. Thus, from White's perspective,
          the lower-left corner is a1, the lower-right corner is h1, and
          the upper-right corner is h8.