public override void Execute(EnumJavaOpCode opCode, object operand) { JavaInstruction instruction = _javaInstructionTable.GetInstruction(opCode); instruction.SetOperands(operand); System.Diagnostics.Debug.WriteLine(instruction.ToString()); }
public JavaInstruction(char opcode, string mnemonic, string description, object operand) { _op_code = (EnumJavaOpCode)opcode; _mnemonic = mnemonic; _description = description; _operand = operand; }
public JavaInstruction GetInstruction(EnumJavaOpCode opCode) { JavaInstruction result = null; _table.TryGetValue((int)opCode, out result); result = result.Clone(); if (result == null) { throw new NullReferenceException("No instruction exists"); } return(result); }
//private static volatile AbstractInterpreter _executor = null; //private static readonly object _obj = new Object(); #endregion #region public method /////<summary> ///// Use the singleton pattern to create a unique object in the runtime /////<summary> //public static AbstractInterpreter GetInstance() //{ // if(_executor == null) // { // lock(_obj) // { // if(_executor == null) // { // _executor = GetExecutor(); // } // } // } // return _executor; //} #endregion #region public abstract methods /// <summary> /// 执行Java指令 /// </summary> /// <param name="instruction"></param> public abstract void Execute(EnumJavaOpCode opcode, object operand);