net.sf.freecol.common.model
Class EuropeanNationType

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.NationType
              extended by net.sf.freecol.common.model.EuropeanNationType

public class EuropeanNationType
extends NationType

Represents one of the European nations present in the game, i.e. both REFs and possible human players.


Nested Class Summary
 
Nested classes/interfaces inherited from class net.sf.freecol.common.model.NationType
NationType.AggressionLevel, NationType.SettlementNumber
 
Field Summary
private  boolean ref
          Whether this is an REF Nation.
private  java.util.Map<java.lang.String,java.util.Map<java.lang.String,AbstractUnit>> startingUnitMap
          Stores the starting units of this Nation at various difficulties.
private  java.util.List<AbstractUnit> startingUnits
          Stores the starting units of this Nation.
 
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, INFINITY, logger, NO_ID, PARTIAL_ATTRIBUTE, UNDEFINED, VALUE_TAG
 
Constructor Summary
EuropeanNationType(java.lang.String id, Specification specification)
           
 
Method Summary
 void applyDifficultyLevel(OptionGroup difficulty)
          Applies the difficulty level to this nation type.
 java.util.List<AbstractUnit> getStartingUnits()
          Returns a list of this Nation's starting units.
 java.util.List<AbstractUnit> getStartingUnits(java.lang.String key)
          Returns a list of this Nation's starting units at the given difficulty.
static java.lang.String getXMLElementTagName()
          Returns the tag name of the root element representing this object.
 boolean isEuropean()
          Returns true.
 boolean isIndian()
          Returns false.
 boolean isREF()
          Get the REF value.
protected  void readAttributes(javax.xml.stream.XMLStreamReader in)
          Reads the attributes of this object from an XML stream.
protected  void readChild(javax.xml.stream.XMLStreamReader in)
          Reads a child object.
 void setREF(boolean newREF)
          Set the REF value.
 void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
          Makes an XML-representation of this object.
 void writeAttributes(javax.xml.stream.XMLStreamWriter out)
          Write the attributes of this object to a stream.
protected  void writeChildren(javax.xml.stream.XMLStreamWriter out)
          Write the children of this object to a stream.
private  void writeUnit(javax.xml.stream.XMLStreamWriter out, java.lang.String id, AbstractUnit unit, boolean expert)
           
 
Methods inherited from class net.sf.freecol.common.model.NationType
getAggression, getCapitalType, getNumberOfSettlements, getSettlementType, getSettlementType, getSettlementTypes, setAggression, setNumberOfSettlements
 
Methods inherited from class net.sf.freecol.common.model.FreeColGameObjectType
addAbility, addModifier, getDescriptionKey, getFeatureContainer, getIndex, getModifierIndex, getModifierIndex, getModifierSet, getNameKey, hasAbility, hasAbility, isAbstractType, readChildren, setAbstractType, setFeatureContainer, setIndex, setModifierIndex, toString, toXMLImpl
 
Methods inherited from class net.sf.freecol.common.model.FreeColObject
addPropertyChangeListener, addPropertyChangeListener, dumpObject, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getId, getPropertyChangeListeners, getPropertyChangeListeners, getSpecification, hasAttribute, hasListeners, readAttributes, readChild, readChildren, readFromArrayElement, readFromArrayElement, readFromListElement, readFromXML, readFromXMLElement, readFromXMLImpl, readFromXMLImpl, readFromXMLPartialImpl, removePropertyChangeListener, removePropertyChangeListener, save, save, setId, setSpecification, toXML, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, toXMLPartialImpl, writeAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ref

private boolean ref
Whether this is an REF Nation.


startingUnits

private java.util.List<AbstractUnit> startingUnits
Stores the starting units of this Nation.


startingUnitMap

private java.util.Map<java.lang.String,java.util.Map<java.lang.String,AbstractUnit>> startingUnitMap
Stores the starting units of this Nation at various difficulties.

Constructor Detail

EuropeanNationType

public EuropeanNationType(java.lang.String id,
                          Specification specification)
Method Detail

isREF

public final boolean isREF()
Get the REF value.

Specified by:
isREF in class NationType
Returns:
a boolean value

setREF

public final void setREF(boolean newREF)
Set the REF value.

Parameters:
newREF - The new REF value.

isEuropean

public boolean isEuropean()
Returns true.

Specified by:
isEuropean in class NationType
Returns:
a boolean value

isIndian

public boolean isIndian()
Returns false.

Specified by:
isIndian in class NationType
Returns:
a boolean value

getStartingUnits

public java.util.List<AbstractUnit> getStartingUnits()
Returns a list of this Nation's starting units.

Returns:
a list of this Nation's starting units.

getStartingUnits

public java.util.List<AbstractUnit> getStartingUnits(java.lang.String key)
Returns a list of this Nation's starting units at the given difficulty.

Parameters:
key - the value of the expert-starting-units field
Returns:
a list of this Nation's starting units.

applyDifficultyLevel

public void applyDifficultyLevel(OptionGroup difficulty)
Applies the difficulty level to this nation type.

Overrides:
applyDifficultyLevel in class FreeColGameObjectType
Parameters:
difficulty - difficulty level to apply

toXMLImpl

public void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
               throws javax.xml.stream.XMLStreamException
Makes an XML-representation of this object.

Overrides:
toXMLImpl in class FreeColGameObjectType
Parameters:
out - The output stream.
Throws:
javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.

writeAttributes

public void writeAttributes(javax.xml.stream.XMLStreamWriter out)
                     throws javax.xml.stream.XMLStreamException
Write the attributes of this object to a stream.

Overrides:
writeAttributes in class NationType
Parameters:
out - The target stream.
Throws:
javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.

writeChildren

protected void writeChildren(javax.xml.stream.XMLStreamWriter out)
                      throws javax.xml.stream.XMLStreamException
Write the children of this object to a stream.

Overrides:
writeChildren in class NationType
Parameters:
out - The target stream.
Throws:
javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.

writeUnit

private void writeUnit(javax.xml.stream.XMLStreamWriter out,
                       java.lang.String id,
                       AbstractUnit unit,
                       boolean expert)
                throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

readAttributes

protected void readAttributes(javax.xml.stream.XMLStreamReader in)
                       throws javax.xml.stream.XMLStreamException
Reads the attributes of this object from an XML stream.

Overrides:
readAttributes in class NationType
Parameters:
in - The XML input stream.
Throws:
javax.xml.stream.XMLStreamException - if a problem was encountered during parsing.

readChild

protected void readChild(javax.xml.stream.XMLStreamReader in)
                  throws javax.xml.stream.XMLStreamException
Reads a child object.

Overrides:
readChild in class NationType
Parameters:
in - The XML stream to read.
Throws:
javax.xml.stream.XMLStreamException - if an error occurs

getXMLElementTagName

public static java.lang.String getXMLElementTagName()
Returns the tag name of the root element representing this object.

Returns:
"european-nation-type".