net.sf.freecol.common.model
Class FreeColGameObjectType

java.lang.Object
  extended by net.sf.freecol.common.model.FreeColObject
      extended by net.sf.freecol.common.model.FreeColGameObjectType
Direct Known Subclasses:
BuildableType, DifficultyLevel, FoundingFather, GoodsType, ImprovementActionType, Nation, NationType, ResourceType, TileImprovementType, TileType

public class FreeColGameObjectType
extends FreeColObject

The base class for all types defined by the specification. It can be instantiated in order to provide a source for modifiers and abilities that are provided by the code rather than defined in the specification, such as the "artillery in the open" penalty.


Field Summary
protected  FeatureContainer featureContainer
          Describe featureContainer here.
private  int index
           
 
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, logger, PARTIAL_ATTRIBUTE
 
Constructor Summary
FreeColGameObjectType()
           
FreeColGameObjectType(java.lang.String id)
           
 
Method Summary
 void addAbility(Ability ability)
           
 void addModifier(Modifier modifier)
           
 FeatureContainer getFeatureContainer()
          Get the FeatureContainer value.
 int getIndex()
           
 java.util.Set<Modifier> getModifierSet(java.lang.String id)
           
 boolean hasAbility(java.lang.String id)
          Describe hasAbility method here.
 boolean hasAbility(java.lang.String id, FreeColGameObjectType type)
           
protected  void readAttributes(javax.xml.stream.XMLStreamReader in, Specification specification)
           
protected  FreeColObject readChild(javax.xml.stream.XMLStreamReader in, Specification specification)
           
 void readChildren(javax.xml.stream.XMLStreamReader in, Specification specification)
           
 void readFromXML(javax.xml.stream.XMLStreamReader in, Specification specification)
           
protected  void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
          Initialize this object from an XML-representation of this object.
 void setFeatureContainer(FeatureContainer newFeatureContainer)
          Set the FeatureContainer value.
 void setIndex(int index)
           
 java.lang.String toString()
          Use only for debugging purposes! A human-readable and localized name is returned by getName().
protected  void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
          This method writes an XML-representation of this object to the given stream.
 
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

index

private int index

featureContainer

protected FeatureContainer featureContainer
Describe featureContainer here.

Constructor Detail

FreeColGameObjectType

public FreeColGameObjectType()

FreeColGameObjectType

public FreeColGameObjectType(java.lang.String id)
Method Detail

getFeatureContainer

public final FeatureContainer getFeatureContainer()
Get the FeatureContainer value.

Returns:
a FeatureContainer value

setFeatureContainer

public final void setFeatureContainer(FeatureContainer newFeatureContainer)
Set the FeatureContainer value.

Parameters:
newFeatureContainer - The new FeatureContainer value.

setIndex

public final void setIndex(int index)

getIndex

public final int getIndex()

hasAbility

public boolean hasAbility(java.lang.String id)
Description copied from class: FreeColObject
Describe hasAbility method here.

Overrides:
hasAbility in class FreeColObject
Parameters:
id - a String value
Returns:
a boolean value

hasAbility

public boolean hasAbility(java.lang.String id,
                          FreeColGameObjectType type)

addAbility

public void addAbility(Ability ability)

addModifier

public void addModifier(Modifier modifier)

getModifierSet

public java.util.Set<Modifier> getModifierSet(java.lang.String id)

toXMLImpl

protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
                  throws javax.xml.stream.XMLStreamException
Description copied from class: FreeColObject
This method writes an XML-representation of this object to the given stream.

Specified by:
toXMLImpl in class FreeColObject
Parameters:
out - The target stream.
Throws:
javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.

readFromXMLImpl

protected void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
                        throws javax.xml.stream.XMLStreamException
Description copied from class: FreeColObject
Initialize this object from an XML-representation of this object.

Overrides:
readFromXMLImpl in class FreeColObject
Parameters:
in - The input stream with the XML.
Throws:
javax.xml.stream.XMLStreamException - if a problem was encountered during parsing.

readFromXML

public void readFromXML(javax.xml.stream.XMLStreamReader in,
                        Specification specification)
                 throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

readAttributes

protected void readAttributes(javax.xml.stream.XMLStreamReader in,
                              Specification specification)
                       throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

readChildren

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

readChild

protected FreeColObject readChild(javax.xml.stream.XMLStreamReader in,
                                  Specification specification)
                           throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

toString

public java.lang.String toString()
Use only for debugging purposes! A human-readable and localized name is returned by getName().

Overrides:
toString in class java.lang.Object