Instruction Class Next: UnaryInstruction ClassUp: InstructionsPrevious: Instructions

Instruction Class

The Instruction  class has the following structure :

 
abstract public class Instruction
implements ReturnCodes, Cloneable
{
  protected boolean terminated = false;

  public void reset(){ terminated = false; }
  final public void terminate(){ terminated = true; }
  final public boolean isTerminated(){ return terminated; }

  abstract protected byte activation(Machine machine);
  final public byte activ(Machine machine)
  {
    if (terminated){ return TERM; }
    byte res = activation(machine);
    if (res == TERM){ terminated = true; }
    return res;
  }

  public boolean equals(Instruction inst){
    return this.getClass() == inst.getClass();
  }
  abstract public String toString();
  public Object clone(){ ... }
}

Note that activ and activation have a parameter which is the reactive machine running the instruction. Reactive machines are described in section 2.2.