Package adams.parser

Class AbstractExpressionEvaluator<T>

    • Field Detail

      • m_Environment

        protected String m_Environment
        the environment class (dummy option, happens all in runJavadoc method).
      • m_Expression

        protected String m_Expression
        the expression to evaluate.
    • Constructor Detail

      • AbstractExpressionEvaluator

        public AbstractExpressionEvaluator()
    • Method Detail

      • setEnvironment

        public void setEnvironment​(String value)
        sets the classname of the environment class to use.
        Parameters:
        value - the environment class name
      • getEnvironment

        public String getEnvironment()
        returns the current classname of the environment class to use.
        Returns:
        the current classname of the environment class
      • environmentTipText

        public String environmentTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • getDefaultExpression

        protected abstract String getDefaultExpression()
        Returns the default expression to use.
        Returns:
        the default expression
      • setExpression

        public void setExpression​(String value)
        Sets the expression to evaluate.
        Parameters:
        value - the expression
      • getExpression

        public String getExpression()
        Returns the expression to evaluate.
        Returns:
        the expression
      • expressionTipText

        public abstract String expressionTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • evaluate

        public abstract T evaluate()
                            throws Exception
        Performs the evaluation.
        Returns:
        the evaluation, or null in case of error
        Throws:
        Exception - if evaluation fails
      • forName

        public static AbstractExpressionEvaluator forName​(String classname,
                                                          String[] options)
        Instantiates the evaluator with the given options.
        Parameters:
        classname - the classname of the evaluator to instantiate
        options - the options for the evaluator
        Returns:
        the instantiated evaluator or null if an error occurred
      • forCommandLine

        public static AbstractExpressionEvaluator forCommandLine​(String cmdline)
        Instantiates the evaluator from the given commandline (i.e., classname and optional options).
        Parameters:
        cmdline - the classname (and optional options) of the evaluator to instantiate
        Returns:
        the instantiated evaluator or null if an error occurred
      • runEvaluator

        public static void runEvaluator​(Class eval,
                                        String[] args)
        Runs the evaluator from commandline.
        Parameters:
        eval - the evaluator to execute
        args - the commandline arguments, use -help to display all