jeops.examples.queens
Class Queen

java.lang.Object
  |
  +--jeops.examples.queens.Queen
Direct Known Subclasses:
QueenRow1, QueenRow2, QueenRow3, QueenRow4, QueenRow5, QueenRow6, QueenRow7, QueenRow8

public class Queen
extends java.lang.Object

Represents a queen in a chess board.

Version:
0.01 06 Apr 2000
Author:
Carlos Figueira Filho (csff@di.ufpe.br)

Constructor Summary
Queen(int row, int column)
          Class constructor.
 
Method Summary
 boolean attacks(Queen q)
          Checks whether this queen can be attacked by the given one.
 void dump()
          Prints this queen.
 void dump(int spaces)
          Prints this queen with the specified identation.
 int getColumn()
          Returns the column of this queen.
 int getRow()
          Returns the row of this queen.
 java.lang.String toString()
          Returns a string representation of this queen.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Queen

public Queen(int row,
             int column)
Class constructor.
Parameters:
row - the row of the board.
column - the column of the board.
Method Detail

getRow

public int getRow()
Returns the row of this queen.
Returns:
the row of this queen.

getColumn

public int getColumn()
Returns the column of this queen.
Returns:
the column of this queen.

attacks

public boolean attacks(Queen q)
Checks whether this queen can be attacked by the given one.
Parameters:
the - queen that tries to attack this one
Returns:
true if this queen can be attacked by the given one; false otherwise.

dump

public void dump()
Prints this queen. Useful for debugging.

dump

public void dump(int spaces)
Prints this queen with the specified identation. Useful for debugging.
Parameters:
spaces - the desired identation

toString

public java.lang.String toString()
Returns a string representation of this queen. Useful for debugging.
Overrides:
toString in class java.lang.Object
Returns:
a string representation of this queen.