Package astra.lang
Class Math
- java.lang.Object
-
- astra.core.Module
-
- astra.lang.Math
-
public class Math extends Module
Mathematical support for ASTRA.- Author:
- Rem Collier
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class astra.core.Module
Module.ACTION, Module.EVENT, Module.FORMULA, Module.SENSOR, Module.SUPPRESS_NOTIFICATIONS, Module.TERM
-
-
Constructor Summary
Constructors Constructor Description Math()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intabs(int i)Term that returns the absolute value of the given integer.doubledoubleValue(String X)Term that converts a string to a double.Formulaevaluate(boolean value)Formula that evaluates a boolean value.floatfloatValue(String X)Term that converts a string to a float.intintValue(String X)Term that converts a string to an int.longlongValue(String X)Term that converts a string to a long.intmax(int A, int B)Term that returns the max of two values.intmin(int A, int B)Term that returns the min of two values.intrandomInt()Term that returns a randomly generated int value.
-
-
-
Method Detail
-
evaluate
public Formula evaluate(boolean value)
Formula that evaluates a boolean value.- Parameters:
value- a boolean value- Returns:
- the formula TRUE or the formula FALSE
-
max
public int max(int A, int B)Term that returns the max of two values.- Parameters:
A- an integerB- another integer- Returns:
- the maximum of the two integers
-
min
public int min(int A, int B)Term that returns the min of two values.- Parameters:
A- an integerB- another integer- Returns:
- the minimum of the two integers
-
intValue
public int intValue(String X)
Term that converts a string to an int.- Parameters:
X- a string- Returns:
- the integer value of the string
-
longValue
public long longValue(String X)
Term that converts a string to a long.- Parameters:
X- a string- Returns:
- the long value of the string
-
floatValue
public float floatValue(String X)
Term that converts a string to a float.- Parameters:
X- a string- Returns:
- the float value of the string
-
doubleValue
public double doubleValue(String X)
Term that converts a string to a double.- Parameters:
X- a string- Returns:
- the double value of the string
-
randomInt
public int randomInt()
Term that returns a randomly generated int value.- Returns:
- a positive random integer number
-
abs
public int abs(int i)
Term that returns the absolute value of the given integer.- Parameters:
i- a value- Returns:
- the absolute value of the parameter
-
-