net.sf.freecol.common.model
Class Specification

java.lang.Object
  extended by net.sf.freecol.common.model.Specification

public final class Specification
extends java.lang.Object

This class encapsulates any parts of the "specification" for FreeCol that are expressed best using XML. The XML is loaded through the class loader from the resource named "specification.xml" in the same package as this class.


Nested Class Summary
private static interface Specification.ChildReader
           
private  class Specification.ModifierReader
           
private  class Specification.OptionReader
           
private  class Specification.TypeReader<T extends FreeColGameObjectType>
           
 
Field Summary
private  java.util.Map<java.lang.String,java.util.List<Ability>> allAbilities
           
private  java.util.Map<java.lang.String,java.util.List<Modifier>> allModifiers
           
private  java.util.Map<java.lang.String,OptionGroup> allOptionGroups
           
private  java.util.Map<java.lang.String,AbstractOption> allOptions
           
private  java.util.Map<java.lang.String,FreeColGameObjectType> allTypes
           
static FreeColGameObjectType AMBUSH_BONUS_SOURCE
           
static FreeColGameObjectType AMPHIBIOUS_ATTACK_PENALTY_SOURCE
           
static FreeColGameObjectType ARTILLERY_PENALTY_SOURCE
           
static FreeColGameObjectType ATTACK_BONUS_SOURCE
           
static FreeColGameObjectType BASE_DEFENCE_SOURCE
           
static FreeColGameObjectType BASE_OFFENCE_SOURCE
           
private  java.util.List<BuildingType> buildingTypeList
           
static FreeColGameObjectType CARGO_PENALTY_SOURCE
           
static FreeColGameObjectType COLONY_GOODS_PARTY_SOURCE
           
private  java.lang.String difficultyLevel
           
private  java.util.List<EquipmentType> equipmentTypes
           
private  java.util.List<Nation> europeanNations
           
private  java.util.List<EuropeanNationType> europeanNationTypes
           
private  java.util.List<Event> events
           
private  java.util.Map<GoodsType,UnitType> experts
           
private  java.util.List<GoodsType> farmedGoodsTypeList
           
private  java.util.List<GoodsType> foodGoodsTypeList
           
static FreeColGameObjectType FORTIFICATION_BONUS_SOURCE
           
private  java.util.List<FoundingFather> foundingFathers
           
private  java.util.List<GoodsType> goodsTypeList
           
private  java.lang.String id
           
private  java.util.List<GoodsType> immigrationGoodsTypeList
           
static FreeColGameObjectType INDIAN_RAID_BONUS_SOURCE
           
private  java.util.List<Nation> indianNations
           
private  java.util.List<IndianNationType> indianNationTypes
           
private  boolean initialized
           
private  java.util.List<GoodsType> libertyGoodsTypeList
           
private static java.util.logging.Logger logger
           
static FreeColGameObjectType MOVEMENT_PENALTY_SOURCE
           
private  java.util.List<Nation> nations
           
private  java.util.List<NationType> nationTypes
           
private  java.util.List<GoodsType> newWorldGoodsTypeList
           
private  java.util.List<GoodsType> rawBuildingGoodsTypeList
           
private  java.util.Map<java.lang.String,Specification.ChildReader> readerMap
           
private  java.util.List<Nation> REFNations
           
private  java.util.List<EuropeanNationType> REFNationTypes
           
private  java.util.List<ResourceType> resourceTypeList
           
static FreeColGameObjectType SHIP_TRADE_PENALTY_SOURCE
           
private  java.util.List<Modifier> specialModifiers
           
private  int storableTypes
           
private  java.util.List<TileImprovementType> tileImprovementTypeList
           
private  java.util.List<TileType> tileTypeList
           
private  java.util.List<UnitType> unitTypeList
           
private  java.util.List<UnitType> unitTypesPurchasedInEurope
           
private  java.util.List<UnitType> unitTypesTrainedInEurope
           
 
Constructor Summary
Specification()
           
Specification(java.io.InputStream in)
          Creates a new Specification object by loading it from the given InputStream.
 
