org.vizzini.game.boardgame.chess
Class ChessTokenCollection

java.lang.Object
  extended by org.vizzini.util.AbstractCollection
      extended by org.vizzini.game.TokenArrayCollection
          extended by org.vizzini.game.boardgame.chess.ChessTokenCollection
All Implemented Interfaces:
Serializable, Cloneable, Iterable, Collection, ITokenCollection, ICollection

public class ChessTokenCollection
extends TokenArrayCollection

Provides a token collection for chess tokens. Extends the superclass to provide quick access to the Kings.

Since:
v0.3
Version:
v0.3
Author:
Jeffrey M. Thompson
See Also:
Serialized Form

Constructor Summary
ChessTokenCollection()
           
 
Method Summary
 boolean add(Object object)
          Add the given object.
 void clear()
          Removes all of the objects from this collection.
 Object clone()
          Return a clone of this instance.
 IToken get(Class tokenType, IAgent agent0)
          Return the first token found of the given type belonging to the given agent.
protected  IAgent getAgent(boolean isWhite)
          Return the agent for the given parameter.
 IKing getKing(boolean isWhite)
          Return the King for the given parameter.
 IKing getKingBlack()
           
 IKing getKingWhite()
           
protected  IKing locateKing(boolean isWhite)
          Locate the King for the given paramter.
 boolean remove(Object object)
          Remove the given object.
protected  void setKingBlack(IKing kingBlack)
           
protected  void setKingWhite(IKing kingWhite)
           
 
Methods inherited from class org.vizzini.game.TokenArrayCollection
configure, contains, equals, findByName, get, get, getType, hashCode, isEmpty, iterator, iterator, move, move, size
 
Methods inherited from class org.vizzini.util.AbstractCollection
addAll, containsAll, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.vizzini.util.ICollection
toString
 
Methods inherited from interface java.util.Collection
addAll, containsAll, removeAll, retainAll, toArray, toArray
 

Constructor Detail

ChessTokenCollection

public ChessTokenCollection()
Method Detail

add

public boolean add(Object object)
Add the given object. Extend the super method to add property listeners to the token.

Specified by:
add in interface Collection
Overrides:
add in class TokenArrayCollection
Since:
v0.3

clear

public void clear()
Removes all of the objects from this collection. Extends the super method to clear the references to the Kings.

Specified by:
clear in interface Collection
Overrides:
clear in class TokenArrayCollection
Since:
v0.3

clone

public Object clone()
Return a clone of this instance.

Specified by:
clone in interface ITokenCollection
Overrides:
clone in class TokenArrayCollection
Since:
v0.3

get

public IToken get(Class tokenType,
                  IAgent agent0)
Return the first token found of the given type belonging to the given agent.

Specified by:
get in interface ITokenCollection
Overrides:
get in class TokenArrayCollection
Since:
v0.3

getKing

public IKing getKing(boolean isWhite)
Return the King for the given parameter.

Since:
v0.3

getKingBlack

public IKing getKingBlack()
Returns:
Return kingBlack.
Since:
v0.3

getKingWhite

public IKing getKingWhite()
Returns:
Return kingWhite.
Since:
v0.3

remove

public boolean remove(Object object)
Remove the given object. Extend the super method to remove property listeners from the token.

Specified by:
remove in interface Collection
Overrides:
remove in class TokenArrayCollection
Since:
v0.3

getAgent

protected IAgent getAgent(boolean isWhite)
Return the agent for the given parameter.

Parameters:
isWhite - Flag indicating if the white agent is wanted.
Since:
v0.3

locateKing

protected IKing locateKing(boolean isWhite)
Locate the King for the given paramter.

Parameters:
isWhite - Flag indicating if the white King is wanted.
Since:
v0.3

setKingBlack

protected void setKingBlack(IKing kingBlack)
Parameters:
kingBlack - The kingBlack to set.
Since:
v0.3

setKingWhite

protected void setKingWhite(IKing kingWhite)
Parameters:
kingWhite - The kingWhite to set.
Since:
v0.3


Copyright © 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02