Package maelstrom.funge.interpreter.stack

Examples of maelstrom.funge.interpreter.stack.Stack


        while (Character.isDigit((char)in)) {
          text = text + (char)in;
          in = System.in.read();
        }

        Stack stack = funge.getStackStack().getStack();
        stack.push(Long.parseLong(text));
      } catch (IOException err) {
        //TODO: Handle this exception as per spec
        err.printStackTrace();
      }
    }
View Full Code Here


    /**
     * Gets a value from the grid, pushes it to the stack
     */
    public void perform(Funge funge) {

      Stack stack = funge.getStack();
      long y = stack.pop();
      long x = stack.pop();

      long gridVal = funge.getGrid().get((int) x, (int) y);

      stack.push(gridVal);
    }
View Full Code Here

    /**
     * Sets a value in the grid.
     */
    public void perform(Funge funge) {

      Stack stack = funge.getStack();
      long y = stack.pop();
      long x = stack.pop();
      long c = stack.pop();

      funge.getGrid().set((int) x, (int) y, c);
    }
View Full Code Here

  // Clones the first element on the stack
  public static class Clone implements Operator {

    public void perform(Funge funge) {
      Stack stack = funge.getStackStack().getStack();
      long a = stack.pop();
      stack.push(a);
      stack.push(a);
    }
View Full Code Here

  // Swaps the first two values on the stack
  public static class Swap implements Operator {

    public void perform(Funge funge) {
      Stack stack = funge.getStackStack().getStack();
      long b = stack.pop();
      long a = stack.pop();

      stack.push(b);
      stack.push(a);
    }
View Full Code Here

  // Pops and discards a value off the stack
  public static class Pop implements Operator {

    public void perform(Funge funge) {
      Stack stack = funge.getStackStack().getStack();
      stack.pop();
    }
View Full Code Here

  // Empties the stack
  public static class Empty implements Operator {

    public void perform(Funge funge) {
      Stack stack = funge.getStackStack().getStack();
      stack.clear();
    }
View Full Code Here

TOP

Related Classes of maelstrom.funge.interpreter.stack.Stack

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.