Class AttributeModifier<T extends Number>
java.lang.Object
de.gurkenlabs.litiengine.attributes.AttributeModifier<T>
- Type Parameters:
T- the generic type
- All Implemented Interfaces:
Comparable<AttributeModifier<T>>
public class AttributeModifier<T extends Number>
extends Object
implements Comparable<AttributeModifier<T>>
An attribute modifier allows to modify attributes by the specified Modification and modify value.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAttributeModifier(Modification mod, double modifyValue) Initializes a new instance of theAttributeModifierclass. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(AttributeModifier<T> otherModifier) Compares this attribute modifier to another based on the apply order of their modifications.booleanChecks if this attribute modifier is equal to another object.Gets the modification type applied by this modifier.doubleGets the value that is used to modify an attribute.inthashCode()Generates a hash code for this attribute modifier.booleanisActive()Checks if this attribute modifier is active.Modifies the provided value based on the modification type and modify value of this attribute modifier.voidsetActive(boolean active) Sets the active status of this attribute modifier.voidsetModifyValue(double value) Sets the modify value for this attribute modifier.
-
Constructor Details
-
AttributeModifier
Initializes a new instance of theAttributeModifierclass.- Parameters:
mod- The modification type.modifyValue- The modification value to be applied by this instance.
-
-
Method Details
-
compareTo
Compares this attribute modifier to another based on the apply order of their modifications.- Specified by:
compareToin interfaceComparable<T extends Number>- Parameters:
otherModifier- The other attribute modifier to compare.- Returns:
- An integer representing the comparison result.
-
equals
Checks if this attribute modifier is equal to another object. -
hashCode
public int hashCode()Generates a hash code for this attribute modifier. -
getModification
Gets the modification type applied by this modifier.- Returns:
- The modification type applied by this modifier.
-
getModifyValue
public double getModifyValue()Gets the value that is used to modify an attribute.- Returns:
- The value that is used to modify an attribute.
-
isActive
public boolean isActive()Checks if this attribute modifier is active.- Returns:
- True if active, false otherwise.
-
modify
Modifies the provided value based on the modification type and modify value of this attribute modifier.- Parameters:
modvalue- The original value to be modified.- Returns:
- The modified value.
-
setModifyValue
public void setModifyValue(double value) Sets the modify value for this attribute modifier.- Parameters:
value- The new modify value.
-
setActive
public void setActive(boolean active) Sets the active status of this attribute modifier.- Parameters:
active- True to activate, false to deactivate.
-