net.sf.freecol.common.model
Class AbstractUnit

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

public class AbstractUnit
extends FreeColObject

Contains the information necessary to create a new unit.


Field Summary
 
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ID_ATTRIBUTE_TAG
 
Constructor Summary
AbstractUnit()
           
AbstractUnit(java.lang.String id, Unit.Role someRole, int someNumber)
           
AbstractUnit(UnitType unitType, Unit.Role someRole, int someNumber)
           
AbstractUnit(javax.xml.stream.XMLStreamReader in)
          Creates a new AbstractUnit instance.
 
Method Summary
 EquipmentType[] getEquipment()
          Returns the Equipment necessary to create a Unit with the same type and role as this AbstractUnit.
 int getNumber()
          Get the Number value.
 Unit.Role getRole()
          Get the Role value.
 UnitType getUnitType()
          Get the UnitType value.
static java.lang.String getXMLElementTagName()
           
 void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
          Initialize this object from an XML-representation of this object.
 void setNumber(int newNumber)
          Set the Number value.
 void setRole(Unit.Role newRole)
          Set the Role 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.
 
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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractUnit

public AbstractUnit()

AbstractUnit

public AbstractUnit(java.lang.String id,
                    Unit.Role someRole,
                    int someNumber)

AbstractUnit

public AbstractUnit(UnitType unitType,
                    Unit.Role someRole,
                    int someNumber)

AbstractUnit

public AbstractUnit(javax.xml.stream.XMLStreamReader in)
             throws javax.xml.stream.XMLStreamException
Creates a new AbstractUnit instance.

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

getUnitType

public final UnitType getUnitType()
Get the UnitType value.

Returns:
an UnitType value

getRole

public final Unit.Role getRole()
Get the Role value.

Returns:
a Role value

setRole

public final void setRole(Unit.Role newRole)
Set the Role value.

Parameters:
newRole - The new Role value.

getNumber

public final int getNumber()
Get the Number value.

Returns:
an int value

setNumber

public final void setNumber(int newNumber)
Set the Number value.

Parameters:
newNumber - The new Number value.

getEquipment

public EquipmentType[] getEquipment()
Returns the Equipment necessary to create a Unit with the same type and role as this AbstractUnit.

Returns:
an EquipmentType[] value

toString

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

readFromXMLImpl

public final void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
                           throws javax.xml.stream.XMLStreamException
Initialize this object from an XML-representation of this object.

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

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.

getXMLElementTagName

public static java.lang.String getXMLElementTagName()