Class RecursiveArgument

    • Field Detail

      • TYPE_ID_RECURSIVE

        public static final int TYPE_ID_RECURSIVE
        Type identifier for recursive arguments.
        See Also:
        Constant Field Values
      • TYPE_DESC_RECURSIVE

        public static String TYPE_DESC_RECURSIVE
    • Constructor Detail

      • RecursiveArgument

        public RecursiveArgument​(String argumentName,
                                 String recursiveExpressionString,
                                 String indexName)
        Constructor - creates recursive argument.
        Parameters:
        argumentName - the argument name
        recursiveExpressionString - the recursive expression string
        indexName - index argument name
      • RecursiveArgument

        public RecursiveArgument​(String argumentName,
                                 String recursiveExpressionString,
                                 Argument n,
                                 PrimitiveElement... elements)
        Constructor - creates recursive argument.
        Parameters:
        argumentName - the argument name
        recursiveExpressionString - the recursive expression string
        n - the index argument
        elements - Optional elements list (variadic - comma separated) of types: Argument, Constant, Function
        See Also:
        PrimitiveElement, Argument
      • RecursiveArgument

        public RecursiveArgument​(String argumentDefinitionString,
                                 PrimitiveElement... elements)
        Constructor - creates argument based on the argument definition string.
        Parameters:
        argumentDefinitionString - Argument definition string, i.e.:
        • 'x' - only argument name
        • 'x=5' - argument name and argument value
        • 'x=2*5' - argument name and argument value given as simple expression
        • 'x=2*y' - argument name and argument expression (dependent argument 'x' on argument 'y')
        • 'x(n)=x(n-1)+x(n-2)' - for recursive arguments)
        elements - Optional elements list (variadic - comma separated) of types: Argument, Constant, Function
        See Also:
        PrimitiveElement, Argument
    • Method Detail

      • addBaseCase

        public void addBaseCase​(int index,
                                double value)
        Adds base case
        Parameters:
        index - the base case index
        value - the base case value
      • resetAllCases

        public void resetAllCases()
        Clears all based cases and stored calculated values
      • getArgumentValue

        public double getArgumentValue​(double index)
        Gets recursive argument value
        Parameters:
        index - the index
        Returns:
        value as double
      • cloneForThreadSafe

        public RecursiveArgument cloneForThreadSafe()
        Creates a completely independent 1-1 clone that can be safely used by a separate thread. If the cloned element contains references to other elements (e.g. arguments, functions, constants), then they will also be cloned and the newly created element will contain references to the corresponding clones. Important - the API allows you to extract all these clones.
        Overrides:
        cloneForThreadSafe in class Argument
        Returns:
        Cloned object.