|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--alice.luce.User
|
+--alice.luce.Agent
|
+--alice.luce.Automaton
Defines a more involved type of LuCe agent (compared to Agent one).
The agent is structured as a finite state automaton.
The behaviour of its states is defined writing public methods;
the become method is used to go make a transition
from state to state, which in this case means from method to method.
It's based on continuation-passing style of arranging computation.
TuCSoN automata are spawned using Threads:
new Thread(new MyAutomaton()).start
the first state (method) executed is always "boot" state (method).
to stop shutdown the automaton the state "end" is provided:
become("end")
Agent, Serialized Form| Field Summary | |
protected static java.lang.Class[] |
argType
arguments class eventually associated to state transition |
protected java.lang.Object[] |
arguments
arguments value eventually associated to state transition |
protected java.lang.String |
state
method name representing state behaviour |
| Constructor Summary | |
Automaton(AgentId id)
Constructs the automaton specifying its identifier |
|
Automaton(java.lang.String name)
Constructs the automaton specifying its name |
|
| Method Summary | |
protected void |
become(java.lang.String s)
Changes the state of the automaton |
protected void |
become(java.lang.String s,
java.lang.Object[] args)
Changes the state of the automaton, providing auciliary information |
abstract void |
boot()
Specifies the behaviour of the automaton in its boot state, which is reached when the automaton start its thread of control |
void |
end()
Specifies the behaviour of the automaton in its end state |
void |
error()
Specifies the behaviour of the automaton in its error state |
void |
run()
Defines the automaton behaviour |
| Methods inherited from class alice.luce.User |
getId, getSpec, in, inp, out, outAsync, rd, rdp, setSpec, shutdown |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.lang.String state
protected java.lang.Object[] arguments
protected static java.lang.Class[] argType
| Constructor Detail |
public Automaton(AgentId id)
id - the automaton identifierpublic Automaton(java.lang.String name)
name - the automaton name| Method Detail |
protected void become(java.lang.String s)
s - the state name, which must coincide with the name
of a public method of the object
protected void become(java.lang.String s,
java.lang.Object[] args)
s - the state name, which must coincide with the name
of a public method of the objectargs - auxiliary information needed in the next statepublic abstract void boot()
public void run()
public void end()
public void error()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||