Package com.sucy.skill.data.formula
Class Formula
java.lang.Object
com.sucy.skill.data.formula.Formula
- All Implemented Interfaces:
IValue
Represents a basic math equation read from left to right, ignoring
order of operations. Currently this only supports addition, subtraction,
multiplication, and division.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFormula(String equation, CustomValue... defined) Creates a new formula from a config string -
Method Summary
-
Field Details
-
DEG_TO_RAD
public static final double DEG_TO_RAD- See Also:
-
-
Constructor Details
-
Formula
Creates a new formula from a config string- Parameters:
equation- equation string
-
-
Method Details
-
negate
Negates the output of the formula for future computations- Returns:
- the negated Formula
-
compute
public double compute(double... input) Calculates the formula using the given base value and attribute. If the formula is invalid, this returns the value. -
toString
Returns the equation string for toString
-