package name.panitz.fun4u.machine;

public class CaseJump implements Instruction {
	public int jump;
	
	public CaseJump(int jump) {
		super();
		this.jump = jump;
	}

	@Override
	public void execute(Kellermaschine kellermaschine) {
		int top 
		 = ((IntO)(kellermaschine.heap
			 [kellermaschine.keller.pop()])).n;
		
		if (top==0) kellermaschine.pc=kellermaschine.pc+jump;
		else kellermaschine.pc=kellermaschine.pc+1;
	}
	@Override
	public String toString() {
		return super.toString()+" "+jump;
	}

}
