issrg.pba.rbac.xmlpolicy.ifstatement
Interface Interpreter

All Known Implementing Classes:
IntegerInterpreter, StringInterpreter, TimeInterpreter, TimeInterpreter

public interface Interpreter

This is the interface to an interpreter of the evaluation operation. Implementations of this class are expected to be provided by the AEF/PEP at run-time. The implementations would tell what kind of terms they can interpret to complete the operation with a definite result. If the interpreter can evaluate an expression, it returns the resulting type of the expression, when canEvaluate method is invoked, and the evaluation result or an EvaluationException when an evaluate method is invoked.

Author:
A.Otenko

Method Summary
 java.lang.String canEvaluate(Term[] t)
          This method returns the string type of the result of evaluating the given set of Terms, or null, if the expression cannot be evaluated by this interpreter.
 java.lang.Object evaluate(Environment env, Term[] t)
          This method evaluates the expression given the environment.
 

Method Detail

canEvaluate

java.lang.String canEvaluate(Term[] t)
This method returns the string type of the result of evaluating the given set of Terms, or null, if the expression cannot be evaluated by this interpreter.

Parameters:
t - - the array of Terms; can be null and can be empty
Returns:
the String name of the type of the result, or null, if the expression cannot be evaluated

evaluate

java.lang.Object evaluate(Environment env,
                          Term[] t)
                          throws EvaluationException
This method evaluates the expression given the environment.

Parameters:
env - - the Environment with variables used in IF-statement
t - - the sequence of Terms in the order that they appear in the policy; can be null or an empty array
Returns:
the object of the type guaranteed by canEvaluate method; never null
Throws:
EvaluationException, - if for some reason evaluation failed
EvaluationException