org.jactr.core.production.request
Class SlotBasedRequest

java.lang.Object
  extended by org.jactr.core.production.request.SlotBasedRequest
All Implemented Interfaces:
java.lang.Cloneable, IRequest, ISlotContainer
Direct Known Subclasses:
ChunkTypeRequest

public class SlotBasedRequest
extends java.lang.Object
implements IRequest, ISlotContainer

basic slot based request


Constructor Summary
SlotBasedRequest()
           
SlotBasedRequest(java.util.Collection<? extends ISlot> slots)
           
 
Method Summary
 void addSlot(ISlot slot)
          Adds a slot
 int bind(IModel model, java.util.Map<java.lang.String,java.lang.Object> bindings, boolean iterativeCall)
          attempt to resolve and bind any variables within this request.
 int bind(IModel model, java.lang.String containerName, IUniqueSlotContainer container, java.util.Map<java.lang.String,java.lang.Object> bindings, boolean iterativeCall)
          bind the slot values in this request against those slots contained in the container.
 SlotBasedRequest clone()
          duplicate this IRequest so that the clone can be resolved against since the process is destructive
 java.util.Collection<? extends IConditionalSlot> getConditionalSlots()
           
 java.util.Collection<? extends ISlot> getSlots()
          return a duplicate copy of all the slots
 java.util.Collection<ISlot> getSlots(java.util.Collection<ISlot> container)
           
 void removeSlot(ISlot slot)
          remove a slot
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SlotBasedRequest

public SlotBasedRequest()

SlotBasedRequest

public SlotBasedRequest(java.util.Collection<? extends ISlot> slots)
Method Detail

bind

public int bind(IModel model,
                java.lang.String containerName,
                IUniqueSlotContainer container,
                java.util.Map<java.lang.String,java.lang.Object> bindings,
                boolean iterativeCall)
         throws CannotMatchException
bind the slot values in this request against those slots contained in the container. This allows us to generally bind against anything that contains a slot (chunk, chunktype, or buffer for queries)

Parameters:
model -
container -
bindings -
iterativeCall -
Returns:
Throws:
CannotMatchException

bind

public int bind(IModel model,
                java.util.Map<java.lang.String,java.lang.Object> bindings,
                boolean iterativeCall)
         throws CannotMatchException
Description copied from interface: IRequest
attempt to resolve and bind any variables within this request. This method can be called iteratively and is permitted to make perminent changes to the request since this should be a clone (or transient).
bind will attempt to resolve and bind any variables it contains against those in the bindings. If it has any unresolved bindings and this is an iterative call, it can return the unresolved count. If it is not an iterativeCall, it cannot match and the exception is thrown.
If the request determines that it cannot match at anytime, it should throw the cannot match exception.

Specified by:
bind in interface IRequest
Returns:
number of unresolved variables in this request
Throws:
CannotMatchException

clone

public SlotBasedRequest clone()
Description copied from interface: IRequest
duplicate this IRequest so that the clone can be resolved against since the process is destructive

Specified by:
clone in interface IRequest
Overrides:
clone in class java.lang.Object
Returns:
deep copy

addSlot

public void addSlot(ISlot slot)
Description copied from interface: ISlotContainer
Adds a slot

Specified by:
addSlot in interface ISlotContainer
Parameters:
slot - The feature to be added to the ISlot attribute

getConditionalSlots

public java.util.Collection<? extends IConditionalSlot> getConditionalSlots()

getSlots

public java.util.Collection<? extends ISlot> getSlots()
Description copied from interface: ISlotContainer
return a duplicate copy of all the slots

Specified by:
getSlots in interface ISlotContainer
Returns:
The slots value

removeSlot

public void removeSlot(ISlot slot)
Description copied from interface: ISlotContainer
remove a slot

Specified by:
removeSlot in interface ISlotContainer
Parameters:
slot - Description of Parameter

getSlots

public java.util.Collection<ISlot> getSlots(java.util.Collection<ISlot> container)
Specified by:
getSlots in interface ISlotContainer