From e364eb71c265255d2843ef8752a30c854f56fefb Mon Sep 17 00:00:00 2001 From: adam Date: Sun, 3 Jul 2005 21:57:19 +0000 Subject: [PATCH] added Context.java darcs-hash:20050703215719-5007d-a726caa366b23bf9ba1b5f4ae6d20f2ab24e3b05.gz --- src/org/ibex/classgen/Context.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/org/ibex/classgen/Context.java diff --git a/src/org/ibex/classgen/Context.java b/src/org/ibex/classgen/Context.java new file mode 100644 index 0000000..99d9819 --- /dev/null +++ b/src/org/ibex/classgen/Context.java @@ -0,0 +1,20 @@ +package org.ibex.classgen; +import java.util.*; + +/** + * a Context is like a ClassLoader in that it maps from class names + * to bytecode-implementations of classes, except that it doesn't + * actually load the resolved class -- it simply creates a (cached) + * ClassFile for it. + */ +public class Context { + + private Hashtable cache = new Hashtable(); + + public Context() { } + + public void add(ClassFile cf) { cache.put(cf.getType().getName(), cf); } + public Collection enumerateClassFiles() { return cache.values(); } + public ClassFile resolve(String classname) { return (ClassFile)cache.get(classname); } + +} -- 1.7.10.4