|
||||||||||
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
|
static java.lang.String |
OFFENCE
|
static java.lang.String |
SETTLEMENT_DEFENCE
|
static float |
UNKNOWN
|
Fields inherited from class net.sf.freecol.common.model.FreeColObject |
---|
ID_ATTRIBUTE_TAG |
Constructor Summary | |
---|---|
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, setFirstTurn, setLastTurn, setScopes, setSource |
Methods inherited from class java.lang.Object |
---|
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
Constructor Detail |
---|
public Modifier(java.lang.String id, float value, Modifier.Type type)
Modifier
instance.
id
- a String
valuevalue
- an float
valuetype
- the Type of the modifierpublic 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
valuepublic 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 occursMethod 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
incrementpublic 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 Feature
public boolean equals(java.lang.Object o)
equals
in class Feature
public static Modifier createTeaPartyModifier(Turn turn)
public void toXMLImpl(javax.xml.stream.XMLStreamWriter out) throws javax.xml.stream.XMLStreamException
out
- The target stream.
javax.xml.stream.XMLStreamException
- if there are any problems writing
to the stream.public static java.lang.String getXMLElementTagName()
String
valuepublic void readAttributes(javax.xml.stream.XMLStreamReader in, Specification specification) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public void writeAttributes(javax.xml.stream.XMLStreamWriter out) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public 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 |