net.sf.freecol.common.model
Class FeatureContainer

java.lang.Object
  extended by net.sf.freecol.common.model.FeatureContainer

public class FeatureContainer
extends java.lang.Object


Constructor Summary
FeatureContainer()
           
 
Method Summary
 void add(FeatureContainer featureContainer)
          Describe add method here.
 boolean addAbility(Ability ability)
          Add the given Ability to the set of Abilities present.
 boolean addModifier(Modifier modifier)
          Add the given Modifier to the set of Modifiers present.
 float applyModifier(float number, java.lang.String id)
          Applies a Set of Modifiers with the given ID to the given float value.
 float applyModifier(float number, java.lang.String id, FreeColGameObjectType objectType)
          Applies a Set of Modifiers with the given ID which match the given FreeColGameObjectType to the given float value.
 float applyModifier(float number, java.lang.String id, FreeColGameObjectType objectType, Turn turn)
          Applies a Set of Modifiers with the given ID which match the given FreeColGameObjectType and Turn to the given float value.
static float applyModifierSet(float number, Turn turn, java.util.Set<Modifier> modifierSet)
          Applies a given Set of Modifiers to the given float value.
 boolean containsAbilityKey(java.lang.String key)
           
 boolean containsModifierKey(java.lang.String key)
           
 java.util.Set<Ability> getAbilities()
           
 java.util.Set<Ability> getAbilitySet(java.lang.String id)
          Returns a Set of Abilities with the given ID.
 java.util.Set<Ability> getAbilitySet(java.lang.String id, FreeColGameObjectType objectType)
          Returns a Set of Abilities with the given ID which apply to the given FreeColGameObjectType.
 java.util.Set<Ability> getAbilitySet(java.lang.String id, FreeColGameObjectType objectType, Turn turn)
          Returns a Set of Abilities with the given ID which apply to the given FreeColGameObjectType and Turn.
 java.util.Set<Modifier> getModifiers()
           
 java.util.Set<Modifier> getModifierSet(java.lang.String id)
          Returns a Set of Abilities with the given ID.
 java.util.Set<Modifier> getModifierSet(java.lang.String id, FreeColGameObjectType objectType)
          Returns a Set of Abilities with the given ID which apply to the given FreeColGameObjectType.
 java.util.Set<Modifier> getModifierSet(java.lang.String id, FreeColGameObjectType objectType, Turn turn)
          Returns a Set of Abilities with the given ID which apply to the given FreeColGameObjectType and Turn.
static boolean hasAbility(java.util.Set<Ability> abilitySet)
          Returns true if the given Set of Abilities is not empty and does not contain any Abilities with the value false.
 boolean hasAbility(java.lang.String id)
          Returns true if this Player has the ability with the given ID.
 boolean hasAbility(java.lang.String id, FreeColGameObjectType objectType)
          Returns true if this Player has the ability with the given ID.
 boolean hasAbility(java.lang.String id, FreeColGameObjectType objectType, Turn turn)
          Returns true if this Player has the ability with the given ID.
 void remove(FeatureContainer featureContainer)
          Describe remove method here.
 Ability removeAbility(Ability oldAbility)
          Removes and returns a Ability from this ability set.
 Modifier removeModifier(Modifier oldModifier)
          Removes and returns a Modifier from this modifier set.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FeatureContainer

public FeatureContainer()
Method Detail

getAbilities

public java.util.Set<Ability> getAbilities()

getModifiers

public java.util.Set<Modifier> getModifiers()

getAbilitySet

public java.util.Set<Ability> getAbilitySet(java.lang.String id)
Returns a Set of Abilities with the given ID.

Parameters:
id - a String value
Returns:
a Set value

getAbilitySet

public java.util.Set<Ability> getAbilitySet(java.lang.String id,
                                            FreeColGameObjectType objectType)
Returns a Set of Abilities with the given ID which apply to the given FreeColGameObjectType.

Parameters:
id - a String value
objectType - a FreeColGameObjectType value
Returns:
a Set value

getAbilitySet

public java.util.Set<Ability> getAbilitySet(java.lang.String id,
                                            FreeColGameObjectType objectType,
                                            Turn turn)
Returns a Set of Abilities with the given ID which apply to the given FreeColGameObjectType and Turn.

