IODecl Class Next: InputDecl Class Up: Event Declarations Previous: EventDecl Class

IODecl Class

Abstract class IODecl  extends UnaryInstruction and defines a scope in which a local event with name internalName is linked to an external event with name externalName. The setInternal method sets the internalName event in the local context, and saveInternal restores its old value.

abstract public class IODecl extends UnaryInstruction
{
  protected String internalName;
  protected String externalName;
  protected Event internal = new Event(internalName);
  protected Event save;

  public void reset(){ 
     super.reset(); internal = new Event(internalName); 
  }

  public Object clone(){ ... }

  final public boolean equals(Instruction inst){
    return  super.equals(inst) && 
      internalName.equals(((IODecl)inst).internalName) &&
      externalName.equals(((IODecl)inst).externalName);
  }

  protected void setInternal(Machine machine){
    save = machine.getEvent(internalName); 
    machine.putEvent(internalName,internal);
  }

  protected void saveInternal(Machine machine){
    internal = machine.getEvent(internalName);       
    machine.putEvent(internalName,save);
  }  
}