net.sf.freecol.common.model
Class Ability

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

public final class Ability
extends Feature

The Ability class encapsulates a bonus or penalty that can be applied to any action within the game, most obviously combat.


Field Summary
static java.lang.String ADD_TAX_TO_BELLS
           
 
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ID_ATTRIBUTE_TAG
 
Constructor Summary
Ability(org.w3c.dom.Element element)
          Creates a new Ability instance.
Ability(java.lang.String id)
          Creates a new Ability instance.
Ability(java.lang.String id, boolean value)
          Creates a new Ability instance.
Ability(java.lang.String id, FreeColGameObjectType source, boolean value)
          Creates a new Ability instance.
Ability(javax.xml.stream.XMLStreamReader in, Specification specification)
          Creates a new Ability instance.
 
Method Summary
 boolean equals(java.lang.Object o)
           
 boolean getValue()
          Get the Value value.
static java.lang.String getXMLElementTagName()
          Returns the XML tag name for this element.
 int hashCode()
           
 void readAttributes(javax.xml.stream.XMLStreamReader in, Specification specification)
           
 void setValue(boolean newValue)
          Set the Value value.
 java.lang.String toString()
           
 void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
          This method writes an XML-representation of this object to the given stream.
 void writeAttributes(javax.xml.stream.XMLStreamWriter out)
           
 
Methods inherited from class net.sf.freecol.common.model.Feature
appliesTo, appliesTo, getFirstTurn, getLastTurn, getScopes, getSource, hasScope, hasTimeLimit, isOutOfDate, setFirstTurn, setLastTurn, setScopes, setSource
 
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, hasAbility, hasAttribute, hasListeners, readFromXML, readFromXMLElement, removePropertyChangeListener, removePropertyChangeListener, toXML, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, writeAttribute, writeFreeColGameObject
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ADD_TAX_TO_BELLS

public static final java.lang.String ADD_TAX_TO_BELLS
See Also:
Constant Field Values
Constructor Detail

Ability

public Ability(java.lang.String id)
Creates a new Ability instance.

Parameters:
id - a String value

Ability

public Ability(java.lang.String id,
               boolean value)
Creates a new Ability instance.

Parameters:
id - a String value
value - a boolean value

Ability

public Ability(java.lang.String id,
               FreeColGameObjectType source,
               boolean value)
Creates a new Ability instance.

Parameters:
id - a String value
source - a FreeColGameObjectType value
value - a boolean value

Ability

public Ability(org.w3c.dom.Element element)
Creates a new Ability instance.

Parameters:
element - an Element value

Ability

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

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

getValue

public boolean getValue()
Get the Value value.

Returns:
a boolean value

setValue

public void setValue(boolean newValue)
Set the Value value.

Parameters:
newValue - The new Value value.

hashCode

public int hashCode()
Overrides:
hashCode in class Feature

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class Feature

toXMLImpl

public 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.

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

readAttributes

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

writeAttributes

public void writeAttributes(javax.xml.stream.XMLStreamWriter out)
                     throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

getXMLElementTagName

public static java.lang.String getXMLElementTagName()
Returns the XML tag name for this element.

Returns:
a String value

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object