Exemple #1
0
 @Override
 public void execute(VirtualMachine vm) {
   // tranfer control to the indicated function
   int returnLocation = vm.getPC();
   vm.addReturn(returnLocation);
   vm.setPC(targetAddress);
 }
  public void execute(VirtualMachine vm) {
    int branch = vm.pop();

    if (branch == 0) {
      vm.setPC(symbolicAddress);
    }
  }
 @Override
 public void execute(VirtualMachine vm) {
   if (status.equals("ON")) {
     vm.setDumping(true);
   } else if (status.equals("OFF")) {
     vm.setDumping(false);
   }
 }
  public void execute(VirtualMachine vm) {
    String readStr = JOptionPane.showInputDialog("Enter an integer:");
    Integer i = new Integer(0);
    i = i.parseInt(readStr);

    vm.push(i);

    String tmp = "READ ";
    vm.dump(tmp);
  }
  public void execute(VirtualMachine vm) {

    for (int j = 0; j < i; j++) {
      vm.popRunStack();
    }

    if (vm.isDumpOn()) {
      print();
      vm.dumpRunStack();
    }
  }
  public void execute(VirtualMachine vm) {

    // get an integer from the user
    System.out.print("Please enter in an integer: ");
    try {
      BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
      String line = in.readLine();
      s = Integer.parseInt(line);
    } catch (java.io.IOException ex) {
    }

    vm.pushRunStack(s);

    if (vm.isDumpOn()) {
      print();
      vm.dumpRunStack();
    }
  }
 public void execute(VirtualMachine vm) {
   vm.vmLoad(n);
 }
 public void execute(VirtualMachine vm) {
   int n = vm.vmPeek();
   System.out.println(n);
 }