org.jactr.core.production.condition
Interface ICondition

All Known Subinterfaces:
IBufferCondition
All Known Implementing Classes:
AbstractBufferCondition, AbstractSlotCondition, ChunkCondition, ChunkPattern, ChunkTypeCondition, ProxyCondition, QueryCondition, ScriptableCondition, SystemPropertyCondition, VariableCondition

public interface ICondition

Basic definition of a matching condition for the production.

Author:
harrison

Method Summary
 int bind(IModel model, java.util.Map<java.lang.String,java.lang.Object> variableBindings, boolean isIterative)
          Iteratively perform the resolution and binding for this condition.
 ICondition clone(IModel model, java.util.Map<java.lang.String,java.lang.Object> variableBindings)
          attempt to clone this condition before it will be bound in the instantiation phase.
 void dispose()
          called when we are sure we are done with this condition
 

Method Detail

dispose

void dispose()
called when we are sure we are done with this condition


clone

ICondition clone(IModel model,
                 java.util.Map<java.lang.String,java.lang.Object> variableBindings)
                 throws CannotMatchException
attempt to clone this condition before it will be bound in the instantiation phase. We pass the current bindings so that the condition can do an early rejection if possible.

Parameters:
model -
variableBindings -
Returns:
a writable copy of the condition that will be bound
Throws:
CannotMatchException - if there is no way this condition can be matched

bind

int bind(IModel model,
         java.util.Map<java.lang.String,java.lang.Object> variableBindings,
         boolean isIterative)
         throws CannotMatchException
Iteratively perform the resolution and binding for this condition. If this condition defines any variables, they are placed into the bindings map for other conditions to exploit. Similarly, it will resolve any bindings that it needs in order to be matched. If at any point the condition determines that it cannot be matched, the exception is to be thrown. Similarly, if isIterative is false, and there are unresolved bindings, the exception should be thrown.
Otherwise, the number of unresolved bindings is returned which allows the instantiation calculation determine if another resolution round is required.

Returns:
number of unresolved variables
Throws:
CannotMatchException