|
|||||||||
| 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.Feature
net.sf.freecol.common.model.Modifier
public final class Modifier
The Modifier class encapsulates a bonus or penalty
that can be applied to any action within the game, most obviously
combat. The Modifier may be applicable only to certain Objects
specified by means of Scope objects.
| Nested Class Summary | |
|---|---|
static class |
Modifier.Type
|
| Field Summary | |
|---|---|
static java.lang.String |
CAPITAL_DEFENCE
|
static java.lang.String |
DEFENCE
|
private float |
increment
The value increments per turn. |
private Modifier.Type |
incrementType
Describe incrementType here. |
static java.lang.String |
OFFENCE
|
static java.lang.String |
SETTLEMENT_DEFENCE
|
private Modifier.Type |
type
The type of this Modifier |
static float |
UNKNOWN
|
private float |
value
|
| Fields inherited from class net.sf.freecol.common.model.FreeColObject |
|---|
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, logger, PARTIAL_ATTRIBUTE |
| Constructor Summary | |
|---|---|
private |
Modifier()
|
|
Modifier(org.w3c.dom.Element element)
Creates a new Modifier instance. |
|
Modifier(Modifier template)
Creates a new Modifier instance. |
|
Modifier(java.lang.String id,
float value,
Modifier.Type type)
Creates a new Modifier instance. |
|
Modifier(java.lang.String id,
FreeColGameObjectType source,
float value,
Modifier.Type type)
Creates a new Modifier instance. |
|
Modifier(javax.xml.stream.XMLStreamReader in,
Specification specification)
Creates a new Modifier instance. |
| Method Summary | |
|---|---|
float |
applyTo(float number)
Applies this Modifier to a number. |
static Modifier |
createTeaPartyModifier(Turn turn)
|
boolean |
equals(java.lang.Object o)
|
float |
getIncrement()
Get the Increment increment. |
Modifier.Type |
getIncrementType()
Get the IncrementType value. |
Modifier.Type |
getType()
Get the Type value. |
float |
getValue()
Get the Value value. |
static java.lang.String |
getXMLElementTagName()
Returns the XML tag name for this element. |
int |
hashCode()
|
boolean |
hasIncrement()
Returns true if this Modifier has an increment. |
void |
readAttributes(javax.xml.stream.XMLStreamReader in,
Specification specification)
|
void |
setIncrement(float newIncrement,
Modifier.Type type,
Turn firstTurn,
Turn lastTurn)
Set the Increment increment. |
void |
setIncrementType(Modifier.Type newIncrementType)
Set the IncrementType value. |
void |
setType(Modifier.Type newType)
Set the Type value. |
void |
setValue(float 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, readChildren, readFromXMLImpl, setFirstTurn, setLastTurn, setScopes, setSource, writeChildren |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String OFFENCE
public static final java.lang.String DEFENCE
public static final java.lang.String CAPITAL_DEFENCE
public static final java.lang.String SETTLEMENT_DEFENCE
public static final float UNKNOWN
private float value
private float increment
private Modifier.Type type
private Modifier.Type incrementType
| Constructor Detail |
|---|
private Modifier()
public Modifier(java.lang.String id,
float value,
Modifier.Type type)
Modifier instance.
id - a String valuevalue - an float valuetype - the Type of the modifier
public Modifier(java.lang.String id,
FreeColGameObjectType source,
float value,
Modifier.Type type)
Modifier instance.
id - a String valuesource - a FreeColGameObjectType valuevalue - an float valuetype - the Type of the modifierpublic Modifier(Modifier template)
Modifier instance.
template - a Modifier valuepublic Modifier(org.w3c.dom.Element element)
Modifier instance.
element - an Element value
public Modifier(javax.xml.stream.XMLStreamReader in,
Specification specification)
throws javax.xml.stream.XMLStreamException
Modifier instance.
in - a XMLStreamReader valuespecification - a Specification value
javax.xml.stream.XMLStreamException - if an error occurs| Method Detail |
|---|
public Modifier.Type getType()
Type value.
Type valuepublic void setType(Modifier.Type newType)
Type value.
newType - The new Type value.public Modifier.Type getIncrementType()
IncrementType value.
Type valuepublic void setIncrementType(Modifier.Type newIncrementType)
IncrementType value.
newIncrementType - The new IncrementType value.public float getValue()
Value value.
float valuepublic void setValue(float newValue)
Value value.
newValue - The new Value value.public float getIncrement()
Increment increment.
float increment
public void setIncrement(float newIncrement,
Modifier.Type type,
Turn firstTurn,
Turn lastTurn)
Increment increment.
newIncrement - The new Increment increment.public boolean hasIncrement()
true if this Modifier has an increment.
boolean valuepublic float applyTo(float number)
number - a float value
float valuepublic int hashCode()
hashCode in class Featurepublic boolean equals(java.lang.Object o)
equals in class Featurepublic static Modifier createTeaPartyModifier(Turn turn)
public 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.public static java.lang.String getXMLElementTagName()
String value
public void readAttributes(javax.xml.stream.XMLStreamReader in,
Specification specification)
throws javax.xml.stream.XMLStreamException
readAttributes in class Featurejavax.xml.stream.XMLStreamException
public void writeAttributes(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
writeAttributes in class Featurejavax.xml.stream.XMLStreamExceptionpublic java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||