org.ogf.graap.wsag.interpreter.expr
Class AbstractExpression

java.lang.Object
  extended by org.ogf.graap.wsag.interpreter.expr.AbstractExpression
All Implemented Interfaces:
IExpression
Direct Known Subclasses:
AllExpression, ExactlyOneExpression, OneOrMoreExpression

public abstract class AbstractExpression
extends Object
implements IExpression

WS-Agreement allows to logically compose terms in an agreement using a simple expression language. Terms can be composed using logical AND (All), OR (OneOrMore), and XOR (ExacltyOne) operations in the agreement terms. This abstract expression implementation is the base class for the concrete implementations. It is used by the AgreementInterpreter that evaluates the validity of the agreement terms in an offer with respect to the expression language.

Author:
Oliver Waeldrich
See Also:
AgreementInterpreter

Constructor Summary
AbstractExpression(TermCompositorType term)
          Creates an expression for a given term compositor.
 
Method Summary
 TermType[] interpret(InterpreterContext context)
          interprets an expression
protected abstract  TermType[] interpret(TermType[] terms, InterpreterContext context)
          template method that implements a specific interpretation strategy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractExpression

public AbstractExpression(TermCompositorType term)
Creates an expression for a given term compositor.

Parameters:
term - the agreement term compositor
Method Detail

interpret

protected abstract TermType[] interpret(TermType[] terms,
                                        InterpreterContext context)
                                 throws InterpreterException
template method that implements a specific interpretation strategy. The strategy interprets a set of terms and returns a result, i.e. the selected term in an ExactlyOne statement.

Parameters:
terms - the terms to interpret
context - the interpreter context
Returns:
the strategy result, i.e. a filtered term list
Throws:
InterpreterException - indicates an error during the term interpretation

interpret

public TermType[] interpret(InterpreterContext context)
                     throws InterpreterException
interprets an expression

Specified by:
interpret in interface IExpression
Parameters:
context - the interpreter context
Returns:
the terms in the expression
Throws:
InterpreterException - indicates an error while processing the context


Copyright © 2008-2012. All Rights Reserved.