public class RespectVMContext extends AbstractTupleCentreVMContext
AbstractTupleCentreVMContext
Modifier and Type | Class and Description |
---|---|
static class |
RespectVMContext.ModType |
Constructor and Description |
---|
RespectVMContext(RespectVM rvm,
TupleCentreId tid,
int queueSize,
IRespectTC respectTC) |
Modifier and Type | Method and Description |
---|---|
java.util.List<Tuple> |
addListTuple(Tuple t) |
void |
addPendingQueryEvent(InputEvent w)
Adds a query to the pending query set (W) of the tuple centre
|
protected boolean |
addReactionSpecHelper(AbstractBehaviourSpecification spec) |
void |
addSpecTuple(Tuple t)
Adds a tuple to the specification tuple set
|
void |
addTemporaryOutputEvent(InputEvent out) |
void |
addTuple(Tuple t,
boolean update)
Adds a tuple to the tuple set (T)
|
static LogicTuple |
checkReactionSpec(java.lang.String spec)
Static services that checks if a source text contains a valid ReSpecT
specification
|
void |
closePersistencyUpdates() |
void |
disablePersistency(java.lang.String path,
TucsonTupleCentreId fileName) |
void |
emptyTupleSet()
Removes all tuples
|
void |
enablePersistency(java.lang.String path,
TucsonTupleCentreId fileName) |
void |
evalReaction(TriggeredReaction z)
Evaluates a triggered reaction, changing the state of the VM accordingly.
|
void |
fetchTimedReactions(AbstractEvent ev)
Collects the time-triggered reactions
|
void |
fetchTriggeredReactions(AbstractEvent ev)
Collects the reactions that are triggered by an event
|
java.util.Iterator<alice.tuprolog.Term> |
findTimeReactions() |
java.util.List<Tuple> |
getAllTuples()
Gets all the tuples of the tuple centre
|
AbstractEvent |
getCurrentReactionEvent() |
alice.tuprolog.Struct |
getCurrentReactionTerm() |
java.util.Iterator<? extends AbstractEvent> |
getPendingQuerySetIterator()
Gets an iterator over the pending query set (W)
|
alice.tuprolog.Prolog |
getPrologCore() |
java.util.Iterator<? extends Tuple> |
getPrologPredicatesIterator() |
AbstractBehaviourSpecification |
getReactionSpec() |
RespectVM |
getRespectVM() |
java.util.Iterator<LogicTuple> |
getSpecTupleSetIterator() |
java.util.Iterator<? extends TriggeredReaction> |
getTriggeredReactionSetIterator()
Gets an iterator over the set of triggered reactions
|
LogicTuple[] |
getTRSet() |
LogicTuple[] |
getTSet(LogicTuple filter) |
java.util.Iterator<LogicTuple> |
getTupleSetIterator()
Gets an iterator over the tuple set (T)
|
WSetEvent[] |
getWSet(LogicTuple filter) |
java.util.List<Tuple> |
inAllTuples(TupleTemplate t)
Gets all the tuples of the tuple centre matching the TupleTemplate t
|
void |
linkOperation(OutputEvent oe) |
void |
notifyInputEnvEvent(InputEvent in) |
void |
notifyInputEvent(InputEvent in) |
void |
notifyNewInputEvent() |
java.util.List<Tuple> |
readAllTuples(TupleTemplate t)
Gets all the tuples of the tuple centre matching the TupleTemplate t
without removing them
|
Tuple |
readMatchingSpecTuple(TupleTemplate t) |
Tuple |
readMatchingTuple(TupleTemplate t)
Gets (not deterministically) without removing from the tuple set a tuple
that matches with the provided tuple template
|
Tuple |
readUniformTuple(TupleTemplate t)
Gets a tuple from tuple space in a non deterministic way
|
void |
recoveryPersistent(java.lang.String path,
java.lang.String file,
TucsonTupleCentreId tcName) |
Tuple |
removeMatchingSpecTuple(TupleTemplate t) |
Tuple |
removeMatchingTuple(TupleTemplate t,
boolean update)
Removes (not deterministically) from the tuple set a tuple that matches
with the provided tuple template
|
boolean |
removePendingQueryEvent(long operationId)
Removes the event related to a specific executed operation
|
void |
removePendingQueryEventsOf(AgentId id)
Removes all events of specified agent
|
void |
removeReactionSpec() |
TriggeredReaction |
removeTimeTriggeredReaction()
Removes a time-triggered reaction, previously fetched
|
TriggeredReaction |
removeTriggeredReaction()
Removes a triggered reaction, previously fetched
|
Tuple |
removeUniformTuple(TupleTemplate t)
Gets a tuple from tuple space in a non deterministic way
|
void |
reset()
resets the virtual machine to boot state
|
void |
setAllSpecTuples(java.util.List<Tuple> tupleList) |
void |
setAllTuples(java.util.List<Tuple> tupleList)
Gets all the tuples of the tuple centre
|
boolean |
setReactionSpec(AbstractBehaviourSpecification spec) |
protected boolean |
setReactionSpecHelper(AbstractBehaviourSpecification spec) |
void |
setWSet(java.util.List<LogicTuple> set) |
boolean |
spawnActivity(Tuple tuple,
IId owner,
IId targetTC) |
boolean |
timeTriggeredReaction() |
boolean |
triggeredReaction() |
void |
updateSpecAfterTimedReaction(TriggeredReaction tr) |
addEnvInputEvent, addInputEvent, doOperation, execute, fetchPendingEnvEvent, fetchPendingEvent, getBootTime, getCurrentEvent, getCurrentState, getCurrentTime, getId, getRespectTC, getState, goCommand, isStepMode, nextStepCommand, notifyException, notifyException, notifyOutputEvent, pendingEnvEvents, pendingEvents, setBootTime, setManagementMode, stopCommand, toggleStepMode
public RespectVMContext(RespectVM rvm, TupleCentreId tid, int queueSize, IRespectTC respectTC)
rvm
- the ReSpecT VM this storage context is managed bytid
- the identifier of the tuple centre managedqueueSize
- the maximum InQ size of the tuple centrerespectTC
- the ReSpecT tuple centres managerpublic static LogicTuple checkReactionSpec(java.lang.String spec)
spec
- the String representation of the ReSpecT specification to
check for syntactic correctnesspublic java.util.List<Tuple> addListTuple(Tuple t)
addListTuple
in class AbstractTupleCentreVMContext
t
- the tuple representing the list of tuples to addpublic void addPendingQueryEvent(InputEvent w)
AbstractTupleCentreVMContext
addPendingQueryEvent
in class AbstractTupleCentreVMContext
w
- the pending query to be addedpublic void addSpecTuple(Tuple t)
AbstractTupleCentreVMContext
addSpecTuple
in class AbstractTupleCentreVMContext
t
- the tuple to be addedpublic void addTemporaryOutputEvent(InputEvent out)
out
- the out-link event to be rememberedpublic void addTuple(Tuple t, boolean update)
AbstractTupleCentreVMContext
addTuple
in class AbstractTupleCentreVMContext
t
- the tuple to be addeddupdate
- a flag indicating wether a persistency update is duepublic void closePersistencyUpdates()
public void disablePersistency(java.lang.String path, TucsonTupleCentreId fileName)
path
- the path where persistency information is storedfileName
- the name of the file where persistency information is storedpublic void emptyTupleSet()
AbstractTupleCentreVMContext
emptyTupleSet
in class AbstractTupleCentreVMContext
public void enablePersistency(java.lang.String path, TucsonTupleCentreId fileName)
path
- the path where to store persistency informationfileName
- the name of the file to create for storing persistency
informationpublic void evalReaction(TriggeredReaction z)
AbstractTupleCentreVMContext
evalReaction
in class AbstractTupleCentreVMContext
z
- the triggered reaction to be evaluatedpublic void fetchTimedReactions(AbstractEvent ev)
AbstractTupleCentreVMContext
fetchTimedReactions
in class AbstractTupleCentreVMContext
ev
- the event triggering reactionspublic void fetchTriggeredReactions(AbstractEvent ev)
AbstractTupleCentreVMContext
fetchTriggeredReactions
in class AbstractTupleCentreVMContext
ev
- the event triggering reactionspublic java.util.Iterator<alice.tuprolog.Term> findTimeReactions()
public java.util.List<Tuple> getAllTuples()
AbstractTupleCentreVMContext
getAllTuples
in class AbstractTupleCentreVMContext
public AbstractEvent getCurrentReactionEvent()
public alice.tuprolog.Struct getCurrentReactionTerm()
public java.util.Iterator<? extends AbstractEvent> getPendingQuerySetIterator()
AbstractTupleCentreVMContext
getPendingQuerySetIterator
in class AbstractTupleCentreVMContext
public alice.tuprolog.Prolog getPrologCore()
public java.util.Iterator<? extends Tuple> getPrologPredicatesIterator()
public AbstractBehaviourSpecification getReactionSpec()
public RespectVM getRespectVM()
public java.util.Iterator<LogicTuple> getSpecTupleSetIterator()
getSpecTupleSetIterator
in class AbstractTupleCentreVMContext
public java.util.Iterator<? extends TriggeredReaction> getTriggeredReactionSetIterator()
AbstractTupleCentreVMContext
getTriggeredReactionSetIterator
in class AbstractTupleCentreVMContext
public LogicTuple[] getTRSet()
public LogicTuple[] getTSet(LogicTuple filter)
filter
- the tuple template to be used in filtering stored tuplespublic java.util.Iterator<LogicTuple> getTupleSetIterator()
AbstractTupleCentreVMContext
getTupleSetIterator
in class AbstractTupleCentreVMContext
public WSetEvent[] getWSet(LogicTuple filter)
filter
- the tuple template to be used in filtering InQ eventspublic java.util.List<Tuple> inAllTuples(TupleTemplate t)
AbstractTupleCentreVMContext
inAllTuples
in class AbstractTupleCentreVMContext
t
- the tuple template to be usedpublic void linkOperation(OutputEvent oe)
linkOperation
in class AbstractTupleCentreVMContext
oe
- the output event generated due to a linking operationpublic void notifyInputEnvEvent(InputEvent in)
in
- the environmental input event to notifypublic void notifyInputEvent(InputEvent in)
in
- the input event to notifypublic void notifyNewInputEvent()
public java.util.List<Tuple> readAllTuples(TupleTemplate t)
AbstractTupleCentreVMContext
readAllTuples
in class AbstractTupleCentreVMContext
t
- the tuple template to be usedpublic Tuple readMatchingSpecTuple(TupleTemplate t)
readMatchingSpecTuple
in class AbstractTupleCentreVMContext
t
- the tuple template to be usedpublic Tuple readMatchingTuple(TupleTemplate t)
AbstractTupleCentreVMContext
readMatchingTuple
in class AbstractTupleCentreVMContext
t
- the tuple template that must be matched by the tuplepublic Tuple readUniformTuple(TupleTemplate t)
AbstractTupleCentreVMContext
readUniformTuple
in class AbstractTupleCentreVMContext
t
- the tuple template to be usedpublic void recoveryPersistent(java.lang.String path, java.lang.String file, TucsonTupleCentreId tcName)
path
- the path where persistency information is storedfile
- the name of the file where persistency information is storedtcName
- the name of the tuple centre to be recoveredpublic Tuple removeMatchingSpecTuple(TupleTemplate t)
removeMatchingSpecTuple
in class AbstractTupleCentreVMContext
t
- the tuple template to be usedpublic Tuple removeMatchingTuple(TupleTemplate t, boolean update)
AbstractTupleCentreVMContext
removeMatchingTuple
in class AbstractTupleCentreVMContext
t
- the tuple template that must be matched by the tupleupdate
- a flag indicating wether a persistency update is duepublic boolean removePendingQueryEvent(long operationId)
operationId
- identifier of the operationpublic void removePendingQueryEventsOf(AgentId id)
removePendingQueryEventsOf
in class AbstractTupleCentreVMContext
id
- the identifier of the agent whose events must be removedpublic void removeReactionSpec()
public TriggeredReaction removeTimeTriggeredReaction()
AbstractTupleCentreVMContext
removeTimeTriggeredReaction
in class AbstractTupleCentreVMContext
public TriggeredReaction removeTriggeredReaction()
AbstractTupleCentreVMContext
removeTriggeredReaction
in class AbstractTupleCentreVMContext
public Tuple removeUniformTuple(TupleTemplate t)
AbstractTupleCentreVMContext
removeUniformTuple
in class AbstractTupleCentreVMContext
t
- the tuple template to be usedpublic final void reset()
reset
in class AbstractTupleCentreVMContext
public void setAllSpecTuples(java.util.List<Tuple> tupleList)
setAllSpecTuples
in class AbstractTupleCentreVMContext
tupleList
- the list of tuples representing ReSpecT specification argument
of the operationpublic void setAllTuples(java.util.List<Tuple> tupleList)
AbstractTupleCentreVMContext
setAllTuples
in class AbstractTupleCentreVMContext
tupleList
- the list of tuples argument of the operationpublic boolean setReactionSpec(AbstractBehaviourSpecification spec)
spec
- the ReSpecT specification to setpublic void setWSet(java.util.List<LogicTuple> set)
set
- the list of tuple representing InQ events to overwrite this
InQ withpublic boolean spawnActivity(Tuple tuple, IId owner, IId targetTC)
spawnActivity
in class AbstractTupleCentreVMContext
tuple
- the tuple representing the computational activity to launchowner
- the identifier of the owner of the operationtargetTC
- the identifier of the tuple centre target of the operationpublic boolean timeTriggeredReaction()
timeTriggeredReaction
in class AbstractTupleCentreVMContext
public boolean triggeredReaction()
triggeredReaction
in class AbstractTupleCentreVMContext
public void updateSpecAfterTimedReaction(TriggeredReaction tr)
updateSpecAfterTimedReaction
in class AbstractTupleCentreVMContext
tr
- the ReSpecT specification to triggerprotected boolean addReactionSpecHelper(AbstractBehaviourSpecification spec)
spec
- the ReSpecT specification to be added to this ReSpecT VM
storage contextprotected boolean setReactionSpecHelper(AbstractBehaviourSpecification spec)
spec
- the ReSpecT specification to overwrite this ReSpecT VM one
with