Klasse Formula
java.lang.Object
de.delinkedde.mobarenareborn.util.Formula
A compiled arithmetic expression with named variables, used to drive configurable scaling
(mob health, wave size, boss health and the experience curve).
An expression is parsed once via compile(String) into an evaluation tree and can
then be evaluated repeatedly with different variable bindings. Supported syntax:
- the operators
+ - * /with the usual precedence, parentheses and unary minus; - decimal number literals;
- variables written in angle brackets, for example
<current-wave>; - the functions
min(a,b),max(a,b),pow(a,b),ceil(a),floor(a),round(a),sqrt(a)andabs(a).
Example: min(<monster-limit>, ceil(2 + 0.8 * pow(<current-wave>, 0.8))).
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifizierer und TypKlasseBeschreibungstatic final classThrown when an expression cannot be parsed or references a variable that was not supplied at evaluation time. -
Methodenübersicht
-
Methodendetails
-
compile
Compiles an expression into a reusable formula.- Parameter:
expression- the expression source- Gibt zurück:
- the compiled formula
- Löst aus:
Formula.FormulaException- if the expression is malformed
-
evaluate
Evaluates the formula with the given variable bindings.- Parameter:
variables- the variable values, keyed without the surrounding angle brackets- Gibt zurück:
- the result
- Löst aus:
Formula.FormulaException- if the expression references an undefined variable
-
source
- Gibt zurück:
- the original expression source
-
toString
-