net.sf.freecol.common.model
Class UnitTypeChange

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

public class UnitTypeChange
extends FreeColObject


Nested Class Summary
static class UnitTypeChange.ChangeType
           
 
Field Summary
protected  java.util.Map<UnitTypeChange.ChangeType,java.lang.Integer> changeTypes
           
private  UnitType newUnitType
          Describe newUnitType here.
private  java.util.List<Scope> scopes
          A list of Scopes limiting the applicability of this Feature.
static java.util.Map<UnitTypeChange.ChangeType,java.lang.String> tags
           
protected  int turnsToLearn
           
 
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
UnitTypeChange()
           
UnitTypeChange(javax.xml.stream.XMLStreamReader in, Specification specification)
          Creates a new UnitTypeChange instance.
 
Method Summary
 boolean appliesTo(Player player)
          Describe appliesTo method here.
 boolean asResultOf(UnitTypeChange.ChangeType type)
          Describe asResultOf method here.
 boolean canBeTaught()
           
 java.util.Map<UnitTypeChange.ChangeType,java.lang.Integer> getChangeTypes()
           
 UnitType getNewUnitType()
          Get the NewUnitType value.
 int getProbability(UnitTypeChange.ChangeType type)
          Returns the probability of a change taking place (defaults to zero).
 java.util.List<Scope> getScopes()
           
 int getTurnsToLearn()
          Get the TurnsToLearn value.
static java.lang.String getXMLElementTagName()
          Returns the tag name of the root element representing this object.
protected  void readAttributes(javax.xml.stream.XMLStreamReader in, Specification specification)
          Initialize this object from an XML-representation of this object.
protected  void readChildren(javax.xml.stream.XMLStreamReader in, Specification specification)
          Reads the children of this object from an XML stream.
 void setNewUnitType(UnitType newNewUnitType)
          Set the NewUnitType value.
 void setTurnsToLearn(int newTurnsToLearn)
          Set the TurnsToLearn value.
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, dumpObject, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getId, getPropertyChangeListeners, getPropertyChangeListeners, getSpecification, hasAbility, hasAttribute, hasListeners, readAttributes, readChild, 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, writeAttributes, writeChildren
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

newUnitType

private UnitType newUnitType
Describe newUnitType here.


tags

public static final java.util.Map<UnitTypeChange.ChangeType,java.lang.String> tags

turnsToLearn

protected int turnsToLearn

changeTypes

protected java.util.Map<UnitTypeChange.ChangeType,java.lang.Integer> changeTypes

scopes

private java.util.List<Scope> scopes
A list of Scopes limiting the applicability of this Feature.

Constructor Detail

UnitTypeChange

public UnitTypeChange()

UnitTypeChange

public UnitTypeChange(javax.xml.stream.XMLStreamReader in,
                      Specification specification)
               throws javax.xml.stream.XMLStreamException
Creates a new UnitTypeChange instance.

Parameters:
in - a XMLStreamReader value
specification - a Specification value
Throws:
javax.xml.stream.XMLStreamException - if an error occurs
Method Detail

getProbability

public final int getProbability(UnitTypeChange.ChangeType type)
Returns the probability of a change taking place (defaults to zero). At the moment, this probability only applies to the ChangeTypes EXPERIENCE and PROMOTION.

Parameters:
type - a ChangeType value
Returns:
an int value

getScopes

public java.util.List<Scope> getScopes()

getChangeTypes

public java.util.Map<UnitTypeChange.ChangeType,java.lang.Integer> getChangeTypes()

asResultOf

public boolean asResultOf(UnitTypeChange.ChangeType type)
Describe asResultOf method here.

Parameters:
type - a ChangeType value
Returns:
a boolean value

appliesTo

public boolean appliesTo(Player player)
Describe appliesTo method here.

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

getTurnsToLearn

public final int getTurnsToLearn()
Get the TurnsToLearn value.

Returns:
an int value

setTurnsToLearn

public final void setTurnsToLearn(int newTurnsToLearn)
Set the TurnsToLearn value.

Parameters:
newTurnsToLearn - The new TurnsToLearn value.

canBeTaught

public boolean canBeTaught()

getNewUnitType

public final UnitType getNewUnitType()
Get the NewUnitType value.

Returns:
an UnitType value

setNewUnitType

public final void setNewUnitType(UnitType newNewUnitType)
Set the NewUnitType value.

Parameters:
newNewUnitType - The new NewUnitType value.

toXMLImpl

protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
                  throws javax.xml.stream.XMLStreamException
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.

readAttributes

protected void readAttributes(javax.xml.stream.XMLStreamReader in,
                              Specification specification)
                       throws javax.xml.stream.XMLStreamException
Initialize this object from an XML-representation of this object.

Overrides:
readAttributes in class FreeColObject
Parameters:
in - The XML input stream.
specification - A Specification to use.
Throws:
javax.xml.stream.XMLStreamException - if a problem was encountered during parsing.

readChildren

protected void readChildren(javax.xml.stream.XMLStreamReader in,
                            Specification specification)
                     throws javax.xml.stream.XMLStreamException
Reads the children of this object from an XML stream.

Overrides:
readChildren in class FreeColObject
Parameters:
in - The XML input stream.
specification - A Specification to use.
Throws:
javax.xml.stream.XMLStreamException - if a problem was encountered during parsing.

getXMLElementTagName

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

Returns:
"upgrade".