|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ix.util.lisp.ObjectHash
public class ObjectHash
Provides re-readable (within a JVM) names for objects.
The names have the form "{" class-name "-" hash-value "}",
where the hash-value is obtained by calling hash(Object)
.
These names are used by Lisp.printToString(Object)
and
by Lisp.readFromString(String)
and LispReader
s
in general, but they use a particular ObjectHash object that
is private to the Lisp
class.
Note that ordinary, strong references are used. Objects that
have been given to hash(Object)
will therefore not be
garbage collected. This is to ensure that hash-names in strings
will work even if no other reference to the object exists.
Indeed, the only ref might be the user's memory of some output
that contained a hash-name. The user can type in the same
hash-name and get back the object.
The class-name part of hash-names is not checked. It is there only to make the names more meaningful.
Field Summary | |
---|---|
protected java.util.List |
hashToObject
|
protected EqMap |
objectToHash
|
Constructor Summary | |
---|---|
ObjectHash()
|
Method Summary | |
---|---|
int |
hash(java.lang.Object obj)
Maps an object to an int that can be given to unhash(int)
to get back the same (==) object. |
java.lang.String |
hashName(java.lang.Object obj)
Returns a name of the form "{" class-name "-" hash-value "}", where the hash-value is obtained by calling hash(Object) . |
static void |
main(java.lang.String[] argv)
Test loop |
java.lang.Object |
parseHashName(java.lang.String name)
The inverse of hashName(Object) . |
java.lang.Object |
unhash(int h)
The inverse of hash(Object) . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected EqMap objectToHash
protected java.util.List hashToObject
Constructor Detail |
---|
public ObjectHash()
Method Detail |
---|
public int hash(java.lang.Object obj)
unhash(int)
to get back the same (==) object.
public java.lang.Object unhash(int h)
hash(Object)
.
public java.lang.String hashName(java.lang.Object obj)
hash(Object)
.
public java.lang.Object parseHashName(java.lang.String name)
hashName(Object)
.
java.lang.IllegalArgumentException
- if a valid object hash value
cannot be found in the name.public static void main(java.lang.String[] argv)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |