public abstract class AbstractTupleCentreVMContext extends java.lang.Object implements ITupleCentreManagement, ITupleCentre
Constructor and Description |
---|
AbstractTupleCentreVMContext(RespectVM vm,
TupleCentreId id,
int ieSize,
IRespectTC rtc)
Creates a new tuple centre virtual machine core
|
Modifier and Type | Method and Description |
---|---|
void |
addEnvInputEvent(InputEvent in) |
void |
addInputEvent(InputEvent in) |
abstract java.util.List<Tuple> |
addListTuple(Tuple t) |
abstract void |
addPendingQueryEvent(InputEvent w)
Adds a query to the pending query set (W) of the tuple centre
|
abstract void |
addSpecTuple(Tuple t)
Adds a tuple to the specification tuple set
|
abstract void |
addTuple(Tuple t,
boolean u)
Adds a tuple to the tuple set (T)
|
void |
doOperation(IId who,
AbstractTupleCentreOperation op) |
abstract void |
emptyTupleSet()
Removes all tuples
|
abstract void |
evalReaction(TriggeredReaction z)
Evaluates a triggered reaction, changing the state of the VM accordingly.
|
void |
execute()
Executes a virtual machine behaviour cycle
|
void |
fetchPendingEnvEvent() |
void |
fetchPendingEvent()
Fetches a new pending input event.
|
abstract void |
fetchTimedReactions(AbstractEvent ev)
Collects the time-triggered reactions
|
abstract void |
fetchTriggeredReactions(AbstractEvent ev)
Collects the reactions that are triggered by an event
|
abstract java.util.List<Tuple> |
getAllTuples()
Gets all the tuples of the tuple centre
|
long |
getBootTime()
Gets the boot time of the Tuple Centre VM
The time is expressed in millisecond, according to the standard Java
measurement of time.
|
InputEvent |
getCurrentEvent()
Gets the event currently processed by the virtual machine
|
java.lang.String |
getCurrentState() |
long |
getCurrentTime()
Gets current time of the Tuple Centre VM
The time is expressed in millisecond, according to the standard Java
measurement of time.
|
TupleCentreId |
getId()
Gets the identifier of this tuple centre
|
abstract java.util.Iterator<? extends AbstractEvent> |
getPendingQuerySetIterator()
Gets an iterator over the pending query set (W)
|
IRespectTC |
getRespectTC() |
abstract java.util.Iterator<? extends Tuple> |
getSpecTupleSetIterator() |
AbstractTupleCentreVMState |
getState(java.lang.String stateName)
Gets a state of tuple centre virtual machine.
|
abstract java.util.Iterator<? extends TriggeredReaction> |
getTriggeredReactionSetIterator()
Gets an iterator over the set of triggered reactions
|
abstract java.util.Iterator<? extends Tuple> |
getTupleSetIterator()
Gets an iterator over the tuple set (T)
|
void |
goCommand() |
abstract java.util.List<Tuple> |
inAllTuples(TupleTemplate t)
Gets all the tuples of the tuple centre matching the TupleTemplate t
|
boolean |
isStepMode()
verify if stepMode is active or not
|
abstract void |
linkOperation(OutputEvent out) |
void |
nextStepCommand() |
void |
notifyException(java.lang.Exception e) |
void |
notifyException(java.lang.String ex) |
protected void |
notifyOutputEvent(OutputEvent ev)
Specifies how to notify an output event.
|
boolean |
pendingEnvEvents() |
boolean |
pendingEvents()
Tests if there are pending input events
The method tests in there are input events to be processed (or rather if
the input event queue is not empty)
|
abstract java.util.List<Tuple> |
readAllTuples(TupleTemplate t)
Gets all the tuples of the tuple centre matching the TupleTemplate t
without removing them
|
abstract Tuple |
readMatchingSpecTuple(TupleTemplate templateArgument) |
abstract Tuple |
readMatchingTuple(TupleTemplate t)
Gets (not deterministically) without removing from the tuple set a tuple
that matches with the provided tuple template
|
abstract Tuple |
readUniformTuple(TupleTemplate t)
Gets a tuple from tuple space in a non deterministic way
|
abstract Tuple |
removeMatchingSpecTuple(TupleTemplate templateArgument) |
abstract Tuple |
removeMatchingTuple(TupleTemplate t,
boolean u)
Removes (not deterministically) from the tuple set a tuple that matches
with the provided tuple template
|
abstract void |
removePendingQueryEventsOf(AgentId id)
Removes the pending queries related to an agent
|
abstract TriggeredReaction |
removeTimeTriggeredReaction()
Removes a time-triggered reaction, previously fetched
|
abstract TriggeredReaction |
removeTriggeredReaction()
Removes a triggered reaction, previously fetched
|
abstract Tuple |
removeUniformTuple(TupleTemplate t)
Gets a tuple from tuple space in a non deterministic way
|
abstract void |
reset()
Resets the tuple centre vm core.
|
abstract void |
setAllSpecTuples(java.util.List<Tuple> tupleList) |
abstract void |
setAllTuples(java.util.List<Tuple> tupleList)
Gets all the tuples of the tuple centre
|
protected void |
setBootTime() |
void |
setManagementMode(boolean activate)
old
|
abstract boolean |
spawnActivity(Tuple t,
IId owner,
IId targetTC) |
void |
stopCommand() |
abstract boolean |
timeTriggeredReaction() |
boolean |
toggleStepMode()
toggles step mode (defaults to
false ) |
abstract boolean |
triggeredReaction() |
abstract void |
updateSpecAfterTimedReaction(TriggeredReaction tr) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getReactionSpec, setReactionSpec
public AbstractTupleCentreVMContext(RespectVM vm, TupleCentreId id, int ieSize, IRespectTC rtc)
vm
- is the ReSpecT virtual machineid
- is the tuple centre identifierieSize
- is the size of the input event queuertc
- the ReSpecT tuple centre this VM refers topublic void addEnvInputEvent(InputEvent in)
in
- the input envirnomental event to add to the environmental
queuepublic void addInputEvent(InputEvent in)
in
- the input event to add to the input queuepublic abstract java.util.List<Tuple> addListTuple(Tuple t)
t
- the tuple representing the list of tuples to addpublic abstract void addPendingQueryEvent(InputEvent w)
w
- the pending query to be addedpublic abstract void addSpecTuple(Tuple t)
t
- the tuple to be addedpublic abstract void addTuple(Tuple t, boolean u)
t
- the tuple to be addeddu
- a flag indicating wether a persistency update is duepublic void doOperation(IId who, AbstractTupleCentreOperation op) throws OperationNotPossibleException
doOperation
in interface ITupleCentre
who
- the identifier of the requestor of the operationop
- the operation requestedOperationNotPossibleException
- if the operation cannot be performedpublic abstract void emptyTupleSet()
public abstract void evalReaction(TriggeredReaction z)
z
- the triggered reaction to be evaluatedpublic void execute()
public void fetchPendingEnvEvent()
public void fetchPendingEvent()
public abstract void fetchTimedReactions(AbstractEvent ev)
ev
- the event triggering reactionspublic abstract void fetchTriggeredReactions(AbstractEvent ev)
ev
- the event triggering reactionspublic abstract java.util.List<Tuple> getAllTuples()
public long getBootTime()
public InputEvent getCurrentEvent()
public java.lang.String getCurrentState()
public long getCurrentTime()
public TupleCentreId getId()
public abstract java.util.Iterator<? extends AbstractEvent> getPendingQuerySetIterator()
public IRespectTC getRespectTC()
public abstract java.util.Iterator<? extends Tuple> getSpecTupleSetIterator()
public AbstractTupleCentreVMState getState(java.lang.String stateName)
stateName
- name of the statepublic abstract java.util.Iterator<? extends TriggeredReaction> getTriggeredReactionSetIterator()
public abstract java.util.Iterator<? extends Tuple> getTupleSetIterator()
public void goCommand() throws OperationNotPossibleException
goCommand
in interface ITupleCentreManagement
OperationNotPossibleException
- if the operation cannot be performedpublic abstract java.util.List<Tuple> inAllTuples(TupleTemplate t)
t
- the tuple template to be usedpublic boolean isStepMode()
ITupleCentreManagement
isStepMode
in interface ITupleCentreManagement
public abstract void linkOperation(OutputEvent out)
out
- the output event generated due to a linking operationpublic void nextStepCommand() throws OperationNotPossibleException
nextStepCommand
in interface ITupleCentreManagement
OperationNotPossibleException
- if the operation cannot be performedpublic void notifyException(java.lang.Exception e)
e
- the Exception to notifypublic void notifyException(java.lang.String ex)
ex
- the String representation of the Exception to notifypublic boolean pendingEnvEvents()
public boolean pendingEvents()
public abstract java.util.List<Tuple> readAllTuples(TupleTemplate t)
t
- the tuple template to be usedpublic abstract Tuple readMatchingSpecTuple(TupleTemplate templateArgument)
templateArgument
- the tuple template to be usedpublic abstract Tuple readMatchingTuple(TupleTemplate t)
t
- the tuple template that must be matched by the tuplepublic abstract Tuple readUniformTuple(TupleTemplate t)
t
- the tuple template to be usedpublic abstract Tuple removeMatchingSpecTuple(TupleTemplate templateArgument)
templateArgument
- the tuple template to be usedpublic abstract Tuple removeMatchingTuple(TupleTemplate t, boolean u)
t
- the tuple template that must be matched by the tupleu
- a flag indicating wether a persistency update is duepublic abstract void removePendingQueryEventsOf(AgentId id)
id
- is the agent identifiespublic abstract TriggeredReaction removeTimeTriggeredReaction()
public abstract TriggeredReaction removeTriggeredReaction()
public abstract Tuple removeUniformTuple(TupleTemplate t)
t
- the tuple template to be usedpublic abstract void reset()
public abstract void setAllSpecTuples(java.util.List<Tuple> tupleList)
tupleList
- the list of tuples representing ReSpecT specification argument
of the operationpublic abstract void setAllTuples(java.util.List<Tuple> tupleList)
tupleList
- the list of tuples argument of the operationpublic void setManagementMode(boolean activate)
ITupleCentreManagement
setManagementMode
in interface ITupleCentreManagement
activate
- wether the 'management mode' should be activated or notpublic abstract boolean spawnActivity(Tuple t, IId owner, IId targetTC)
t
- 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 void stopCommand() throws OperationNotPossibleException
stopCommand
in interface ITupleCentreManagement
OperationNotPossibleException
- if the operation cannot be performedpublic abstract boolean timeTriggeredReaction()
public boolean toggleStepMode()
ITupleCentreManagement
false
)toggleStepMode
in interface ITupleCentreManagement
public abstract boolean triggeredReaction()
public abstract void updateSpecAfterTimedReaction(TriggeredReaction tr)
tr
- the ReSpecT specification to triggerprotected void notifyOutputEvent(OutputEvent ev)
ev
- the output event to notifyprotected void setBootTime()