gnu.mapping
Class Namespace
- Externalizable
public class Namespace
extends java.lang.Object
implements Externalizable
A mapping from strings ("print names") to Symbol
s.
Namespaces are normally named and can be accessed from a global table.
They correspond to Common Lisp "packages" (which are implemented
using gnu.kawa.lispexpr.LispPackage
,
which extends Namespace
).
A Namespace
is a "weak" mapping in the sense that a
Symbol
can be garbage collected even though it is
referenced from a Namespace
.
EmptyNamespace
public static final Namespace EmptyNamespace
The Namespace with the empty name.
table
protected gnu.mapping.SymbolRef[] table
Namespace
public Namespace()
Namespace
protected Namespace(String name,
int dummy)
A kludge used for serializing SName.
Namespace
public Namespace(int capacity)
getDefault
public static Namespace getDefault()
getDefaultSymbol
public static Symbol getDefaultSymbol(String name)
getInstance
public static Namespace getInstance(String name)
getName
public final String getName()
Get the name of this Namespace.
getSymbol
public Symbol getSymbol(String key)
Get a Symbol matching the given name.
Creates a new Symbol if one is not found.
Equivalent to Common Lisp's "intern" function.
lookup
public Symbol lookup(String key)
Get a Symbol matching the given name.
Returns null if one is not found.
lookup
public Symbol lookup(String key,
int hash,
boolean create)
lookupInternal
protected final Symbol lookupInternal(String key,
int hash)
readExternal
public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
readResolve
public Object readResolve()
throws ObjectStreamException
rehash
protected void rehash()
remove
public boolean remove(Symbol symbol)
setName
public final void setName(String name)
Set the name of this Namespace.
toString
public String toString()
writeExternal
public void writeExternal(ObjectOutput out)
throws IOException