Package astra.lang

Class Math


  • public class Math
    extends Module
    Mathematical support for ASTRA.
    Author:
    Rem Collier
    • Constructor Detail

      • Math

        public Math()
    • 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 integer
        B - 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 integer
        B - 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