Class TokenEvaluator<T>

    • Constructor Summary

      Constructors 
      Constructor Description
      TokenEvaluator()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected EvaluationResult ambiguousTokenFailure​(T object, java.lang.String token)
      Generates a failure result for an ambiguous token.
      abstract EvaluationResult evaluate​(T target, CalculationFunctions functions, java.lang.String firstToken, java.util.List<java.lang.String> remainingTokens)
      Evaluates a token against a given object.
      abstract java.lang.Class<?> getTargetType()
      Gets the type against which tokens can be evaluated in this implementation.
      protected EvaluationResult invalidTokenFailure​(T object, java.lang.String token)
      Generates a failure result for an invalid token.
      abstract java.util.Set<java.lang.String> tokens​(T object)
      Gets the set of supported token for the given object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TokenEvaluator

        public TokenEvaluator()
    • Method Detail

      • getTargetType

        public abstract java.lang.Class<?> getTargetType()
        Gets the type against which tokens can be evaluated in this implementation.
        Returns:
        the evaluation type
      • tokens

        public abstract java.util.Set<java.lang.String> tokens​(T object)
        Gets the set of supported token for the given object.
        Parameters:
        object - the object against which tokens may be evaluated
        Returns:
        the set of supported tokens
      • evaluate

        public abstract EvaluationResult evaluate​(T target,
                                                  CalculationFunctions functions,
                                                  java.lang.String firstToken,
                                                  java.util.List<java.lang.String> remainingTokens)
        Evaluates a token against a given object.
        Parameters:
        target - the object against which to evaluate the token
        functions - the calculation functions
        firstToken - the first token of the expression
        remainingTokens - the remaining tokens in the expression, possibly empty
        Returns:
        the result of the evaluation
      • invalidTokenFailure

        protected EvaluationResult invalidTokenFailure​(T object,
                                                       java.lang.String token)
        Generates a failure result for an invalid token.
        Parameters:
        object - the object against which the failure occurred
        token - the invalid token
        Returns:
        the failure result
      • ambiguousTokenFailure

        protected EvaluationResult ambiguousTokenFailure​(T object,
                                                         java.lang.String token)
        Generates a failure result for an ambiguous token.
        Parameters:
        object - the object against which the failure occurred.
        token - the ambiguous token
        Returns:
        the failure result