Package dev.jorel.commandapi.wrappers
Enum Class MathOperation
- All Implemented Interfaces:
Serializable,Comparable<MathOperation>,Constable
A representation of the math operations for the Minecraft scoreboard
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionAddition of two values (+=)Assignment of a value (=)Division of a value by another value (/=)The maximum value of two values (>)The minimum value of two values (<)Modulo of a value by another value (%=)Multiplication of a value by another value (*=)Subtraction of a value by another value (-=)Swap the results of two values (><) -
Method Summary
Modifier and TypeMethodDescriptionfloatapply(float val1, float val2) Applies the current MathOperation to two floatsintapply(int val1, int val2) Applies the current MathOperation to two intsstatic MathOperationfromString(String input) Creates a MathOperation from the Minecraft string representation (e.g. "=" or "/=")toString()Returns the Minecraft string value of this MathOperationstatic MathOperationReturns the enum constant of this class with the specified name.static MathOperation[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
ADD
Addition of two values (+=) -
ASSIGN
Assignment of a value (=) -
DIVIDE
Division of a value by another value (/=) -
MAX
The maximum value of two values (>) -
MIN
The minimum value of two values (<) -
MOD
Modulo of a value by another value (%=) -
MULTIPLY
Multiplication of a value by another value (*=) -
SUBTRACT
Subtraction of a value by another value (-=) -
SWAP
Swap the results of two values (><)
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
toString
Returns the Minecraft string value of this MathOperation- Overrides:
toStringin classEnum<MathOperation>- Returns:
- the Minecraft string value of this MathOperation
-
fromString
Creates a MathOperation from the Minecraft string representation (e.g. "=" or "/=")- Parameters:
input- the string to convert to- Returns:
- a MathOperation instance which represents the provided string
- Throws:
IllegalArgumentException- if the input is not a valid MathOperation
-
apply
public int apply(int val1, int val2) Applies the current MathOperation to two ints- Parameters:
val1- the base int to operate onval2- the new value to operate with- Returns:
- a int that is the result of applying this math operation
-
apply
public float apply(float val1, float val2) Applies the current MathOperation to two floats- Parameters:
val1- the base float to operate onval2- the new value to operate with- Returns:
- a float that is the result of applying this math operation
-