lij.runtime
Class ConstraintInstance

java.lang.Object
  extended by lij.runtime.ConstraintInstance
Direct Known Subclasses:
ConstraintInstance.ConstraintAssignmentInstance, ConstraintInstance.ConstraintComparisonInstance, ConstraintInstance.ConstraintListInstance, ConstraintInstance.ConstraintMethodInstance

public abstract class ConstraintInstance
extends java.lang.Object

This class performs checking of Constraints. It's main purpose is to decouple the execution code from the model.Def class

Author:
Nikolaos Chatzinikolaou

Nested Class Summary
private static class ConstraintInstance.ConstraintAssignmentInstance
          A ConstraintInstance subclass for assignment constraints.
private static class ConstraintInstance.ConstraintComparisonInstance
          A ConstraintInstance subclass for comparison constraints.
private static class ConstraintInstance.ConstraintListInstance
          A ConstraintInstance subclass for list constraints.
private static class ConstraintInstance.ConstraintMethodInstance
          A ConstraintInstance subclass for method constraints.
 
Field Summary
protected  AgentInstance agentInstance
           
protected  Constraint constraint
           
protected  Interpreter interpreter
           
 
Constructor Summary
ConstraintInstance()
           
 
Method Summary
abstract  Result.State check()
          This method needs to be implemented by any subclasses.
static ConstraintInstance createConstraintInstance(Constraint _constraint, Interpreter _interpreter, AgentInstance _agentInstance)
          Factory method for creating an instance of a ConstraintInstance subclass.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

constraint

protected Constraint constraint

interpreter

protected Interpreter interpreter

agentInstance

protected AgentInstance agentInstance
Constructor Detail

ConstraintInstance

public ConstraintInstance()
Method Detail

createConstraintInstance

public static ConstraintInstance createConstraintInstance(Constraint _constraint,
                                                          Interpreter _interpreter,
                                                          AgentInstance _agentInstance)
Factory method for creating an instance of a ConstraintInstance subclass.

Parameters:
_constraint - The Constraint encapsulated in this ConstraintInstance.
_agentInstance - The AgentInstance performing the instantiation.
Returns:
The instantiated ConstraintInstance.

check

public abstract Result.State check()
                            throws InterpreterException
This method needs to be implemented by any subclasses. It performs the evaluation (checking) of the constraint.

Returns:
The result of the evaluation (TRUE, FALSE or MAYBE).
Throws:
InterpreterException