stackframe.java

来自「一个基于J2ME的SCRIPT引擎框架」· Java 代码 · 共 51 行

JAVA
51
字号
package sjg.scripting;import java.util.*;/** * Program stack for script. * * @author Christian Hvid */public class StackFrame {    private Script script;    private int count = 0;    private int wait = 0;    private int programCounter = 0;    private Command currentCommand;    public void newTick() {        count++;    }    public boolean hasNext() {        return // false is we are waiting && false if we are out of commands                ((wait <= count) && (programCounter < script.size()));    }    public Command next() {        currentCommand = script.getCommand(programCounter);        if (currentCommand instanceof Wait) {            count = 0;            wait = ((Wait) currentCommand).getWait();        }        programCounter++;        return currentCommand;    }    public boolean isFinished() {        return (programCounter >= script.size());    }    public Script getScript() {        return script;    }    public StackFrame(Script script) {        this.script = script;        programCounter = 0;    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?