|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object gnu.mapping.Symbol
public class Symbol
A Symbol is a name, usually in a specific Namespace.
A Symbol is stateless: Comon Lisp-style "value", "function" and
"property list" bindings are not part of the Symbol itself, but
looked up in the current Environment.
A Symbol
may be viewed as an EnvironmentKey
with a null
property component.
Field Summary | |
---|---|
static Symbol |
FUNCTION
Conventional value used as a property key for function bindings. |
protected java.lang.String |
name
|
static Symbol |
PLIST
Conventional value used as a Symbol name to
access an Object 's property list. |
Constructor Summary | |
---|---|
Symbol()
|
|
Symbol(Namespace ns,
java.lang.String name)
Create new Symbol in a given namespace. |
Method Summary | |
---|---|
int |
compareTo(java.lang.Object o)
|
boolean |
equals(java.lang.Object o)
Just tests for identity. |
static boolean |
equals(Symbol sym1,
Symbol sym2)
|
java.lang.Object |
getKeyProperty()
|
Symbol |
getKeySymbol()
|
java.lang.String |
getLocalName()
Synonym for getName - the "print name" of the symbol without Namespace. |
java.lang.String |
getLocalPart()
|
java.lang.String |
getName()
|
Namespace |
getNamespace()
|
java.lang.String |
getNamespaceURI()
|
java.lang.String |
getPrefix()
|
boolean |
hasEmptyNamespace()
|
int |
hashCode()
|
static Symbol |
make(java.lang.Object namespace,
java.lang.String name)
Find or create a symbol in a specificed namespace. |
static Symbol |
make(java.lang.String uri,
java.lang.String name,
java.lang.String prefix)
Find or create a symbol in a specificed namespace. |
static Symbol |
makeUninterned(java.lang.String name)
|
static Symbol |
makeWithUnknownNamespace(java.lang.String local,
java.lang.String prefix)
Make a placeholder symbol with a known prefix and unknown namespace-uri. |
boolean |
matches(EnvironmentKey key)
|
boolean |
matches(Symbol symbol,
java.lang.Object property)
|
static Symbol |
parse(java.lang.String symbol)
Parse a String as a Symbol. |
void |
readExternal(java.io.ObjectInput in)
|
java.lang.Object |
readResolve()
|
void |
setNamespace(Namespace ns)
|
java.lang.String |
toString()
|
void |
writeExternal(java.io.ObjectOutput out)
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.lang.String name
public static final Symbol FUNCTION
public static final Symbol PLIST
Symbol
name to
access an Object
's property list.
A property list is a list with a even number of
Pair
s, containing alternating keys and values.
They are used in Common Lisp and Emacs Lisp.
Kawa (following XEmacs) allows arbitrary objects to have property lists,
thus the PLIST as used as the name and the object as the property.
(In the future we'll do somethingg clever so that get(SYMBOL, KEY)
as the same as getf(get(PLIST, SYMBOL), KEY) - but much faster.)
Constructor Detail |
---|
public Symbol()
public Symbol(Namespace ns, java.lang.String name)
name
- an interned StringMethod Detail |
---|
public final Symbol getKeySymbol()
getKeySymbol
in interface EnvironmentKey
public final java.lang.Object getKeyProperty()
getKeyProperty
in interface EnvironmentKey
public boolean matches(EnvironmentKey key)
matches
in interface EnvironmentKey
public boolean matches(Symbol symbol, java.lang.Object property)
matches
in interface EnvironmentKey
public final java.lang.String getNamespaceURI()
public final java.lang.String getLocalPart()
public final java.lang.String getPrefix()
public final boolean hasEmptyNamespace()
public final java.lang.String getLocalName()
public final java.lang.String getName()
public static Symbol make(java.lang.String uri, java.lang.String name, java.lang.String prefix)
uri
- a namespace uri.name
- The "local name" or "print name" of the desired symbol.prefix
- namespace prefix, or ""
public static Symbol make(java.lang.Object namespace, java.lang.String name)
namespace
- can be an Namespace, or a namespace/environment name
(resolved using Namespace.getInstance), or null (in which case
an uninterned symbol is created).name
- The "local name" or "print name" of the desired symbol.public static Symbol parse(java.lang.String symbol)
"{namespace-uri}local-name"
- which creates a
symbol with that namespace-uri and an empty prefix;
"prefix:local-name"
- which creates a symbol with that prefix
and an "unknown" namespace-uri, using makeWithUnknownNamespace(java.lang.String, java.lang.String)
;
"local-name"
- which creates a symbol in
Namespace.EmptyNamespace
.
public static Symbol makeWithUnknownNamespace(java.lang.String local, java.lang.String prefix)
"prefix:name=value"
- such as on the Kawa command-line -
where we don't yet know the namespace-uri. Code that later looks
for a value should look both under the true namespace-uri and
less LOG.JA * using this method (or Namespace.makeUnknownNamespace(java.lang.String)
).
public static Symbol makeUninterned(java.lang.String name)
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
public static boolean equals(Symbol sym1, Symbol sym2)
public final boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public final Namespace getNamespace()
public final void setNamespace(Namespace ns)
public java.lang.String toString()
toString
in class java.lang.Object
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException
public java.lang.Object readResolve() throws java.io.ObjectStreamException
java.io.ObjectStreamException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |