ESC/Java2
© 2003,2004,2005 David Cok and Joseph Kiniry
© 2005 UCD Dublin
© 2003,2004 Radboud University Nijmegen
© 1999,2000 Compaq Computer Corporation
© 1997,1998,1999 Digital Equipment Corporation
All Rights Reserved

escjava.prover
Class Atom

java.lang.Object
  extended byescjava.prover.SExp
      extended byescjava.prover.Atom

public final class Atom
extends SExp

Atoms are S-expressions representing symbols.

Interned Strings are used to represent symbols. Accordingly, two Atoms are equal (via ==) iff they represent the same symbol.


Field Summary
private static java.util.Hashtable map
          Our map from interned Strings to already created non-null Atoms.
static java.lang.String special
          The list of special symbols that don't need to be quoted when by themselves.
private  java.lang.String value
          The symbol we represent; always already interned.
 
Constructor Summary
private Atom(java.lang.String symbol)
          Create an Atom representing a given symbol.
 
Method Summary
 boolean equals(java.lang.Object o)
          Return true if this atom and object o are the same atom.
static Atom fromString(java.lang.String symbol)
          Create a Atom representing a given symbol.
 Atom getAtom()
          If we represent an atom, return it as an Atom; otherwise, throw SExpTypeError.
 boolean isAtom()
          Do we represent an atom?
static void main(java.lang.String[] args)
          A simple test routine
 void prettyPrint(java.io.PrintStream out)
          Pretty print a textual representation of us on a given PrintStream.
 void print(java.io.PrintStream out)
          Print a textual representation of us on a given PrintStream.
static java.lang.String printableVersion(java.lang.String symbol)
          Returns the printable version (e.g., with escape codes added as needed) of an S-expression symbol's name.
 java.lang.String toString()
          Return the interned String for the symbol we represent.
 
Methods inherited from class escjava.prover.SExp
display, fancyMake, getInteger, getList, isInteger, isList, make, print
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

map

private static java.util.Hashtable map
Our map from interned Strings to already created non-null Atoms.


value

private java.lang.String value
The symbol we represent; always already interned.


special

public static final java.lang.String special
The list of special symbols that don't need to be quoted when by themselves.

See Also:
Constant Field Values
Constructor Detail

Atom

private Atom(java.lang.String symbol)
Create an Atom representing a given symbol. Clients are allowed to create Atoms only by calling fromString so we can intern.

Precondition: symbol must already have been interned.

Method Detail

fromString

public static Atom fromString(java.lang.String symbol)
Create a Atom representing a given symbol.

This function always returns the same Atom when called on equal Strings.


isAtom

public boolean isAtom()
Do we represent an atom?

Overrides:
isAtom in class SExp

getAtom

public Atom getAtom()
If we represent an atom, return it as an Atom; otherwise, throw SExpTypeError.

Overrides:
getAtom in class SExp

toString

public java.lang.String toString()
Return the interned String for the symbol we represent.

Overrides:
toString in class SExp
Returns:
a textual representation of this s-expression.

equals

public boolean equals(java.lang.Object o)
Return true if this atom and object o are the same atom.


printableVersion

public static java.lang.String printableVersion(java.lang.String symbol)
Returns the printable version (e.g., with escape codes added as needed) of an S-expression symbol's name.


print

public void print(java.io.PrintStream out)
Print a textual representation of us on a given PrintStream.

Note: This routine will take a PrintWriter instead when we switch to a more recent version of JDK.

Specified by:
print in class SExp

prettyPrint

public void prettyPrint(java.io.PrintStream out)
Pretty print a textual representation of us on a given PrintStream.

Note: This routine will take a PrintWriter instead when we switch to a more recent version of JDK.

Specified by:
prettyPrint in class SExp

main

public static void main(java.lang.String[] args)
A simple test routine


ESC/Java2
© 2003,2004,2005 David Cok and Joseph Kiniry
© 2005 UCD Dublin
© 2003,2004 Radboud University Nijmegen
© 1999,2000 Compaq Computer Corporation
© 1997,1998,1999 Digital Equipment Corporation
All Rights Reserved

The ESC/Java2 Project Homepage