Interface DefaultDelegateAPI

  • All Known Implementing Classes:
    CoreContainerDelegate

    public interface DefaultDelegateAPI
    Default delegate API for use as trait by delegate subclasses.
    • Method Summary

      All Methods Instance Methods Default Methods 
      Modifier and Type Method Description
      default double abs​(double n)
      Calculate the absolute value of the given value.
      default double acos​(double value)
      Returns the arc cosine of a value.
      default PArray array​(String s)
      Parse the given String into a PArray.
      default PArray array​(Property p)
      Attempt to extract a PArray from the given Property.
      default PArray array​(Value v)
      Convert the given Value into a PArray.
      default double asin​(double value)
      Returns the arc sine of a value.
      default double atan​(double value)
      Returns the arc tangent of a value.
      default double atan2​(double y, double x)
      Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta).
      default boolean b​(String s)
      Parse the given String into a boolean according to the parsing rules of PBoolean.
      default boolean b​(Property p)
      Extract the Property's current value as a boolean.
      default boolean b​(Value v)
      Convert the provided Value into a boolean according to the parsing rules of PBoolean.
      default double constrain​(double amt, double low, double high)
      Constrain a value between the range of the given low and high values.
      default int constrain​(int amt, int low, int high)
      Constrain a value between the range of the given low and high values.
      default double cos​(double angle)
      Returns the trigonometric cosine of an angle.
      default double d​(String s)
      Parse the provided String into a double, or zero if invalid.
      default double d​(Property p)
      Extract a double from the Property's current Value, or zero if the value cannot be coerced.
      default double d​(Value v)
      Convert the provided Value into a double, or zero if the Value cannot be coerced.
      default double degrees​(double radians)
      Converts an angle in radians to an angle in degrees.
      default double dist​(double x1, double y1, double x2, double y2)
      Calculates the distance between two points.
      default double dist​(double x1, double y1, double z1, double x2, double y2, double z2)
      Calculates the distance between two points.
      default double exp​(double a)
      Calculate Euler's number raised to the power of the given value.
      default int i​(String s)
      Parse the provided String into an int, or zero if invalid.
      default int i​(Property p)
      Extract an int from the Property's current Value, or zero if the value cannot be coerced.
      default int i​(Value v)
      Convert the provided Value into an int, or zero if the Value cannot be coerced.
      default double lerp​(double start, double stop, double amt)
      Calculates a number between two numbers at a specific increment.
      default double log​(double a)
      Calculate the natural logarithm if the given value.
      default double map​(double value, double start1, double stop1, double start2, double stop2)
      Re-map (scale) an input value from one range to another.
      default double max​(double... values)
      Calculate the maximum value in the provided array.
      default double max​(double a, double b)
      Calculate the maximum of two values.
      default double max​(double a, double b, double c)
      Calculate the maximum of three values.
      default int max​(int... values)
      Calculate the maximum value in the provided array.
      default int max​(int a, int b)
      Calculate the maximum of two values.
      default int max​(int a, int b, int c)
      Calculate the maximum of three values.
      default double min​(double... values)
      Calculate the minimum value in the provided array.
      default double min​(double a, double b)
      Calculate the minimum of two values.
      default double min​(double a, double b, double c)
      Calculate the minimum of three values.
      default int min​(int... values)
      Calculate the minimum value in the provided array.
      default int min​(int a, int b)
      Calculate the minimum of two values.
      default int min​(int a, int b, int c)
      Calculate the minimum of three values.
      default double norm​(double value, double start, double stop)
      Normalizes a number from another range into a value between 0 and 1.
      default double pow​(double a, double b)
      Calculate the value of the first argument raised to the power of the second argument.
      default double radians​(double degrees)
      Converts an angle in degrees to an angle in radians.
      default double random​(double max)
      Return a random number between zero and max (exclusive)
      default double random​(double min, double max)
      Return a random number between min (inclusive) and max (exclusive)
      default double randomOf​(double... values)
      Return a random element from an array of values.
      default int randomOf​(int... values)
      Return a random element from an array of values.
      default String randomOf​(String... values)
      Return a random element from an array of values.
      default int round​(double amt)
      Round a value to the nearest integer.
      default String s​(Property p)
      Extract the Property's current value into a String representation.
      default String s​(Value v)
      Convert the provided Value into a String representation.
      default double sin​(double angle)
      Returns the trigonometric sine of an angle
      default double sq​(double a)
      Calculate the square of the given value.
      default double sqrt​(double a)
      Calculate the square root of the given value.
      default double tan​(double angle)
      Returns the trigonometric tangent of an angle.
    • Method Detail

      • d

        default double d​(Property p)
        Extract a double from the Property's current Value, or zero if the value cannot be coerced.
        Parameters:
        p -
        Returns:
      • d

        default double d​(Value v)
        Convert the provided Value into a double, or zero if the Value cannot be coerced.
        Parameters:
        v -
        Returns:
      • d

        default double d​(String s)
        Parse the provided String into a double, or zero if invalid.
        Parameters:
        s -
        Returns:
      • i

        default int i​(Property p)
        Extract an int from the Property's current Value, or zero if the value cannot be coerced.
        Parameters:
        p -
        Returns:
      • i

        default int i​(Value v)
        Convert the provided Value into an int, or zero if the Value cannot be coerced.
        Parameters:
        v -
        Returns:
      • i

        default int i​(String s)
        Parse the provided String into an int, or zero if invalid.
        Parameters:
        s -
        Returns:
      • b

        default boolean b​(Property p)
        Extract the Property's current value as a boolean. If the value cannot be coerced, returns false.
        Parameters:
        p -
        Returns:
      • b

        default boolean b​(Value v)
        Convert the provided Value into a boolean according to the parsing rules of PBoolean. If the Value cannot be coerced, returns false.
        Parameters:
        v -
        Returns:
      • b

        default boolean b​(String s)
        Parse the given String into a boolean according to the parsing rules of PBoolean. If the String is invalid, returns false.
        Parameters:
        s -
        Returns:
      • s

        default String s​(Property p)
        Extract the Property's current value into a String representation.
        Parameters:
        p -
        Returns:
      • s

        default String s​(Value v)
        Convert the provided Value into a String representation.
        Parameters:
        v -
        Returns:
      • array

        default PArray array​(Value v)
        Convert the given Value into a PArray. If the Value is already a PArray it will be returned, otherwise an attempt will be made to coerce it. If the Value cannot be converted, an empty PArray will be returned.
        Parameters:
        s -
        Returns:
      • array

        default PArray array​(String s)
        Parse the given String into a PArray. If the String is not a valid representation of an array, returns an empty PArray.
        Parameters:
        s -
        Returns:
      • random

        default double random​(double max)
        Return a random number between zero and max (exclusive)
        Parameters:
        max - the upper bound of the range
        Returns:
      • random

        default double random​(double min,
                              double max)
        Return a random number between min (inclusive) and max (exclusive)
        Parameters:
        min - the lower bound of the range
        max - the upper bound of the range
        Returns:
      • randomOf

        default double randomOf​(double... values)
        Return a random element from an array of values.
        Parameters:
        values - list of values, may not be empty
        Returns:
        random element
      • randomOf

        default int randomOf​(int... values)
        Return a random element from an array of values.
        Parameters:
        values - list of values, may not be empty
        Returns:
        random element
      • randomOf

        default String randomOf​(String... values)
        Return a random element from an array of values.
        Parameters:
        values - list of values, may not be empty
        Returns:
        random element
      • abs

        default double abs​(double n)
        Calculate the absolute value of the given value. If the value is positive, the value is returned. If the value is negative, the negation of the value is returned.
        Parameters:
        n -
        Returns:
      • sq

        default double sq​(double a)
        Calculate the square of the given value.
        Parameters:
        a -
        Returns:
      • sqrt

        default double sqrt​(double a)
        Calculate the square root of the given value.
        Parameters:
        a -
        Returns:
        See Also:
        Math.sqrt(double)
      • log

        default double log​(double a)
        Calculate the natural logarithm if the given value.
        Parameters:
        a -
        Returns:
        See Also:
        Math.log(double)
      • exp

        default double exp​(double a)
        Calculate Euler's number raised to the power of the given value.
        Parameters:
        a -
        Returns:
        See Also:
        Math.exp(double)
      • pow

        default double pow​(double a,
                           double b)
        Calculate the value of the first argument raised to the power of the second argument.
        Parameters:
        a - the base
        b - the exponent
        Returns:
        the value ab
        See Also:
        Math.pow(double, double)
      • max

        default int max​(int a,
                        int b)
        Calculate the maximum of two values.
        Parameters:
        a -
        b -
        Returns:
      • max

        default int max​(int a,
                        int b,
                        int c)
        Calculate the maximum of three values.
        Parameters:
        a -
        b -
        c -
        Returns:
      • max

        default int max​(int... values)
        Calculate the maximum value in the provided array.
        Parameters:
        values - value list - must not be empty
        Returns:
        maximum value
      • max

        default double max​(double a,
                           double b)
        Calculate the maximum of two values.
        Parameters:
        a -
        b -
        Returns:
      • max

        default double max​(double a,
                           double b,
                           double c)
        Calculate the maximum of three values.
        Parameters:
        a -
        b -
        c -
        Returns:
      • max

        default double max​(double... values)
        Calculate the maximum value in the provided array.
        Parameters:
        values - value list - must not be empty
        Returns:
        maximum value
      • min

        default int min​(int a,
                        int b)
        Calculate the minimum of two values.
        Parameters:
        a -
        b -
        Returns:
      • min

        default int min​(int a,
                        int b,
                        int c)
        Calculate the minimum of three values.
        Parameters:
        a -
        b -
        c -
        Returns:
      • min

        default int min​(int... values)
        Calculate the minimum value in the provided array.
        Parameters:
        values - value list - must not be empty
        Returns:
        minimum value
      • min

        default double min​(double a,
                           double b)
        Calculate the minimum of two values.
        Parameters:
        a -
        b -
        Returns:
      • min

        default double min​(double a,
                           double b,
                           double c)
        Calculate the minimum of three values.
        Parameters:
        a -
        b -
        c -
        Returns:
      • min

        default double min​(double... values)
        Calculate the minimum value in the provided array.
        Parameters:
        values - value list - must not be empty
        Returns:
        minimum value
      • constrain

        default int constrain​(int amt,
                              int low,
                              int high)
        Constrain a value between the range of the given low and high values.
        Parameters:
        amt - input value
        low - lowest allowed value
        high - highest allowed value
        Returns:
        constrained value
      • constrain

        default double constrain​(double amt,
                                 double low,
                                 double high)
        Constrain a value between the range of the given low and high values.
        Parameters:
        amt - input value
        low - lowest allowed value
        high - highest allowed value
        Returns:
        constrained value
      • round

        default int round​(double amt)
        Round a value to the nearest integer.
        Parameters:
        amt - input value
        Returns:
        rounded value
      • degrees

        default double degrees​(double radians)
        Converts an angle in radians to an angle in degrees.
        Parameters:
        radians -
        Returns:
        See Also:
        Math.toDegrees(double)
      • radians

        default double radians​(double degrees)
        Converts an angle in degrees to an angle in radians.
        Parameters:
        degrees -
        Returns:
        See Also:
        Math.toRadians(double)
      • sin

        default double sin​(double angle)
        Returns the trigonometric sine of an angle
        Parameters:
        angle -
        Returns:
        See Also:
        Math.sin(double)
      • cos

        default double cos​(double angle)
        Returns the trigonometric cosine of an angle.
        Parameters:
        angle -
        Returns:
        See Also:
        Math.cos(double)
      • tan

        default double tan​(double angle)
        Returns the trigonometric tangent of an angle.
        Parameters:
        angle -
        Returns:
        See Also:
        Math.tan(double)
      • asin

        default double asin​(double value)
        Returns the arc sine of a value.
        Parameters:
        value -
        Returns:
        See Also:
        Math.asin(double)
      • acos

        default double acos​(double value)
        Returns the arc cosine of a value.
        Parameters:
        value -
        Returns:
        See Also:
        Math.acos(double)
      • atan

        default double atan​(double value)
        Returns the arc tangent of a value.
        Parameters:
        value -
        Returns:
        See Also:
        Math.atan(double)
      • atan2

        default double atan2​(double y,
                             double x)
        Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta).
        Parameters:
        y -
        x -
        Returns:
        See Also:
        Math.atan2(double, double)
      • map

        default double map​(double value,
                           double start1,
                           double stop1,
                           double start2,
                           double stop2)
        Re-map (scale) an input value from one range to another. Numbers outside the range are not clamped.
        Parameters:
        value - the value to be converted
        start1 - lower bound of the value's current range
        stop1 - upper bound of the value's current range
        start2 - lower bound of the value's target range
        stop2 - upper bound of the value's target range
        Returns:
      • dist

        default double dist​(double x1,
                            double y1,
                            double x2,
                            double y2)
        Calculates the distance between two points.
        Parameters:
        x1 - x-coordinate of the first point
        y1 - y-coordinate of the first point
        x2 - x-coordinate of the second point
        y2 - y-coordinate of the second point
        Returns:
      • dist

        default double dist​(double x1,
                            double y1,
                            double z1,
                            double x2,
                            double y2,
                            double z2)
        Calculates the distance between two points.
        Parameters:
        x1 - x-coordinate of the first point
        y1 - y-coordinate of the first point
        z1 - z-coordinate of the first point
        x2 - x-coordinate of the second point
        y2 - y-coordinate of the second point
        z2 - z-coordinate of the second point
        Returns:
      • lerp

        default double lerp​(double start,
                            double stop,
                            double amt)
        Calculates a number between two numbers at a specific increment. The amt parameter is the amount to interpolate between the two values where 0.0 equal to the first point, 0.1 is very near the first point, 0.5 is half-way in between, etc. The lerp function is convenient for creating motion along a straight path and for drawing dotted lines.
        Parameters:
        start - first value
        stop - second value
        amt - between 0.0 and 1.0
        Returns:
      • norm

        default double norm​(double value,
                            double start,
                            double stop)
        Normalizes a number from another range into a value between 0 and 1.

        Identical to map(value, low, high, 0, 1);

        Numbers outside the range are not clamped to 0 and 1, because out-of-range values are often intentional and useful.

        Parameters:
        value - the incoming value to be converted
        start - lower bound of the value's current range
        stop - upper bound of the value's current range
        Returns: