net.sf.freecol.common.model
Class NationType

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
Direct Known Subclasses:
EuropeanNationType, IndianNationType

public abstract class NationType
extends FreeColGameObjectType

Represents one of the nations present in the game.


Nested Class Summary
static class NationType.AggressionLevel
           
static class NationType.SettlementNumber
           
 
Field Summary
private  NationType.AggressionLevel aggression
          The aggression of this Nation.
private  NationType.SettlementNumber numberOfSettlements
          The number of settlements this Nation has.
private  java.util.List<SettlementType> settlementTypes
          The types of settlement this Nation has.
 
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
NationType(java.lang.String id, Specification specification)
           
 
Method Summary
 NationType.AggressionLevel getAggression()
          Get the Aggression value.
 SettlementType getCapitalType()
          Return the SettlementType of the nation type's capital.
 NationType.SettlementNumber getNumberOfSettlements()
          Get the NumberOfSettlements value.
 SettlementType getSettlementType(boolean isCapital)
           
 SettlementType getSettlementType(java.lang.String id)
           
 java.util.List<SettlementType> getSettlementTypes()
          Get the TypeOfSettlement value.
abstract  boolean isEuropean()
          Whether this is a EuropeanNation, i.e.
abstract  boolean isIndian()
          Whether this is a IndianNation.
abstract  boolean isREF()
          Whether this is a EuropeanREFNation.
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 setAggression(NationType.AggressionLevel newAggression)
          Set the Aggression value.
 void setNumberOfSettlements(NationType.SettlementNumber newNumberOfSettlements)
          Set the NumberOfSettlements value.
protected  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.
 
Methods inherited from class net.sf.freecol.common.model.FreeColGameObjectType
addAbility, addModifier, applyDifficultyLevel, getDescriptionKey, getFeatureContainer, getIndex, getModifierIndex, getModifierIndex, getModifierSet, getNameKey, hasAbility, hasAbility, isAbstractType, readChildren, setAbstractType, setFeatureContainer, setIndex, setModifierIndex, toString, toXMLImpl, 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, getXMLElementTagName, 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

numberOfSettlements

private NationType.SettlementNumber numberOfSettlements
The number of settlements this Nation has.


aggression

private NationType.AggressionLevel aggression
The aggression of this Nation.


settlementTypes

private java.util.List<SettlementType> settlementTypes
The types of settlement this Nation has.

Constructor Detail

NationType

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

getSettlementTypes

public final java.util.List<SettlementType> getSettlementTypes()
Get the TypeOfSettlement value.

Returns:
an SettlementType value

getCapitalType

public SettlementType getCapitalType()
Return the SettlementType of the nation type's capital.

Returns:
a SettlementType value

getSettlementType

public SettlementType getSettlementType(boolean isCapital)

getSettlementType

public SettlementType getSettlementType(java.lang.String id)

getNumberOfSettlements

public final NationType.SettlementNumber getNumberOfSettlements()
Get the NumberOfSettlements value.

Returns:
a SettlementNumber value

setNumberOfSettlements

public final void setNumberOfSettlements(NationType.SettlementNumber newNumberOfSettlements)
Set the NumberOfSettlements value.

Parameters:
newNumberOfSettlements - The new NumberOfSettlements value.

getAggression

public final NationType.AggressionLevel getAggression()
Get the Aggression value.

Returns:
an AggressionLevel value

setAggression

public final void setAggression(NationType.AggressionLevel newAggression)
Set the Aggression value.

Parameters:
newAggression - The new Aggression value.

isEuropean

public abstract boolean isEuropean()
Whether this is a EuropeanNation, i.e. a player or a REF.


isIndian

public abstract boolean isIndian()
Whether this is a IndianNation.


isREF

public abstract boolean isREF()
Whether this is a EuropeanREFNation.


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 FreeColGameObjectType
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 FreeColGameObjectType
Parameters:
in - The XML stream to read.
Throws:
javax.xml.stream.XMLStreamException - if an error occurs

writeAttributes

protected 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 FreeColObject
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 FreeColGameObjectType
Parameters:
out - The target stream.
Throws:
javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.