alice.tuplemedium
Class TupleCentreVM

java.lang.Object
  |
  +--alice.tuplemedium.TupleCentreVM
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
TupleCentreVMImpl

public abstract class TupleCentreVM
extends java.lang.Object
implements java.lang.Runnable

Defines the core behaviour of a tuple centre virtual machine. The behaviour reflects the operational semantic expressed in related tuple centre articles. It is abstract because it not specifies how the output events are dispatched. Note that in order to specify a concrete virtual machine, concrete object implementing TupleSet, EventSet, TRSet, Reactor, Reaction must be specified.

See Also:
Reactor, TupleSet, EventSet, TRSet

Field Summary
protected  long bootTime
          tuple centre boot time in ms
protected  java.util.ArrayList inputEvents
          input event queue
protected  EventSet outputEventSet
          multiset of not satisfiable pending queries Wn - W/(Wn+Wp)
protected  Tuple reactionSpec
          reactions specification (tuple centre reaction behaviour)
protected  Reactor reactor
          reactions manager
protected  TupleSet tSet
          multiset of tuples T
protected  EventSet wnSet
          multiset of not satisfiable pending queries Wn - W/(Wn+Wp)
protected  EventSet wpSet
          multiset of satisfiable pending queries Wp - predicatives (inp,rdp)
protected  EventSet wsSet
          multiset of satisfiable pending queries Ws - not predicatives (in,rd)
protected  TRSet zSet
          multiset of triggered reactions Z
 
Constructor Summary
TupleCentreVM()
           
 
Method Summary
 void acceptEvent(Event ev)
          Accepts a communication event It is the input service of the tuple centre machine, the only way to make the virtual machine aware of an external event to be processed.
 void addObservableEventListener(ObservableEventListener l)
          Registers a new listener to observable events
 void fetchTriggeredReactions(Event ev)
          Collects triggered reaction in zSet
 long getBootTime()
          gets virtual machine boot time
 long getCurrentTime()
          gets current virtual machine time
 Reactor getReactor()
          gets raective component of the vm
 TRSet getTRSet()
          gets triggered event set
 TupleSet getTSet()
          gets tuple set
 EventSet getWnSet()
          gets unsatisfied event set
 void notifyObservableEvent(ObservableEvent e)
          Notifies registered listeners of a new observable event
protected abstract  void notifyOutputEvents()
          Specifies how to dispatch output events (collected in outputEventSet) to related agents
 void removeEventsOf(AgentId id)
          Removes all events of specified agent This services is executed in paraller to the virtual machine thread of control.
 void removeObservableEventListener(ObservableEventListener l)
          Removes (if present) a listener to observable events
 void reset()
          resets the virtual machine to boot state
 void run()
          Expresses the behaviour of the thread of control of the virtual machine
 void spy(java.lang.String m)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bootTime

protected long bootTime
tuple centre boot time in ms

tSet

protected TupleSet tSet
multiset of tuples T

wpSet

protected EventSet wpSet
multiset of satisfiable pending queries Wp - predicatives (inp,rdp)

wsSet

protected EventSet wsSet
multiset of satisfiable pending queries Ws - not predicatives (in,rd)

wnSet

protected EventSet wnSet
multiset of not satisfiable pending queries Wn - W/(Wn+Wp)

zSet

protected TRSet zSet
multiset of triggered reactions Z

inputEvents

protected java.util.ArrayList inputEvents
input event queue

outputEventSet

protected EventSet outputEventSet
multiset of not satisfiable pending queries Wn - W/(Wn+Wp)

reactionSpec

protected Tuple reactionSpec
reactions specification (tuple centre reaction behaviour)

reactor

protected Reactor reactor
reactions manager
Constructor Detail

TupleCentreVM

public TupleCentreVM()
Method Detail

notifyOutputEvents

protected abstract void notifyOutputEvents()
Specifies how to dispatch output events (collected in outputEventSet) to related agents

acceptEvent

public final void acceptEvent(Event ev)
Accepts a communication event It is the input service of the tuple centre machine, the only way to make the virtual machine aware of an external event to be processed. The event is placed in the satisfiable list or notSatisfiable list, according to the current tuple space state This service is executed concurrently to the thread of control of the tuple centre virtual machine, so it requires synchronization.
Parameters:
ev - the input (communication) event

removeEventsOf

public final void removeEventsOf(AgentId id)
Removes all events of specified agent This services is executed in paraller to the virtual machine thread of control.
Parameters:
id - the identifier of the agent whose events must be removed

run

public final void run()
Expresses the behaviour of the thread of control of the virtual machine
Specified by:
run in interface java.lang.Runnable

fetchTriggeredReactions

public final void fetchTriggeredReactions(Event ev)
Collects triggered reaction in zSet
Parameters:
ev - the event triggering reactions

notifyObservableEvent

public final void notifyObservableEvent(ObservableEvent e)
Notifies registered listeners of a new observable event
Parameters:
e - the observable event

addObservableEventListener

public final void addObservableEventListener(ObservableEventListener l)
Registers a new listener to observable events
Parameters:
l - the listener to be notified

removeObservableEventListener

public final void removeObservableEventListener(ObservableEventListener l)
Removes (if present) a listener to observable events
Parameters:
l - the listener to be removed

getBootTime

public final long getBootTime()
gets virtual machine boot time

getCurrentTime

public final long getCurrentTime()
gets current virtual machine time

getTSet

public final TupleSet getTSet()
gets tuple set

getWnSet

public final EventSet getWnSet()
gets unsatisfied event set

getTRSet

public final TRSet getTRSet()
gets triggered event set

getReactor

public final Reactor getReactor()
gets raective component of the vm

spy

public void spy(java.lang.String m)

reset

public final void reset()
resets the virtual machine to boot state