📄 memory.java
字号:
import java.util.Hashtable;import java.util.Iterator;import java.util.Map;import java.io.*;public class Memory { private static Hashtable state = new Hashtable(); public static Expression read(Symbol s) { return (Expression)state.get(s.getName()); } public static void write(Symbol s, Expression e) { state.put(s.getName(), e); } public static void dump(String fn) throws IOException { FileOutputStream os = new FileOutputStream(fn); PrintWriter p = new PrintWriter(os); Iterator it = state.entrySet().iterator(); while(it.hasNext()) { Map.Entry m = (Map.Entry)it.next(); p.println((Symbol)m.getKey() + "=" + (Expression)m.getValue()); } p.close(); os.close(); } public static void screenDump() throws IOException { Iterator it = state.entrySet().iterator(); while(it.hasNext()) { Map.Entry m = (Map.Entry)it.next(); System.out.println((String)m.getKey()+"=" + (Expression)m.getValue()); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -