rails.game.action
Class LayTile

java.lang.Object
  extended by rails.game.action.PossibleAction
      extended by rails.game.action.PossibleORAction
          extended by rails.game.action.LayTile
All Implemented Interfaces:
java.io.Serializable

public class LayTile
extends PossibleORAction

Author:
Erik Vos
See Also:
Serialized Form

Field Summary
static int GENERIC
           
static int LOCATION_SPECIFIC
           
static long serialVersionUID
           
static int SPECIAL_PROPERTY
           
protected  int type
           
 
Fields inherited from class rails.game.action.PossibleORAction
company, companyName
 
Fields inherited from class rails.game.action.PossibleAction
acted, gameManager, log, playerIndex, playerName
 
Constructor Summary
LayTile(java.util.List<MapHex> locations, java.util.List<TileI> tiles)
          Allow laying a tile on a given location.
LayTile(java.util.Map<java.lang.String,java.lang.Integer> tileColours)
           
LayTile(SpecialTileLay specialProperty)
           
 
Method Summary
 void addRelayBaseToken(java.lang.String companyName, java.lang.Integer cityNumber)
           
 boolean equalsAsAction(PossibleAction action)
          Compare the chosen actions of two action objects.
 boolean equalsAsOption(PossibleAction action)
          Compare the choice options of two action objects, without regard to whatever choice has been made, if any.
 MapHex getChosenHex()
           
 TileI getLaidTile()
           
 java.util.List<MapHex> getLocations()
           
 int getOrientation()
           
 java.util.Map<java.lang.String,java.lang.Integer> getRelaidBaseTokens()
           
 SpecialTileLay getSpecialProperty()
           
 java.util.Map<java.lang.String,java.lang.Integer> getTileColours()
           
 java.util.List<TileI> getTiles()
           
 int getType()
           
 boolean isRelayBaseTokens()
           
 boolean isTileColourAllowed(java.lang.String tileColour)
           
 void setChosenHex(MapHex chosenHex)
           
 void setLaidTile(TileI laidTile)
           
 void setOrientation(int orientation)
           
 void setRelayBaseTokens(boolean relayBaseTokens)
           
 void setSpecialProperty(SpecialTileLay specialProperty)
           
 void setTileColours(java.util.Map<java.lang.String,java.lang.Integer> map)
           
 void setTiles(java.util.List<TileI> tiles)
           
 java.lang.String toString()
           
 
Methods inherited from class rails.game.action.PossibleORAction
getCompany, getCompanyName, setCompany
 
Methods inherited from class rails.game.action.PossibleAction
getCompanyManager, getGameManager, getPlayerIndex, getPlayerName, hasActed, setActed, setPlayerName, toMenu
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

GENERIC

public static final int GENERIC
See Also:
Constant Field Values

LOCATION_SPECIFIC

public static final int LOCATION_SPECIFIC
See Also:
Constant Field Values

SPECIAL_PROPERTY

public static final int SPECIAL_PROPERTY
See Also:
Constant Field Values

type

protected int type

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

LayTile

public LayTile(java.util.List<MapHex> locations,
               java.util.List<TileI> tiles)
Allow laying a tile on a given location.


LayTile

public LayTile(java.util.Map<java.lang.String,java.lang.Integer> tileColours)

LayTile

public LayTile(SpecialTileLay specialProperty)
Method Detail

getChosenHex

public MapHex getChosenHex()
Returns:
Returns the chosenHex.

setChosenHex

public void setChosenHex(MapHex chosenHex)
Parameters:
chosenHex - The chosenHex to set.

getOrientation

public int getOrientation()

setOrientation

public void setOrientation(int orientation)

getLaidTile

public TileI getLaidTile()
Returns:
Returns the laidTile.

setLaidTile

public void setLaidTile(TileI laidTile)
Parameters:
laidTile - The laidTile to set.

getSpecialProperty

public SpecialTileLay getSpecialProperty()
Returns:
Returns the specialProperty.

setSpecialProperty

public void setSpecialProperty(SpecialTileLay specialProperty)
Parameters:
specialProperty - The specialProperty to set.

getTiles

public java.util.List<TileI> getTiles()
Returns:
Returns the tiles.

setTiles

public void setTiles(java.util.List<TileI> tiles)
Parameters:
tiles - The tiles to set.

getLocations

public java.util.List<MapHex> getLocations()

getType

public int getType()

getTileColours

public java.util.Map<java.lang.String,java.lang.Integer> getTileColours()
Returns:
Returns the tileColours.

isTileColourAllowed

public boolean isTileColourAllowed(java.lang.String tileColour)

setTileColours

public void setTileColours(java.util.Map<java.lang.String,java.lang.Integer> map)

isRelayBaseTokens

public boolean isRelayBaseTokens()

setRelayBaseTokens

public void setRelayBaseTokens(boolean relayBaseTokens)

addRelayBaseToken

public void addRelayBaseToken(java.lang.String companyName,
                              java.lang.Integer cityNumber)

getRelaidBaseTokens

public java.util.Map<java.lang.String,java.lang.Integer> getRelaidBaseTokens()

equalsAsOption

public boolean equalsAsOption(PossibleAction action)
Description copied from class: PossibleAction
Compare the choice options of two action objects, without regard to whatever choice has been made, if any. In other words: only the server-set (prior) attributes must be compared.

This method is used by the server (engine) to validate the incoming action that has actually been chosen in the client (GUI), but only for the purpose to check if the chosen option was really on offer, not to check if the chosen action is actually valid. These perspectives could give different results in cases where the PossibleAction does not fully restrict choices to valid values only (such as the blanket LayTile that does no restrict the hex to lay a tile on, or the SetDividend that will accept any revenue value).

Specified by:
equalsAsOption in class PossibleAction
Parameters:
action - Another PossibleAction to compare with.
Returns:
True if the compared PossibleAction object has equal choice options.

equalsAsAction

public boolean equalsAsAction(PossibleAction action)
Description copied from class: PossibleAction
Compare the chosen actions of two action objects. In other words: the client-set (posterior) attributes must be compared, in addition to those server-set (prior) attributes that sufficiently identify the action.

This method is used by the server (engine) to check if two action objects represent the same actual action, as is done when reloading a saved file (i.e. loading a later stage of the same game).

Specified by:
equalsAsAction in class PossibleAction
Parameters:
action - Another PossibleAction to compare with.
Returns:
True if the compared PossibleAction object has equal selected action values.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object