BinaryInstruction Class Next: MachinesUp: InstructionsPrevious: UnaryInstruction Class

BinaryInstruction Class

BinaryInstruction  is an abstract class which extends Instruction and has two components left and right which are also instructions.

 
abstract public class BinaryInstruction extends Instruction
{
  protected Instruction left, right;

  public void reset(){ 
    super.reset(); left.reset(); right.reset(); 
  }
  public boolean equals(Instruction inst){
    return  super.equals(inst) &&
            left.equals (((BinaryInstruction)inst).left) &&
            right.equals(((BinaryInstruction)inst).right);
  }
  public Object clone()
  {
    BinaryInstruction bin = (BinaryInstruction)super.clone();
    bin.left  = (Instruction)left.clone();
    bin.right = (Instruction)right.clone();
    return bin;
  }
}