Method Summary
 void addAbility(Ability ability)
          Registers an Ability as defined.
 void addAbility(java.lang.String id)
          Registers an Ability's id as defined.
 void addAbstractOption(AbstractOption abstractOption)
          Adds an AbstractOption to the specification
 void addModifier(Modifier modifier)
          Add a modifier.
private  void addOptionGroup(OptionGroup optionGroup, boolean recursive)
          Adds an OptionGroup to the specification
 void applyDifficultyLevel(int difficultyLevel)
          Applies the difficulty level identified by the given integer to the current specification.
 void applyDifficultyLevel(OptionGroup level)
          Applies the given difficulty level to the current specification.
 void applyDifficultyLevel(java.lang.String difficultyLevel)
          Applies the difficulty level identified by the given String to the current specification.
 void clean()
           
 java.util.List<Ability> getAbilities(java.lang.String id)
          Return a list of all Abilities with the given id.
 boolean getBoolean(java.lang.String id)
          Gets the boolean value of an option.
 BooleanOption getBooleanOption(java.lang.String Id)
          Returns the BooleanOption with the given ID.
 BuildingType getBuildingType(int buildingTypeIndex)
          Describe getBuildingType method here.
 BuildingType getBuildingType(java.lang.String id)
           
 java.util.List<BuildingType> getBuildingTypeList()
           
 UnitType getDefaultUnitType()
          Gets the most vanilla unit type.
 OptionGroup getDifficultyLevel()
          Return the current difficulty level.
 OptionGroup getDifficultyLevel(int level)
          Describe getDifficultyLevel method here.
 OptionGroup getDifficultyLevel(java.lang.String id)
          Describe getDifficultyLevel method here.
 java.util.List<OptionGroup> getDifficultyLevels()
           
 EquipmentType getEquipmentType(java.lang.String id)
           
 java.util.List<EquipmentType> getEquipmentTypeList()
           
 java.util.List<Nation> getEuropeanNations()
           
 java.util.List<EuropeanNationType> getEuropeanNationTypes()
           
 Event getEvent(java.lang.String id)
           
 java.util.List<Event> getEvents()
           
 UnitType getExpertForProducing(GoodsType goodsType)
           
 java.util.List<GoodsType> getFarmedGoodsTypeList()
           
 java.util.List<GoodsType> getFoodGoodsTypeList()
           
 FoundingFather getFoundingFather(java.lang.String id)
           
 java.util.List<FoundingFather> getFoundingFathers()
           
 GoodsType getGoodsType(java.lang.String id)
          Describe getGoodsType method here.
 java.util.List<GoodsType> getGoodsTypeList()
           
 java.lang.String getId()
          Describe getId method here.
 java.util.List<GoodsType> getImmigrationGoodsTypeList()
           
 java.util.List<Nation> getIndianNations()
           
 java.util.List<IndianNationType> getIndianNationTypes()
           
 int getInteger(java.lang.String id)
          Gets the integer value of an option.
 IntegerOption getIntegerOption(java.lang.String Id)
          Returns the IntegerOption with the given ID.
 java.util.List<GoodsType> getLibertyGoodsTypeList()
           
 java.util.List<Modifier> getModifiers(java.lang.String id)
          Return a list of all Modifiers with the given id.
 Nation getNation(java.lang.String id)
           
 java.util.List<Nation> getNations()
           
 NationType getNationType(java.lang.String id)
           
 java.util.List<NationType> getNationTypes()
           
 java.util.List<GoodsType> getNewWorldGoodsTypeList()
           
 AbstractOption getOption(java.lang.String Id)
          Returns the AbstractOption with the given ID.
 OptionGroup getOptionGroup(java.lang.String Id)
          Returns the OptionGroup with the given ID.
 GoodsType getPrimaryFoodType()
          The general "Food" type is handled as a special case in many places.
 RangeOption getRangeOption(java.lang.String Id)
          Returns the RangeOption with the given ID.
 java.util.List<GoodsType> getRawBuildingGoodsTypeList()
           
 java.util.List<Nation> getREFNations()
           
 java.util.List<EuropeanNationType> getREFNationTypes()
           
 ResourceType getResourceType(java.lang.String id)
           
 java.util.List<ResourceType> getResourceTypeList()
           
 StringOption getStringOption(java.lang.String Id)
          Returns the StringOption with the given ID.
 TileImprovementType getTileImprovementType(java.lang.String id)
           
 java.util.List<TileImprovementType> getTileImprovementTypeList()
           
 TileType getTileType(java.lang.String id)
           
 java.util.List<TileType> getTileTypeList()
           
 FreeColGameObjectType getType(java.lang.String Id)
           
<T extends FreeColGameObjectType>
T
getType(java.lang.String Id, java.lang.Class<T> type)
          Returns the FreeColGameObjectType with the given ID.
<T extends FreeColGameObjectType>
T
getType(javax.xml.stream.XMLStreamReader in, java.lang.String attributeName, java.lang.Class<T> returnClass, T defaultValue)
          Returns the FreeColGameObjectType identified by the attributeName, or the default value if there is no such attribute.
 java.util.List<FreeColGameObjectType> getTypesProviding(java.lang.String id, boolean value)
          Return a list of FreeColGameObjectTypes that provide the required ability.
<T extends FreeColGameObjectType>
java.util.List<T>
getTypesWithAbility(java.lang.Class<T> resultType, java.lang.String... abilities)
          Return all types which have any of the given abilities.
<T extends FreeColGameObjectType>
java.util.List<T>
getTypesWithoutAbility(java.lang.Class<T> resultType, java.lang.String... abilities)
          Return all types which have none of the given abilities.
 UnitType getUnitType(java.lang.String id)
           
 java.util.List<UnitType> getUnitTypeList()
           
 java.util.List<UnitType> getUnitTypesPurchasedInEurope()
          Returns the unit types that can be purchased in Europe.
 java.util.List<UnitType> getUnitTypesTrainedInEurope()
          Returns the unit types that can be trained in Europe.
 java.util.List<UnitType> getUnitTypesWithAbility(java.lang.String... abilities)
          Return the unit types which have any of the given abilities
 java.util.List<UnitType> getUnitTypesWithoutAbility(java.lang.String... abilities)
          Return the unit types which have none of the given abilities
static java.lang.String getXMLElementTagName()
           
 boolean hasOption(java.lang.String Id)
          Is option with this ID present? This is helpful when options are optionally(!) present, for example model.option.priceIncrease.artillery exists but model.option.priceIncrease.frigate does not.
private  void load(java.io.InputStream in)
           
 void loadFragment(java.io.InputStream in)
           
private  java.lang.String mangle(java.lang.String id)
           
 int numberOfBuildingTypes()
          Describe numberOfBuildingTypes method here.
 int numberOfFarmedGoodsTypes()
           
 int numberOfFoundingFathers()
           
 int numberOfGoodsTypes()
          Describe numberOfGoodsTypes method here.
 int numberOfNationTypes()
           
 int numberOfResourceTypes()
           
 int numberOfStoredGoodsTypes()
           
 int numberOfTileTypes()
           
 int numberOfUnitTypes()
           
 void readFromXMLImpl(javax.xml.stream.XMLStreamReader xsr)
           
protected  void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
          Makes an XML-representation of this object.
private
<T extends FreeColObject>
void
writeSection(javax.xml.stream.XMLStreamWriter out, java.lang.String section, java.util.Collection<T> items)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MOVEMENT_PENALTY_SOURCE

public static final FreeColGameObjectType MOVEMENT_PENALTY_SOURCE

ARTILLERY_PENALTY_SOURCE

public static final FreeColGameObjectType ARTILLERY_PENALTY_SOURCE

ATTACK_BONUS_SOURCE

public static final FreeColGameObjectType ATTACK_BONUS_SOURCE

FORTIFICATION_BONUS_SOURCE

public static final FreeColGameObjectType FORTIFICATION_BONUS_SOURCE

INDIAN_RAID_BONUS_SOURCE

public static final FreeColGameObjectType INDIAN_RAID_BONUS_SOURCE

AMPHIBIOUS_ATTACK_PENALTY_SOURCE

public static final FreeColGameObjectType AMPHIBIOUS_ATTACK_PENALTY_SOURCE

BASE_OFFENCE_SOURCE

public static final FreeColGameObjectType BASE_OFFENCE_SOURCE

