spellcast.game
Class Turn

java.lang.Object
  extended by spellcast.game.Turn
All Implemented Interfaces:
java.io.Serializable

public class Turn
extends java.lang.Object
implements java.io.Serializable

A Turn contains a number that indicates what sequence of turns this turn is as well as a type to indicate the type of the turn. A Turn is a data object used by spellcast.

Author:
Barrie Treloar
See Also:
Serialized Form

Field Summary
static Turn AFTER_GAME
           
static Turn BEFORE_GAME
           
 
Constructor Summary
Turn(int theTurnNumber, TurnType theTurnType)
           
 
Method Summary
 boolean equals(java.lang.Object o)
          
 Turn getNextTurn(TurnType theTurnType)
          Return the next turn given the turn type.
 int getNumber()
          The value of the turn number.
 TurnType getType()
          The type of the turn.
 int hashCode()
          
 boolean isHaste()
          Indicates whether this turn is a Haste turn.
 boolean isNormal()
          Indicates whether this turn is a Normal turn.
 boolean isTimeStop()
          Indicates whether this turn is a TimeStop turn.
 void setNumber(int theTurnNumber)
          Set the value of the turn number.
 void setType(TurnType theTurnType)
          Set the value of the turn type.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

AFTER_GAME

public static final Turn AFTER_GAME

BEFORE_GAME

public static final Turn BEFORE_GAME
Constructor Detail

Turn

public Turn(int theTurnNumber,
            TurnType theTurnType)
Method Detail

equals

public boolean equals(java.lang.Object o)

Overrides:
equals in class java.lang.Object

getNextTurn

public Turn getNextTurn(TurnType theTurnType)
Return the next turn given the turn type. NORMAL and HASTE turns increment the turn number but TIMESTOP turns are part of the current turn number.


getNumber

public int getNumber()
The value of the turn number.

Returns:
value of the turn number.

getType

public TurnType getType()
The type of the turn.

Returns:
the type of the turn.

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

isHaste

public boolean isHaste()
Indicates whether this turn is a Haste turn.


isNormal

public boolean isNormal()
Indicates whether this turn is a Normal turn.


isTimeStop

public boolean isTimeStop()
Indicates whether this turn is a TimeStop turn.


setNumber

public void setNumber(int theTurnNumber)
Set the value of the turn number.

Parameters:
theTurnNumber - Value to assign to turn number.

setType

public void setType(TurnType theTurnType)
Set the value of the turn type.

Parameters:
theTurnType - Value to assign to the tur ntype.

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object


Copyright © 2001-2005 Spellcast. All Rights Reserved.