|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.freecol.common.model.FreeColObject
net.sf.freecol.common.model.AbstractUnit
public class AbstractUnit
Contains the information necessary to create a new unit.
| Field Summary | |
|---|---|
private int |
number
The number of units. |
private Unit.Role |
role
The role of this AbstractUnit. |
| 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 | |
|---|---|
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(Specification specification)
Returns the Equipment necessary to create a Unit with the same type and role as this AbstractUnit. |
StringTemplate |
getLabel(Specification spec)
Describe getLabel method here. |
int |
getNumber()
Get the Number value. |
Unit.Role |
getRole()
Get the Role value. |
UnitType |
getUnitType(Specification specification)
Get the UnitType 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)
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()
|
protected void |
toXMLImpl(javax.xml.stream.XMLStreamWriter out)
This method writes an XML-representation of this object to the given stream. |
protected void |
writeAttributes(javax.xml.stream.XMLStreamWriter out)
Write the attributes of this object to a stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private Unit.Role role
private int number
| Constructor Detail |
|---|
public AbstractUnit()
public AbstractUnit(java.lang.String id,
Unit.Role someRole,
int someNumber)
public AbstractUnit(UnitType unitType,
Unit.Role someRole,
int someNumber)
public AbstractUnit(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
AbstractUnit instance.
in - a XMLStreamReader value
javax.xml.stream.XMLStreamException - if an error occurs| Method Detail |
|---|
public final UnitType getUnitType(Specification specification)
UnitType value.
UnitType valuepublic final Unit.Role getRole()
Role value.
Role valuepublic final void setRole(Unit.Role newRole)
Role value.
newRole - The new Role value.public final int getNumber()
Number value.
int valuepublic final void setNumber(int newNumber)
Number value.
newNumber - The new Number value.public StringTemplate getLabel(Specification spec)
getLabel method here.
spec - A Specification to query.
- Returns:
- a
StringTemplate value public EquipmentType[] getEquipment(Specification specification)
EquipmentType[] value
protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
toXMLImpl in class FreeColObjectout - The target stream.
javax.xml.stream.XMLStreamException - if there are any problems writing
to the stream.
protected void writeAttributes(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
writeAttributes in class FreeColObjectout - The target stream.
javax.xml.stream.XMLStreamException - if there are any problems writing
to the stream.
protected final void readAttributes(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
readAttributes in class FreeColObjectin - The input stream with the XML.
javax.xml.stream.XMLStreamException - if a problem was encountered
during parsing.public java.lang.String toString()
toString in class java.lang.Objectpublic static java.lang.String getXMLElementTagName()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||