diff options
author | Shawn O. Pearce <sop@google.com> | 2011-06-06 08:53:19 -0700 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2011-06-06 09:18:36 -0700 |
commit | 2c79eeb3b3f624be5df13f4af2eed852bdc31886 (patch) | |
tree | 29902992e04aceb91c876285b885e149069ac103 | |
parent | cacc2414eb49d66126403e880d9ea7740612ddf6 (diff) | |
download | prolog-cafe-2c79eeb3b3f624be5df13f4af2eed852bdc31886.tar.gz |
Add makeSymbol to include package name
-rw-r--r-- | src/lang/SymbolTerm.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lang/SymbolTerm.java b/src/lang/SymbolTerm.java index 442e9f1..02b920d 100644 --- a/src/lang/SymbolTerm.java +++ b/src/lang/SymbolTerm.java @@ -14,10 +14,11 @@ import java.util.concurrent.ConcurrentHashMap; * @version 1.0 */ public class SymbolTerm extends Term { - /** Symbol table. */ protected static final ConcurrentHashMap<String,SymbolTerm> SYMBOL_TABLE = new ConcurrentHashMap<String,SymbolTerm>(); + private static final SymbolTerm colon2 = makeSymbol(":", 2); + /** Holds a string representation of this <code>SymbolTerm</code>. */ protected String name; @@ -30,6 +31,11 @@ public class SymbolTerm extends Term { } /** Returns a Prolog functor for the given name and arity. */ + public static StructureTerm makeSymbol(String pkg, String name, int arity) { + return new StructureTerm(colon2, makeSymbol(pkg), makeSymbol(name, arity)); + } + + /** Returns a Prolog functor for the given name and arity. */ public static SymbolTerm makeSymbol(String _name, int _arity) { String key = _name + "/" + _arity; SymbolTerm sym = SYMBOL_TABLE.get(key); |