BASE_DEFENCE_SOURCE

public static final FreeColGameObjectType BASE_DEFENCE_SOURCE

CARGO_PENALTY_SOURCE

public static final FreeColGameObjectType CARGO_PENALTY_SOURCE

AMBUSH_BONUS_SOURCE

public static final FreeColGameObjectType AMBUSH_BONUS_SOURCE

COLONY_GOODS_PARTY_SOURCE

public static final FreeColGameObjectType COLONY_GOODS_PARTY_SOURCE

SHIP_TRADE_PENALTY_SOURCE

public static final FreeColGameObjectType SHIP_TRADE_PENALTY_SOURCE

logger

private static final java.util.logging.Logger logger

allTypes

private final java.util.Map<java.lang.String,FreeColGameObjectType> allTypes

allOptions

private final java.util.Map<java.lang.String,AbstractOption> allOptions

allOptionGroups

private final java.util.Map<java.lang.String,OptionGroup> allOptionGroups

experts

private final java.util.Map<GoodsType,UnitType> experts

allAbilities

private final java.util.Map<java.lang.String,java.util.List<Ability>> allAbilities

allModifiers

private final java.util.Map<java.lang.String,java.util.List<Modifier>> allModifiers

buildingTypeList

private final java.util.List<BuildingType> buildingTypeList

goodsTypeList

private final java.util.List<GoodsType> goodsTypeList

farmedGoodsTypeList

private final java.util.List<GoodsType> farmedGoodsTypeList

foodGoodsTypeList

private final java.util.List<GoodsType> foodGoodsTypeList

newWorldGoodsTypeList

private final java.util.List<GoodsType> newWorldGoodsTypeList

libertyGoodsTypeList

private final java.util.List<GoodsType> libertyGoodsTypeList

immigrationGoodsTypeList

private final java.util.List<GoodsType> immigrationGoodsTypeList

rawBuildingGoodsTypeList

private final java.util.List<GoodsType> rawBuildingGoodsTypeList

resourceTypeList

private final java.util.List<ResourceType> resourceTypeList

tileTypeList

private final java.util.List<TileType> tileTypeList

tileImprovementTypeList

private final java.util.List<TileImprovementType> tileImprovementTypeList

unitTypeList

private final java.util.List<UnitType> unitTypeList

unitTypesTrainedInEurope

private final java.util.List<UnitType> unitTypesTrainedInEurope

unitTypesPurchasedInEurope

private final java.util.List<UnitType> unitTypesPurchasedInEurope

foundingFathers

private final java.util.List<FoundingFather> foundingFathers

nations

private final java.util.List<Nation> nations

europeanNations

private final java.util.List<Nation> europeanNations

REFNations

private final java.util.List<Nation> REFNations

indianNations

private final java.util.List<Nation> indianNations

nationTypes

private final java.util.List<NationType> nationTypes

europeanNationTypes

private final java.util.List<EuropeanNationType> europeanNationTypes

REFNationTypes

private final java.util.List<EuropeanNationType> REFNationTypes

indianNationTypes

private final java.util.List<IndianNationType> indianNationTypes

equipmentTypes

private final java.util.List<EquipmentType> equipmentTypes

events

private final java.util.List<Event> events

specialModifiers

private final java.util.List<Modifier> specialModifiers

readerMap

private final java.util.Map<java.lang.String,Specification.ChildReader> readerMap

storableTypes

private int storableTypes

initialized

private boolean initialized

id

private java.lang.String id

difficultyLevel

private java.lang.String difficultyLevel
Constructor Detail

Specification

public Specification(java.io.InputStream in)
Creates a new Specification object by loading it from the given InputStream.

Parameters:
in - an InputStream value

Specification

public Specification()
Method Detail

load

private void load(java.io.InputStream in)

loadFragment

public void loadFragment(java.io.InputStream in)

clean

public void clean()

getId

public java.lang.String getId()
Describe getId method here.

Returns:
a String value

addAbility

public void addAbility(Ability ability)
Registers an Ability as defined.

Parameters:
ability - an Ability value

addAbility

public void addAbility(java.lang.String id)
Registers an Ability's id as defined. This is useful for abilities that are required rather than provided by FreeColGameObjectTypes.

Parameters:
id - a String value

getAbilities

public java.util.List<Ability> getAbilities(java.lang.String id)
Return a list of all Abilities with the given id.

Parameters:
id - the ability id

getTypesProviding

public java.util.List<FreeColGameObjectType> getTypesProviding(java.lang.String id,
                                                               boolean value)
Return a list of FreeColGameObjectTypes that provide the required ability.

Parameters:
id - the ability id
value - the ability value
Returns:
a list of FreeColGameObjectTypes that provide the required ability.

addModifier

public void addModifier(Modifier modifier)
Add a modifier.

Parameters:
modifier - a Modifier value

getModifiers

public java.util.List<Modifier> getModifiers(java.lang.String id)
Return a list of all Modifiers with the given id.

Parameters:
id - the modifier id

getType

public <T extends FreeColGameObjectType> T getType(java.lang.String Id,
                                                   java.lang.Class<T> type)
                                        throws java.lang.IllegalArgumentException
Returns the FreeColGameObjectType with the given ID. Throws an IllegalArgumentException if the ID is null. Throws and IllegalArgumentException if no such Type can be retrieved and initialization is complete.

Parameters:
Id - a String value
type - a Class value
Returns:
a FreeColGameObjectType value
Throws:
java.lang.IllegalArgumentException - if an error occurs

mangle

private java.lang.String mangle(java.lang.String id)

getType

public FreeColGameObjectType getType(java.lang.String Id)
                              throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getTypesWithAbility

public <T extends FreeColGameObjectType> java.util.List<T> getTypesWithAbility(java.lang.Class<T> resultType,
                                                                               java.lang.String... abilities)
Return all types which have any of the given abilities.

Parameters:
abilities - The abilities for the search
Returns:
a List of UnitType

getTypesWithoutAbility

public <T extends FreeColGameObjectType> java.util.List<T> getTypesWithoutAbility(java.lang.Class<T> resultType,
                                                                                  java.lang.String... abilities)
Return all types which have none of the given abilities.

Parameters:
abilities - The abilities for the search
Returns:
a List of UnitType

hasOption

public boolean hasOption(java.lang.String Id)
Is option with this ID present? This is helpful when options are optionally(!) present, for example model.option.priceIncrease.artillery exists but model.option.priceIncrease.frigate does not.

Parameters:
Id - a String value
Returns:
True/false on presence of option Id

getOption

public AbstractOption getOption(java.lang.String Id)
                         throws java.lang.IllegalArgumentException
Returns the AbstractOption with the given ID. Throws an IllegalArgumentException if the ID is null or unknown.

Parameters:
Id - a String value
Returns:
an AbstractOption value
Throws:
java.lang.IllegalArgumentException

getOptionGroup

public OptionGroup getOptionGroup(java.lang.String Id)
                           throws java.lang.IllegalArgumentException
Returns the OptionGroup with the given ID. Throws an IllegalArgumentException if the ID is null or unknown.

Parameters:
Id - a String value
Returns:
an OptionGroup value
Throws:
java.lang.IllegalArgumentException

addOptionGroup

private void addOptionGroup(OptionGroup optionGroup,
                            boolean recursive)
Adds an OptionGroup to the specification

Parameters:
optionGroup - OptionGroup to add
recursive - a boolean value

addAbstractOption

public void addAbstractOption(AbstractOption abstractOption)
Adds an AbstractOption to the specification

Parameters:
abstractOption - AbstractOption to add

getIntegerOption

public IntegerOption getIntegerOption(java.lang.String Id)
Returns the IntegerOption with the given ID. Throws an IllegalArgumentException if the ID is null, or if no such Type can be retrieved.

Parameters:
Id - a String value
Returns:
an IntegerOption value

getRangeOption

public RangeOption getRangeOption(java.lang.String Id)
Returns the RangeOption with the given ID. Throws an IllegalArgumentException if the ID is null, or if no such Type can be retrieved.

Parameters:
Id - a String value
Returns:
an RangeOption value

getBooleanOption

public BooleanOption getBooleanOption(java.lang.String Id)
Returns the BooleanOption with the given ID. Throws an IllegalArgumentException if the ID is null, or if no such Type can be retrieved.

Parameters:
Id - a String value
Returns:
an BooleanOption value

getStringOption

public StringOption getStringOption(java.lang.String Id)
Returns the StringOption with the given ID. Throws an IllegalArgumentException if the ID is null, or if no such Type can be retrieved.

Parameters:
Id - a String value
Returns:
an StringOption value

getInteger

public int getInteger(java.lang.String id)
Gets the integer value of an option.

Parameters:
id - The id of the option.
Returns:
The value.
Throws:
java.lang.IllegalArgumentException - If there is no integer value associated with the specified option.
java.lang.NullPointerException - if the given Option does not exist.

getBoolean

public boolean getBoolean(java.lang.String id)
Gets the boolean value of an option.

Parameters:
id - The id of the option.
Returns:
The value.
Throws:
java.lang.IllegalArgumentException - If there is no boolean value associated with the specified option.
java.lang.NullPointerException - if the given Option does not exist.

getBuildingTypeList

public java.util.List<BuildingType> getBuildingTypeList()

numberOfBuildingTypes

public int numberOfBuildingTypes()
Describe numberOfBuildingTypes method here.

Returns:
an int value

getBuildingType

public BuildingType getBuildingType(int buildingTypeIndex)
Describe getBuildingType method here.

Parameters:
buildingTypeIndex - an int value
Returns:
a BuildingType value

getBuildingType

public BuildingType getBuildingType(java.lang.String id)

getGoodsTypeList

public java.util.List<GoodsType> getGoodsTypeList()

numberOfGoodsTypes

public int numberOfGoodsTypes()
Describe numberOfGoodsTypes method here.

Returns:
an int value

numberOfStoredGoodsTypes

public int numberOfStoredGoodsTypes()

getFarmedGoodsTypeList

public java.util.List<GoodsType> getFarmedGoodsTypeList()

getNewWorldGoodsTypeList

public java.util.List<GoodsType> getNewWorldGoodsTypeList()

getLibertyGoodsTypeList

public java.util.List<GoodsType> getLibertyGoodsTypeList()

getImmigrationGoodsTypeList

public java.util.List<GoodsType> getImmigrationGoodsTypeList()

getFoodGoodsTypeList

public java.util.List<GoodsType> getFoodGoodsTypeList()

numberOfFarmedGoodsTypes

public int numberOfFarmedGoodsTypes()

getRawBuildingGoodsTypeList

public final java.util.List<GoodsType> getRawBuildingGoodsTypeList()

getGoodsType

public GoodsType getGoodsType(java.lang.String id)
Describe getGoodsType method here.

Parameters:
id - a String value
Returns:
a GoodsType value

getPrimaryFoodType

public GoodsType getPrimaryFoodType()
The general "Food" type is handled as a special case in many places. Introduce this routine to collect them into one place, in the hope we can one day deprecate this routine and clean up the special cases.

Returns:
The main food type ("model.goods.food").

getResourceTypeList

public java.util.List<ResourceType> getResourceTypeList()

numberOfResourceTypes

public int numberOfResourceTypes()

getResourceType

public ResourceType getResourceType(java.lang.String id)

getTileTypeList

public java.util.List<TileType> getTileTypeList()

numberOfTileTypes

public int numberOfTileTypes()

getTileType

public TileType getTileType(java.lang.String id)

getTileImprovementTypeList

public java.util.List<TileImprovementType> getTileImprovementTypeList()

getTileImprovementType

public TileImprovementType getTileImprovementType(java.lang.String id)

getUnitTypeList

public java.util.List<UnitType> getUnitTypeList()

numberOfUnitTypes

public int numberOfUnitTypes()

getUnitType

public UnitType getUnitType(java.lang.String id)

getDefaultUnitType

public UnitType getDefaultUnitType()
Gets the most vanilla unit type. Provides a type to use to make a neutral comparison of the productivity of work locations.

Returns:
The free colonist unit type.

getExpertForProducing

public UnitType getExpertForProducing(GoodsType goodsType)

getUnitTypesWithAbility

public java.util.List<UnitType> getUnitTypesWithAbility(java.lang.String... abilities)
Return the unit types which have any of the given abilities

Parameters:
abilities - The abilities for the search
Returns:
a List of UnitType

getUnitTypesWithoutAbility

public java.util.List<UnitType> getUnitTypesWithoutAbility(java.lang.String... abilities)
Return the unit types which have none of the given abilities

Parameters:
abilities - The abilities for the search
Returns:
a List of UnitType

getUnitTypesTrainedInEurope

public java.util.List<UnitType> getUnitTypesTrainedInEurope()
Returns the unit types that can be trained in Europe.


getUnitTypesPurchasedInEurope

public java.util.List<UnitType> getUnitTypesPurchasedInEurope()
Returns the unit types that can be purchased in Europe.


getFoundingFathers

public java.util.List<FoundingFather> getFoundingFathers()

numberOfFoundingFathers

public int numberOfFoundingFathers()

getFoundingFather

public FoundingFather getFoundingFather(java.lang.String id)

getNationTypes

public java.util.List<NationType> getNationTypes()

getEuropeanNationTypes

public java.util.List<EuropeanNationType> getEuropeanNationTypes()

getREFNationTypes

public java.util.List<EuropeanNationType> getREFNationTypes()

getIndianNationTypes

public java.util.List<IndianNationType> getIndianNationTypes()

numberOfNationTypes

public int numberOfNationTypes()

getNationType

public NationType getNationType(java.lang.String id)

getNations

public java.util.List<Nation> getNations()

getNation

public Nation getNation(java.lang.String id)

getEuropeanNations

public java.util.List<Nation> getEuropeanNations()

getIndianNations

public java.util.List<Nation> getIndianNations()

getREFNations

public java.util.List<Nation> getREFNations()

getEquipmentTypeList

public java.util.List<EquipmentType> getEquipmentTypeList()

getEquipmentType

public EquipmentType getEquipmentType(java.lang.String id)

getDifficultyLevels

public java.util.List<OptionGroup> getDifficultyLevels()

getDifficultyLevel

public OptionGroup getDifficultyLevel()
Return the current difficulty level.

Returns:
the current difficulty level

getDifficultyLevel

public OptionGroup getDifficultyLevel(java.lang.String id)
Describe getDifficultyLevel method here.

Parameters:
id - a String value
Returns:
a DifficultyLevel value

getDifficultyLevel

public OptionGroup getDifficultyLevel(int level)
Describe getDifficultyLevel method here.

Parameters:
level - an int value
Returns:
a DifficultyLevel value

applyDifficultyLevel

public void applyDifficultyLevel(int difficultyLevel)
Applies the difficulty level identified by the given integer to the current specification.

Parameters:
difficultyLevel - index of difficulty level to apply

applyDifficultyLevel

public void applyDifficultyLevel(java.lang.String difficultyLevel)
Applies the difficulty level identified by the given String to the current specification.

Parameters:
difficultyLevel - id of difficulty level to apply

applyDifficultyLevel

public void applyDifficultyLevel(OptionGroup level)
Applies the given difficulty level to the current specification.

Parameters:
level - difficulty level to apply

getEvents

public java.util.List<Event> getEvents()

getEvent

public Event getEvent(java.lang.String id)

getType

public <T extends FreeColGameObjectType> T getType(javax.xml.stream.XMLStreamReader in,
                                                   java.lang.String attributeName,
                                                   java.lang.Class<T> returnClass,
                                                   T defaultValue)
Returns the FreeColGameObjectType identified by the attributeName, or the default value if there is no such attribute.

Parameters:
in - the XMLStreamReader
attributeName - the name of the attribute identifying the FreeColGameObjectType
returnClass - the class of the return value
defaultValue - the value to return if there is no attribute named attributeName
Returns:
a FreeColGameObjectType value

toXMLImpl

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

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

writeSection

private <T extends FreeColObject> void writeSection(javax.xml.stream.XMLStreamWriter out,
                                                    java.lang.String section,
                                                    java.util.Collection<T> items)
                   throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

readFromXMLImpl

public void readFromXMLImpl(javax.xml.stream.XMLStreamReader xsr)
                     throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

getXMLElementTagName

public static java.lang.String getXMLElementTagName()