mixmeta4
Class Square

java.lang.Object
  extended by mixmeta4.Square
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class Square
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

See Also:
Serialized Form

Field Summary
 int column
          deprecated - use getColumn()
 SquareGUI gui
           
 int row
          deprecated - user getRow()
 
Constructor Summary
Square()
           
Square(Board board, int row, int column)
          Deprecated.
Square(Board board, int row, int column, boolean visible)
           
 
Method Summary
 java.lang.Object clone()
           
 boolean equals(java.lang.Object obj)
           
 boolean existsNeighbour(java.awt.Point direction)
           
 int getColumn()
          Get the column number of this square.
 java.awt.Point getLocation()
          Return the location of this square as a Point(row,column), where row 1 is at the top, and column 1 is on the left.
 int getRow()
          Get the row number of this square.
 int hashCode()
           
 boolean isEmpty()
           
 boolean isOccupied()
           
 boolean isOccupiedByBlack()
           
 boolean isOccupiedByMe(boolean redToMove)
           
 boolean isOccupiedByOpponent(boolean redToMove)
           
 boolean isOccupiedByRed()
           
 Piece look()
          Return the piece occupying this square.
 Square neighbour(java.awt.Point direction)
           
 void put(Piece piece)
           
 Piece take()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

gui

public SquareGUI gui

row

public int row
deprecated - user getRow()


column

public int column
deprecated - use getColumn()

Constructor Detail

Square

public Square(Board board,
              int row,
              int column,
              boolean visible)

Square

public Square(Board board,
              int row,
              int column)
Deprecated. Assumes visible is true by default.


Square

public Square()
Method Detail

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

getLocation

public java.awt.Point getLocation()
Return the location of this square as a Point(row,column), where row 1 is at the top, and column 1 is on the left.


isEmpty

public boolean isEmpty()

isOccupied

public boolean isOccupied()

isOccupiedByRed

public boolean isOccupiedByRed()

isOccupiedByBlack

public boolean isOccupiedByBlack()

isOccupiedByOpponent

public boolean isOccupiedByOpponent(boolean redToMove)

isOccupiedByMe

public boolean isOccupiedByMe(boolean redToMove)

put

public void put(Piece piece)
         throws java.lang.RuntimeException
Throws:
java.lang.RuntimeException

take

public Piece take()
           throws java.lang.RuntimeException
Throws:
java.lang.RuntimeException

look

public Piece look()
           throws java.lang.RuntimeException
Return the piece occupying this square.

Throws:
java.lang.RuntimeException

existsNeighbour

public boolean existsNeighbour(java.awt.Point direction)

neighbour

public Square neighbour(java.awt.Point direction)

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getRow

public int getRow()
Get the row number of this square.


getColumn

public int getColumn()
Get the column number of this square.