⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 memory.java

📁 symbman(大学作业)
💻 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 + -