Java源码

源代码在线查看: abstractprogram.java~4~

软件大小: 377 K
上传用户: qq569854
关键词: Java 源码
下载地址: 免注册下载 普通下载 VIP

相关代码

				package AM.am_data_structure;
				/**
				 * Created by IntelliJ IDEA. User: yellowicq Date: 2004-4-27 Time: 12:25:10
				 * To change this template use File | Settings | File Templates.
				 */
				import java.util.Vector;
				import AM.vm_impl.util.Tracer;
				
				public abstract class AbstractProgram implements Program {
				    public int CP;
				    private Vector program; // A container of AbstractInstruction
				    private InstructionSet instSet;
				
				
				    public AbstractProgram(InstructionSet instSet) {
				        this.instSet = instSet;
				    }
				
				    public void LoadProgram(Stream assemblerCode) {
				        // load instructions from the assembler code
				        program = instSet.resolve(assemblerCode);
				        if (program == null) {
				            throw new NullPointerException("Program load failed!");
				        }
				        Tracer.debug("Instruction in program[" + program.size() + "]:" + program.toString());
				    }
				
				    public void Init() {
				        CP = 0;
				        program = new Vector();
				    }
				
				    public Instruction CurrentInst() {
				        return (Instruction)program.get(CP);
				    }
				
				    abstract public boolean Stop();
				
				    public void Next() {
				        CP++;
				    }
				}
							

相关资源