code.instr
Class Branch

java.lang.Object
  extended by code.instr.Branch
All Implemented Interfaces:
Instruction

public class Branch
extends java.lang.Object
implements Instruction

Execute a goto -like instruction of the virtual machine code. This instruction tests the root symbol of the register of the virtual machine. The next instruction to be executed depends on whether the root symbol is a variable, a defined operation or a data constructor.

Since:
June 17, 2003
Author:
Sergio Antoy

Field Summary
private  Instruction[][] dispatch
           
private static int numSpace
          data to help the PrintAsTxtLoadable method.
 
Constructor Summary
Branch(Instruction[][] dispatch)
          Constructor for the Branch object
 
Method Summary
 void execute(Computation computation)
          This method executes whatever is intended by the Instruction.
 Instruction[][] getDispatch()
           
private  java.lang.String indent()
           
 java.lang.String printAsTxtLoadable()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dispatch

private final Instruction[][] dispatch

numSpace

private static int numSpace
data to help the PrintAsTxtLoadable method.

Constructor Detail

Branch

public Branch(Instruction[][] dispatch)
Constructor for the Branch object

Parameters:
dispatch - An array of arrays of instructions. Either (1) one of the nested array of instructions will be executed depending on the root symbol of the term contained in the register (current) of the virtual machine, or (2) if the root symbol is an operation, the term in the register must be evaluated instead.
Method Detail

execute

public void execute(Computation computation)
Description copied from interface: Instruction
This method executes whatever is intended by the Instruction.

Specified by:
execute in interface Instruction
Parameters:
computation - The instruction is executed in the context of this Computation.

printAsTxtLoadable

public java.lang.String printAsTxtLoadable()
Specified by:
printAsTxtLoadable in interface Instruction

indent

private java.lang.String indent()

getDispatch

public Instruction[][] getDispatch()