net.sf.freecol.common.model
Class FoundingFather

java.lang.Object
  extended by net.sf.freecol.common.model.FreeColObject
      extended by net.sf.freecol.common.model.FreeColGameObjectType
          extended by net.sf.freecol.common.model.FoundingFather

public class FoundingFather
extends FreeColGameObjectType

Represents one FoundingFather to be contained in a Player object. The FoundingFather is able to grant new abilities or bonuses to the player, or to cause certain events.


Nested Class Summary
static class FoundingFather.FoundingFatherType
           
 
Field Summary
private  java.util.Set<java.lang.String> availableTo
          Stores the IDs of the Nations and NationTypes this FoundingFather is available to.
private  java.util.Map<java.lang.String,java.lang.String> events
          Stores the Events of this Type.
private  FoundingFather.FoundingFatherType type
          The type of this FoundingFather.
private  java.util.List<AbstractUnit> units
          A list of AbstractUnits generated by this FoundingFather.
private  java.util.Map<UnitType,UnitType> upgrades
          Holds the upgrades of Units caused by this FoundingFather.
private  int[] weight
          The probability of this FoundingFather being offered for selection.
 
Fields inherited from class net.sf.freecol.common.model.FreeColGameObjectType
featureContainer
 
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, logger, PARTIAL_ATTRIBUTE
 
Constructor Summary
FoundingFather(int newIndex)
          Creates a new FoundingFather instance.
 
Method Summary
 java.util.Map<java.lang.String,java.lang.String> getEvents()
          Returns all events.
 FoundingFather.FoundingFatherType getType()
          Return the type of this FoundingFather.
 java.util.List<AbstractUnit> getUnits()
          Get the Units value.
 java.util.Map<UnitType,UnitType> getUpgrades()
          Get the Upgrades value.
 int getWeight(int age)
          Get the weight of this FoundingFather.
 boolean isAvailableTo(Player player)
          Returns true if this FoundingFather is available to the Player given.
 void readAttributes(javax.xml.stream.XMLStreamReader in, Specification specification)
           
 void readChildren(javax.xml.stream.XMLStreamReader in, Specification specification)
           
 void setEvents(java.util.Map<java.lang.String,java.lang.String> newEvents)
          Describe setEvents method here.
 void setUnits(java.util.List<AbstractUnit> newUnits)
          Set the Units value.
 void setUpgrades(java.util.Map<UnitType,UnitType> newUpgrades)
          Set the Upgrades value.
 
Methods inherited from class net.sf.freecol.common.model.FreeColGameObjectType
addAbility, addModifier, getFeatureContainer, getIndex, getModifierSet, hasAbility, hasAbility, readChild, readFromXML, readFromXMLImpl, setFeatureContainer, setIndex, toString, toXMLImpl
 
Methods inherited from class net.sf.freecol.common.model.FreeColObject
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAttribute, getAttribute, getAttribute, getAttribute, getId, getPropertyChangeListeners, getPropertyChangeListeners, getXMLElementTagName, hasAttribute, hasListeners, readAttributes, readChildren, readFromArrayElement, readFromArrayElement, readFromArrayElement, readFromListElement, readFromXML, readFromXMLElement, readFromXMLPartialImpl, removePropertyChangeListener, removePropertyChangeListener, setId, toArrayElement, toArrayElement, toListElement, toXML, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, toXMLPartialImpl, writeAttribute, writeAttributes, writeChildren, writeFreeColGameObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

weight

private int[] weight
The probability of this FoundingFather being offered for selection.


type

private FoundingFather.FoundingFatherType type
The type of this FoundingFather. One of the following constants.


upgrades

private java.util.Map<UnitType,UnitType> upgrades
Holds the upgrades of Units caused by this FoundingFather.


events

private java.util.Map<java.lang.String,java.lang.String> events
Stores the Events of this Type.


availableTo

private java.util.Set<java.lang.String> availableTo
Stores the IDs of the Nations and NationTypes this FoundingFather is available to.


units

private java.util.List<AbstractUnit> units
A list of AbstractUnits generated by this FoundingFather.

Constructor Detail

FoundingFather

public FoundingFather(int newIndex)
Creates a new FoundingFather instance.

Parameters:
newIndex - an int value
Method Detail

getType

public FoundingFather.FoundingFatherType getType()
Return the type of this FoundingFather.

Returns:
an int value

getWeight

public int getWeight(int age)
Get the weight of this FoundingFather. This is used to select a random FoundingFather.

Parameters:
age - an int value
Returns:
an int value

getUnits

public final java.util.List<AbstractUnit> getUnits()
Get the Units value.

Returns:
a List value

setUnits

public final void setUnits(java.util.List<AbstractUnit> newUnits)
Set the Units value.

Parameters:
newUnits - The new Units value.

isAvailableTo

public boolean isAvailableTo(Player player)
Returns true if this FoundingFather is available to the Player given.

Parameters:
player - a Player value
Returns:
a boolean value

getUpgrades

public final java.util.Map<UnitType,UnitType> getUpgrades()
Get the Upgrades value.

Returns:
a Map value

setUpgrades

public final void setUpgrades(java.util.Map<UnitType,UnitType> newUpgrades)
Set the Upgrades value.

Parameters:
newUpgrades - The new Upgrades value.

getEvents

public java.util.Map<java.lang.String,java.lang.String> getEvents()
Returns all events.

Returns:
a List of Events.

setEvents

public void setEvents(java.util.Map<java.lang.String,java.lang.String> newEvents)
Describe setEvents method here.


readAttributes

public void readAttributes(javax.xml.stream.XMLStreamReader in,
                           Specification specification)
                    throws javax.xml.stream.XMLStreamException
Overrides:
readAttributes in class FreeColGameObjectType
Throws:
javax.xml.stream.XMLStreamException

readChildren

public void readChildren(javax.xml.stream.XMLStreamReader in,
                         Specification specification)
                  throws javax.xml.stream.XMLStreamException
Overrides:
readChildren in class FreeColGameObjectType
Throws:
javax.xml.stream.XMLStreamException