rolec
Class Move

java.lang.Object
  extended by rolec.Move
All Implemented Interfaces:
java.io.Serializable

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

This class represents a move within the game of FranksZoo. There are two types of moves (a) moves in which a Player plays a number of cards and (b) moves in which a player passes (no cards are played).

See Also:
Serialized Form

Constructor Summary
Move(Player p)
          Constructs a new pass Move; no cards are played
Move(Player p, NormalCard c, SpecialCard s, JokerCard j, int n)
          Constructs a new Move in which a number of cards is played.
 
Method Summary
 boolean equals(Move move)
          Returns whether the Move is exactly equal to another Move (i.e., the cards played in both Moves are exactly the same)
 NormalCard getCard()
          Returns the NormalCard played in this move
 JokerCard getJokerCard()
          Returns the JokerCard played in this move
 int getNumber()
          Returns the number of NormalCards played in this move
 int getPlayer()
          Returns the ID of the Player playing this move
 SpecialCard getSpecialCard()
          Returns the SpecialCard played in this move
 int getTotal()
          Returns the totalNumber of cards played during in this move
 boolean isChoice()
          Returns whether this move was a choice or forced (only a pass can be forced)
 boolean isPass()
          Returns whether this move was a pass
 java.lang.String toString()
          Returns the String representation of this move
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Move

public Move(Player p)
Constructs a new pass Move; no cards are played

Parameters:
p - the Player playing the move

Move

public Move(Player p,
            NormalCard c,
            SpecialCard s,
            JokerCard j,
            int n)
Constructs a new Move in which a number of cards is played. In each move where cards are played the Player plays at least one NormalCard. Furthermove, the Player may additionally play at most one SpecialCard and at most one JokerCard.

Parameters:
p - the Player playing the move
c - the NormalCard that is played
s - the SpecialCard that is played; if no SpecialCard is played, this parameter is null
j - the JokerCard that is player; if no JokerCard is played, this parameter is null
n - the number of NormalCards that is played
Method Detail

isChoice

public boolean isChoice()
Returns whether this move was a choice or forced (only a pass can be forced)

Returns:
true if this move was a choice, false otherwise

getTotal

public int getTotal()
Returns the totalNumber of cards played during in this move

Returns:
the totalNumber of cards played during in this move

getPlayer

public int getPlayer()
Returns the ID of the Player playing this move

Returns:
the ID of the Player playing this move

getNumber

public int getNumber()
Returns the number of NormalCards played in this move

Returns:
the number of NormalCards played in this move

getCard

public NormalCard getCard()
Returns the NormalCard played in this move

Returns:
the NormalCard played in this move; if no NormalCard was played (move is a pass), null is returned

getSpecialCard

public SpecialCard getSpecialCard()
Returns the SpecialCard played in this move

Returns:
the SpecialCard played in this move; if no SpecialCard was played, null is returned

getJokerCard

public JokerCard getJokerCard()
Returns the JokerCard played in this move

Returns:
the JokerCard played in this move; if no JokerCard was played, null is returned

toString

public java.lang.String toString()
Returns the String representation of this move

Overrides:
toString in class java.lang.Object
Returns:
the String representation of this move

isPass

public boolean isPass()
Returns whether this move was a pass

Returns:
true if the move is a pass, false otherwise

equals

public boolean equals(Move move)
Returns whether the Move is exactly equal to another Move (i.e., the cards played in both Moves are exactly the same)

Returns:
true if the Move is exactly equal to another Move, false otherwise