Parameters:
id - a String value
objectType - a FreeColGameObjectType value
turn - a Turn value
Returns:
a Set value

hasAbility

public boolean hasAbility(java.lang.String id)
Returns true if this Player has the ability with the given ID.

Parameters:
id - a String value
Returns:
a boolean value

hasAbility

public boolean hasAbility(java.lang.String id,
                          FreeColGameObjectType objectType)
Returns true if this Player has the ability with the given ID.

Parameters:
id - a String value
objectType - a FreeColGameObjectType value
Returns:
a boolean value

hasAbility

public boolean hasAbility(java.lang.String id,
                          FreeColGameObjectType objectType,
                          Turn turn)
Returns true if this Player has the ability with the given ID.

Parameters:
id - a String value
objectType - a FreeColGameObjectType value
turn - a Turn value
Returns:
a boolean value

hasAbility

public static boolean hasAbility(java.util.Set<Ability> abilitySet)
Returns true if the given Set of Abilities is not empty and does not contain any Abilities with the value false.

Returns:
a boolean value

getModifierSet

public java.util.Set<Modifier> getModifierSet(java.lang.String id)
Returns a Set of Abilities with the given ID.

Parameters:
id - a String value
Returns:
a Set value

getModifierSet

public java.util.Set<Modifier> getModifierSet(java.lang.String id,
                                              FreeColGameObjectType objectType)
Returns a Set of Abilities with the given ID which apply to the given FreeColGameObjectType.

Parameters:
id - a String value
objectType - a FreeColGameObjectType value
Returns:
a Set value

getModifierSet

public java.util.Set<Modifier> getModifierSet(java.lang.String id,
                                              FreeColGameObjectType objectType,
                                              Turn turn)
Returns a Set of Abilities with the given ID which apply to the given FreeColGameObjectType and Turn.

Parameters:
id - a String value
objectType - a FreeColGameObjectType value
turn - a Turn value
Returns:
a Set value

applyModifier

public float applyModifier(float number,
                           java.lang.String id)
Applies a Set of Modifiers with the given ID to the given float value.

Parameters:
number - a float value
id - a String value

applyModifier

public float applyModifier(float number,
                           java.lang.String id,
                           FreeColGameObjectType objectType)
Applies a Set of Modifiers with the given ID which match the given FreeColGameObjectType to the given float value.

Parameters:
number - a float value
id - a String value
objectType - a FreeColGameObjectType value

applyModifier

public float applyModifier(float number,
                           java.lang.String id,
                           FreeColGameObjectType objectType,
                           Turn turn)
Applies a Set of Modifiers with the given ID which match the given FreeColGameObjectType and Turn to the given float value.

Parameters:
number - a float value
id - a String value
objectType - a FreeColGameObjectType value
turn - a Turn value

applyModifierSet

public static float applyModifierSet(float number,
                                     Turn turn,
                                     java.util.Set<Modifier> modifierSet)
Applies a given Set of Modifiers to the given float value.

Parameters:
number - a float value
turn - a Turn value
Returns:
a float value

addAbility

public boolean addAbility(Ability ability)
Add the given Ability to the set of Abilities present. If the Ability given can not be combined with a Ability with the same ID already present, the old Ability will be replaced.

Parameters:
ability - a Ability value
Returns:
true if the Ability was added

addModifier

public boolean addModifier(Modifier modifier)
Add the given Modifier to the set of Modifiers present. If the Modifier given can not be combined with a Modifier with the same ID already present, the old Modifier will be replaced.

Parameters:
modifier - a Modifier value
Returns:
true if the Modifier was added

removeAbility

public Ability removeAbility(Ability oldAbility)
Removes and returns a Ability from this ability set.

Parameters:
oldAbility - a Ability value
Returns:
a Ability value

removeModifier

public Modifier removeModifier(Modifier oldModifier)
Removes and returns a Modifier from this modifier set.

Parameters:
oldModifier - a Modifier value
Returns:
a Modifier value

add

public void add(FeatureContainer featureContainer)
Describe add method here.

Parameters:
featureContainer - a FeatureContainer value

remove

public void remove(FeatureContainer featureContainer)
Describe remove method here.

Parameters:
featureContainer - a FeatureContainer value

containsAbilityKey

public boolean containsAbilityKey(java.lang.String key)

containsModifierKey

public boolean containsModifierKey(java.lang.String key)