org.jactr.core.production.condition
Class ChunkTypeCondition

java.lang.Object
  extended by org.jactr.core.production.condition.AbstractSlotCondition
      extended by org.jactr.core.production.condition.AbstractBufferCondition
          extended by org.jactr.core.production.condition.ChunkTypeCondition
All Implemented Interfaces:
IBufferCondition, ICondition, ISlotContainer
Direct Known Subclasses:
ChunkCondition

public class ChunkTypeCondition
extends AbstractBufferCondition

matches the contents of a buffer to a specific chunktype and slot values

Author:
harrison

Constructor Summary
ChunkTypeCondition(java.lang.String bufferName, IChunkType chunkType)
           
ChunkTypeCondition(java.lang.String bufferName, IChunkType chunkType, java.util.Collection<? extends ISlot> slots)
           
 
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.
 ChunkTypeCondition clone(IModel model, java.util.Map<java.lang.String,java.lang.Object> bindings)
          attempt to clone this condition before it will be bound in the instantiation phase.
 IChunkType getChunkType()
           
 ChunkTypeRequest getRequest()
           
 
Methods inherited from class org.jactr.core.production.condition.AbstractBufferCondition
getBufferName
 
Methods inherited from class org.jactr.core.production.condition.AbstractSlotCondition
addSlot, dispose, getConditionalSlots, getSlots, getSlots, removeSlot, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jactr.core.production.condition.ICondition
dispose
 

Constructor Detail

ChunkTypeCondition

public ChunkTypeCondition(java.lang.String bufferName,
                          IChunkType chunkType)

ChunkTypeCondition

public ChunkTypeCondition(java.lang.String bufferName,
                          IChunkType chunkType,
                          java.util.Collection<? extends ISlot> slots)
Method Detail

clone

public ChunkTypeCondition clone(IModel model,
                                java.util.Map<java.lang.String,java.lang.Object> bindings)
                         throws CannotMatchException
Description copied from interface: ICondition
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.

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

getChunkType

public IChunkType getChunkType()

getRequest

public ChunkTypeRequest getRequest()

bind

public int bind(IModel model,
                java.util.Map<java.lang.String,java.lang.Object> variableBindings,
                boolean isIterative)
         throws CannotMatchException
Description copied from interface: ICondition
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