se.sics.jasper
Class SPCanonicalAtom

java.lang.Object
  |
  +--se.sics.jasper.SPCanonicalAtom

public class SPCanonicalAtom
extends java.lang.Object

The SPCanonicalAtom class encapsulates the canonical representation of a Prolog atom, which is usually a 32 or 64-bit integer. In previous versions of Jasper, atoms were passed around as Java long types. However, this prevented interaction with the atom garbage collector. By using this class instead, atoms only referenced canonically from Java are ensured not to be garbage collected.

See Also:
SPTerm.getCanonicalAtom()

Constructor Summary
SPCanonicalAtom(long cAtom)
          Creates a canonical atom given only the canonical atom representation.
SPCanonicalAtom(SICStus sp, java.lang.String string)
          Create a canonical atom from a string.
 
Method Summary
 void finalize()
          Un-register this atom so it may be GC:d
 boolean isSameAtom(SPCanonicalAtom cAtom)
          Returns true iff the atoms have the same canonical representation.
 java.lang.String toString()
          Return this canonical atom as a string
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SPCanonicalAtom

public SPCanonicalAtom(SICStus sp,
                       java.lang.String string)
                throws AtomRegisterFailure
Create a canonical atom from a string.

SPCanonicalAtom

public SPCanonicalAtom(long cAtom)
                throws AtomRegisterFailure
Creates a canonical atom given only the canonical atom representation.
Throws:
IllegalCallerException - The use of this constructor is strongly discouraged!
Method Detail

toString

public java.lang.String toString()
Return this canonical atom as a string
Overrides:
toString in class java.lang.Object

isSameAtom

public boolean isSameAtom(SPCanonicalAtom cAtom)
Returns true iff the atoms have the same canonical representation. s

finalize

public void finalize()
Un-register this atom so it may be GC:d
Overrides:
finalize in class java.lang.Object