?? new.java
字號:
package AM.vm_impl.instruction;
import java.io.*;
import AM.am_data_structure.*;
import AM.vm_impl.util.*;
import AM.vm_impl.vm_data_structure.*;
/**
* Created by IntelliJ IDEA. User: yellowicq Date: 2004-4-27 Time: 14:48:58
* To change this template use File | Settings | File Templates.
*/
public class NEW
implements Instruction {
private String className;
private NEW() {}
public NEW(String className) {
this.className = className;
}
public String Name() {
return "new";
}
public int NumArguments() {
return 1;
}
public String ToString() {
return Name();
}
public void SI(AbstractMachineState state) {
Tracer.debug("SI new");
Class clazz = null;
Object object = null;
VM_DataArea VM_da = (VM_DataArea) state.getDataArea();
VM_Program VM_prog = (VM_Program) state.getProgram();
try {
clazz = new SystemClassLoader(".." + File.separatorChar + ".." +
File.separatorChar +
"..").loadClass(className);
if (clazz == null) {
throw new ClassNotFoundException("Class is null");
}
object = clazz.newInstance();
VM_da.methodArea.addClassMapping(className, clazz);
VM_da.heap.addObjectMapping(className, object);
}
catch (ClassNotFoundException ex) {
ex.printStackTrace();
}
catch (IllegalAccessException ex) {
ex.printStackTrace();
}
catch (InstantiationException ex) {
ex.printStackTrace();
}
//////////////////////////////////////////////
//push the new constructed object to stack top
VM_da.stackFrame.push(object);
//move the cp pointer to next
synchronized (this) {
VM_prog.Next();
VM_da.regs.setCP_GLOBAL(VM_prog.Consult_CP());
}
}
public void Process(String args[]) {
// Proces the text representation of the instruction
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -