Enum CommonFunctions
- java.lang.Object
-
- java.lang.Enum<CommonFunctions>
-
- com.blackrook.expression.functions.CommonFunctions
-
- All Implemented Interfaces:
ExpressionFunctionType
,Serializable
,Comparable<CommonFunctions>
public enum CommonFunctions extends Enum<CommonFunctions> implements ExpressionFunctionType
Expression functions.- Author:
- Matthew Tropiano
-
-
Enum Constant Summary
Enum Constants Enum Constant Description BOOL
Convert to boolean.CLAMP
Clamp.COLOR
Color (byte) components to ARGB.COLORF
Color (float) components to ARGB.COS
Cosine.DEG2RAD
Degrees to radians.E
Returns Euler's constant.FLOAT
Convert to floating point (double, internally).INT
Convert to integer (long, internally).LERP
Linear-interpolate.MAX
Maximum.MIN
Minimum.PI
Returns PI.RAD2DEG
Radians to degrees.SIN
Sine.WRAP
Wrap.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract boolean
execute(ExpressionStack stack, ExpressionVariableContext context)
Executes this node.int
getArgumentCount()
static ExpressionFunctionResolver
getResolver()
boolean
isCollapsable()
Checks if this node type is collapsable.static CommonFunctions
valueOf(String name)
Returns the enum constant of this type with the specified name.static CommonFunctions[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.-
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Methods inherited from interface com.blackrook.expression.node.ExpressionFunctionType
name
-
-
-
-
Enum Constant Detail
-
MIN
public static final CommonFunctions MIN
Minimum.
-
MAX
public static final CommonFunctions MAX
Maximum.
-
SIN
public static final CommonFunctions SIN
Sine.
-
COS
public static final CommonFunctions COS
Cosine.
-
CLAMP
public static final CommonFunctions CLAMP
Clamp.
-
WRAP
public static final CommonFunctions WRAP
Wrap.
-
LERP
public static final CommonFunctions LERP
Linear-interpolate.
-
BOOL
public static final CommonFunctions BOOL
Convert to boolean.
-
INT
public static final CommonFunctions INT
Convert to integer (long, internally).
-
FLOAT
public static final CommonFunctions FLOAT
Convert to floating point (double, internally).
-
COLOR
public static final CommonFunctions COLOR
Color (byte) components to ARGB.
-
COLORF
public static final CommonFunctions COLORF
Color (float) components to ARGB.
-
DEG2RAD
public static final CommonFunctions DEG2RAD
Degrees to radians.
-
RAD2DEG
public static final CommonFunctions RAD2DEG
Radians to degrees.
-
PI
public static final CommonFunctions PI
Returns PI.
-
E
public static final CommonFunctions E
Returns Euler's constant.
-
-
Method Detail
-
values
public static CommonFunctions[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (CommonFunctions c : CommonFunctions.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static CommonFunctions valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException
- if the argument is null
-
getArgumentCount
public int getArgumentCount()
- Specified by:
getArgumentCount
in interfaceExpressionFunctionType
- Returns:
- the amount of arguments this takes.
-
isCollapsable
public boolean isCollapsable()
Checks if this node type is collapsable.- Specified by:
isCollapsable
in interfaceExpressionFunctionType
- Returns:
- true if so, false if not.
-
execute
public abstract boolean execute(ExpressionStack stack, ExpressionVariableContext context)
Executes this node.- Specified by:
execute
in interfaceExpressionFunctionType
- Parameters:
stack
- the stack to use.context
- the context for added variables.- Returns:
- if false, this halts script execution, else if true, continue.
-
getResolver
public static final ExpressionFunctionResolver getResolver()
- Returns:
- a function resolver that handles all of the functions in this enum.
-
-