Package de.xima.fc.workflow.parser.infix
Interface IInfixExpressionHandler<TConstant extends IConstant,TOperator extends IOperator>
- 
- Type Parameters:
 TConstant- Type of the implementation for constant symbols.TOperator- Type of the implementation for operator symbols.
public interface IInfixExpressionHandler<TConstant extends IConstant,TOperator extends IOperator>Handler that can tokenize, parse, and evaluate character sequences representing infix expressions.- Since:
 - 7.0.0
 - Author:
 - XIMA MEDIA GmbH
 
 
- 
- 
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <TData> TDataevaluate(IEvalContext<TData,TConstant,TOperator> ctx, Iterable<IParsedElement<TConstant,TOperator>> rpn, Locale locale)Evaluates the given reverse polish notation with the given context.Iterable<IParsedElement<TConstant,TOperator>>parse(Iterable<IToken<TConstant,TOperator>> tokens, Locale locale)Takes a token stream and parses it into a valid reverse polish notation representation.Iterable<IToken<TConstant,TOperator>>tokenize(CharSequence expression, Locale locale)Inspects the given expressions and extracts the semantic tokens it consists of.IValidationResultvalidate(CharSequence expression, IValidationOptions options)Validates the given infix expression. 
 - 
 
- 
- 
Method Detail
- 
evaluate
<TData> TData evaluate(IEvalContext<TData,TConstant,TOperator> ctx, Iterable<IParsedElement<TConstant,TOperator>> rpn, Locale locale) throws InfixExpressionException
Evaluates the given reverse polish notation with the given context.- Type Parameters:
 TData- Type of the data on which the context operates.- Parameters:
 ctx- Context for performing the evaluation.rpn- Reverse polish expression to evaluate.locale- Locale used for localizing error messages.- Returns:
 - The result of the evaluation. 
nullwhen the expression contains no items, or the evaluation context returnednull. - Throws:
 InfixExpressionException- When the expression could not be evaluated, such as when the context threw an exception.
 
- 
parse
Iterable<IParsedElement<TConstant,TOperator>> parse(Iterable<IToken<TConstant,TOperator>> tokens, Locale locale) throws InfixExpressionException
Takes a token stream and parses it into a valid reverse polish notation representation.- Parameters:
 tokens- Tokens of an infix expression, such as created bytokenize(CharSequence, Locale).nullis treated as the empty string.locale- Locale used for localizing error messages.- Returns:
 - The given infix expression in reverse polish notation.
 - Throws:
 InfixExpressionException- W@Override hen the input is not well-formed, such as when it contains missing parenthesis.
 
- 
tokenize
Iterable<IToken<TConstant,TOperator>> tokenize(CharSequence expression, Locale locale) throws InfixExpressionException
Inspects the given expressions and extracts the semantic tokens it consists of.- Parameters:
 expression- An infix expression to tokenize.locale- Locale used for localizing error messages.- Returns:
 - The list of tokens making up the given expression.
 - Throws:
 InfixExpressionException- When the input expression cannot be split into tokens, such as when it contains an invalid identifier.
 
- 
validate
IValidationResult validate(CharSequence expression, IValidationOptions options)
Validates the given infix expression. Checks whether it is well-formed, and that each variable name passes the given existence check.- Parameters:
 expression- Infix expression to validate.options- Options to configure what is to be validated.- Returns:
 - The result of the validation.
 
 
 - 
 
 -