Behavior extends Atom and its action is to register itself in the RsiMachine (defined in section5.1) which executes it.
A behavior has a body which is an instruction, and it can have event parameters.
New instructions can be put in parallel into a behavior using the add method.
At creation, the actual parameter vector is copied into the array formalParams for efficiency.
public class Behavior extends Atom { protected String behavName; protected Instruction body; protected Param[] formalParams = null; public Behavior (String behavName,Vector paramList, Instruction body) { this.behavName = behavName; this.body = body; if (paramList != null){ formalParams = new Param[paramList.size()]; paramList.copyInto(formalParams); } } public Instruction body(){ return body; } public Param[] formalParams(){ return formalParams; } public void add(Instruction inst){ body = new Merge(body,inst); } final public String toString(){ ... } public Object clone() { Behavior inst = (Behavior)super.clone(); inst.body = (Instruction)body.clone(); return inst; } final protected void action(Machine machine){ ((RsiMachine)machine).behavEnv.newBehav(behavName,this); } }