cetus.hir
Class StringLiteral

java.lang.Object
  extended by cetus.hir.Expression
      extended by cetus.hir.Literal
          extended by cetus.hir.StringLiteral
All Implemented Interfaces:
Printable, Traversable, java.lang.Cloneable, java.lang.Comparable<Expression>

public class StringLiteral
extends Literal


Field Summary
 
Fields inherited from class cetus.hir.Expression
children, needs_parens, object_print_method, parent
 
Constructor Summary
StringLiteral(java.lang.String s)
           
 
Method Summary
 java.lang.Object clone()
          Creates and returns a deep copy of this expression.
static void defaultPrint(StringLiteral lit, java.io.OutputStream stream)
          Prints a literal to a stream.
 boolean equals(java.lang.Object o)
           
 java.lang.String getValue()
           
static void setClassPrintMethod(java.lang.reflect.Method m)
          Overrides the class print method, so that all subsequently created objects will use the supplied method.
 void setValue(java.lang.String value)
           
 void stripQuotes()
          Removes outer quotes from the string; this class automatically prints quotes around the string so it does not need to store them.
 java.lang.String toString()
          Every expression class should override toString method.
 
Methods inherited from class cetus.hir.Expression
compareTo, equals2, findExpression, getChildren, getParent, getStatement, needsParens, print, printSelf, removeChild, setChild, setParens, setParent, setPrintMethod, swapWith, verify
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringLiteral

public StringLiteral(java.lang.String s)
Method Detail

clone

public java.lang.Object clone()
Description copied from class: Expression
Creates and returns a deep copy of this expression.

Overrides:
clone in class Literal
Returns:
a deep copy of this expression.

defaultPrint

public static void defaultPrint(StringLiteral lit,
                                java.io.OutputStream stream)
Prints a literal to a stream.

Parameters:
lit - The literal to print.
stream - The stream on which to print the literal.

toString

public java.lang.String toString()
Description copied from class: Expression
Every expression class should override toString method.

Overrides:
toString in class Expression

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class Expression

getValue

public java.lang.String getValue()

setClassPrintMethod

public static void setClassPrintMethod(java.lang.reflect.Method m)
Overrides the class print method, so that all subsequently created objects will use the supplied method.

Parameters:
m - The new print method.

setValue

public void setValue(java.lang.String value)

stripQuotes

public void stripQuotes()
Removes outer quotes from the string; this class automatically prints quotes around the string so it does not need to store them. Thus, if you create a StringLiteral with a String that already has quotes around it, you will have double quotes, and may need to call this method. The method has no effect if there are no quotes.