Package net.sf.freecol.common.model
Enum Stance
- java.lang.Object
-
- java.lang.Enum<Stance>
-
- net.sf.freecol.common.model.Stance
-
public enum Stance extends java.lang.Enum<Stance> implements Named
The stance one player has towards another player. Valid transitions: [FROM] \ [TO] U A P C W Reasons ---------------------------------- a = attack UNCONTACTED | - x c x i | c = contact ALLIANCE | x - d x adit | d = act of diplomacy PEACE | x d - x adit | i = incitement/rebellion CEASE_FIRE | x d t - adit | t = change of tension WAR | x d ds dt - | s = surrender ---------------------------------- x = invalid
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ALLIANCE
CEASE_FIRE
PEACE
UNCONTACTED
WAR
-
Constructor Summary
Constructors Modifier Constructor Description private
Stance()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
badStance()
private void
badTransition(Stance newStance)
java.lang.String
getKey()
Get the stem key.java.lang.String
getNameKey()
Gets the name of this named object.java.lang.String
getOtherStanceChangeKey()
Get the message key to use for player messages when stance changes between other players.java.lang.String
getStanceChangeKey()
Get the message key to use for player messages when stance changes.Stance
getStanceFromTension(Tension tension)
Check whether tension has changed enough to merit a stance change.int
getTensionModifier(Stance newStance)
A stance change is about to happen.boolean
isIncitable()
Is this stance one that can be incited to war?static Stance
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static Stance[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Method Detail
-
values
public static Stance[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (Stance c : Stance.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Stance valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
badStance
private void badStance()
-
badTransition
private void badTransition(Stance newStance)
-
getStanceFromTension
public Stance getStanceFromTension(Tension tension)
Check whether tension has changed enough to merit a stance change. Do not simply check for crossing tension thresholds, add in Tension.DELTA to provide a bit of hysteresis to dampen ringing.- Parameters:
tension
- TheTension
to check.- Returns:
- The
Stance
appropriate to the tension level.
-
getTensionModifier
public int getTensionModifier(Stance newStance)
A stance change is about to happen. Get the appropriate tension modifier.- Parameters:
newStance
- The newStance
.- Returns:
- A modifier to the current tension.
-
isIncitable
public boolean isIncitable()
Is this stance one that can be incited to war?- Returns:
- True if this stance is incitable.
-
getKey
public java.lang.String getKey()
Get the stem key.- Returns:
- The stance stem key.
-
getStanceChangeKey
public java.lang.String getStanceChangeKey()
Get the message key to use for player messages when stance changes.- Returns:
- A suitable message key.
-
getOtherStanceChangeKey
public java.lang.String getOtherStanceChangeKey()
Get the message key to use for player messages when stance changes between other players.- Returns:
- A suitable message key.
-
getNameKey
public java.lang.String getNameKey()
Gets the name of this named object. Try to avoid using this directly except in i18n-related routines or to implement itself in more complext objects.- Specified by:
getNameKey
in interfaceNamed
- Returns:
- The name of the
Named
.
-
-