net.sf.colossus.client
Class LegionClientSide

java.lang.Object
  extended by net.sf.colossus.game.Legion
      extended by net.sf.colossus.client.LegionClientSide
All Implemented Interfaces:
IOracleLegion

public final class LegionClientSide
extends Legion
implements IOracleLegion

Client-side version of a legion.

Author:
David Ripton

Nested Class Summary
 
Nested classes/interfaces inherited from class net.sf.colossus.game.Legion
Legion.AcquirableDecision
 
Field Summary
private static java.util.logging.Logger LOGGER
           
private  PredictSplitNode myNode
           
 
Fields inherited from class net.sf.colossus.game.Legion
angelsToAcquire, decisions, ORDER_TITAN_THEN_POINTS, ORDER_TITAN_THEN_POINTS_THEN_MARKER
 
Constructor Summary
LegionClientSide(Player player, java.lang.String markerId, MasterHex hex)
           
 
Method Summary
 void addCreature(CreatureType creature)
          Add a new creature to this legion.
 boolean contains(java.lang.String creatureName)
          A less typesafe version of Legion.contains(CreatureType).
 int getCertainPointValue()
          Return the total point value of those creatures of this legion which are certain.
 java.util.List<java.lang.Boolean> getCertainties()
          Return a list of Booleans.
private  java.util.List<java.lang.String> getContents()
          Return an immutable copy of the legion's contents, in sorted order.
 java.util.List<? extends Creature> getCreatures()
          We don't use the creature list in this class yet, so we override this to use the one from the PredictSplitNode.
 int getHeight()
          Returns the number of creatures in this legion.
 java.util.List<java.lang.String> getImageNames()
          Return a list of Strings.
private  PredictSplitNode getNode()
           
private  PredictSplitNode getNode(java.lang.String markerId)
           
 PlayerClientSide getPlayer()
          Retrieves the player this legion belongs to.
 int getPointValue()
          Return the point value of suspected contents of this legion.
(package private)  void merge(Legion splitoff)
           
 int numCreature(java.lang.String creatureName)
          TODO get rid of string-based version
 int numUncertainCreatures()
           
 void removeCreature(CreatureType creature)
           
(package private)  void revealCreatures(java.util.List<CreatureType> creatures)
          Reveal creatures in this legion, some of which already may be known.
(package private)  void split(int childHeight, Legion child, int turn)
           
 
Methods inherited from class net.sf.colossus.game.Legion
canFlee, contains, equals, findEligibleAngels, getCreatureTypes, getCurrentHex, getEntrySide, getLongMarkerId, getMarkerId, getRecruit, getSkipThisTime, getTitan, getVisitedThisPhase, hashCode, hasMoved, hasRecruited, hasSummonable, hasTeleported, hasTitan, numCreature, numLords, numRangestrikers, setCurrentHex, setEntrySide, setMoved, setRecruit, setSkipThisTime, setTeleported, setupAcquirableDecisions, setVisitedThisPhase, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.colossus.variant.IOracleLegion
contains, numCreature
 

Field Detail

LOGGER

private static final java.util.logging.Logger LOGGER

myNode

private PredictSplitNode myNode
Constructor Detail

LegionClientSide

public LegionClientSide(Player player,
                        java.lang.String markerId,
                        MasterHex hex)
Method Detail

getNode

private PredictSplitNode getNode(java.lang.String markerId)

getNode

private PredictSplitNode getNode()

getHeight

public int getHeight()
Description copied from class: Legion
Returns the number of creatures in this legion.

Specified by:
getHeight in interface IOracleLegion
Overrides:
getHeight in class Legion
Returns:
the number of creatures in the legion

getCreatures

public java.util.List<? extends Creature> getCreatures()
We don't use the creature list in this class yet, so we override this to use the one from the PredictSplitNode. TODO fix this, particularly the use of creature names in here. Note that the current version also has the issue that every time this method is called a new list with new creatures is created, which will break identity checks.

Overrides:
getCreatures in class Legion

getContents

private java.util.List<java.lang.String> getContents()
Return an immutable copy of the legion's contents, in sorted order. TODO get rid of this string-based version in favor of the typesafe ones


contains

public boolean contains(java.lang.String creatureName)
A less typesafe version of Legion.contains(CreatureType). TODO deprecate and remove

Specified by:
contains in interface IOracleLegion

numCreature

public int numCreature(java.lang.String creatureName)
TODO get rid of string-based version

Specified by:
numCreature in interface IOracleLegion

getImageNames

public java.util.List<java.lang.String> getImageNames()
Return a list of Strings. Use the proper string for titans and unknown creatures.


getCertainties

public java.util.List<java.lang.Boolean> getCertainties()
Return a list of Booleans.


getPlayer

public PlayerClientSide getPlayer()
Description copied from class: Legion
Retrieves the player this legion belongs to.

Overrides:
getPlayer in class Legion
Returns:
The matching player. Never null.

addCreature

public void addCreature(CreatureType creature)
Add a new creature to this legion.

Specified by:
addCreature in class Legion

removeCreature

public void removeCreature(CreatureType creature)
Specified by:
removeCreature in class Legion

revealCreatures

void revealCreatures(java.util.List<CreatureType> creatures)
Reveal creatures in this legion, some of which already may be known.


split

void split(int childHeight,
           Legion child,
           int turn)

merge

void merge(Legion splitoff)

getPointValue

public int getPointValue()
Return the point value of suspected contents of this legion.

Specified by:
getPointValue in class Legion

getCertainPointValue

public int getCertainPointValue()
Return the total point value of those creatures of this legion which are certain.


numUncertainCreatures

public int numUncertainCreatures()