org.hecl
Class StringThing

java.lang.Object
  extended by org.hecl.StringThing
All Implemented Interfaces:
RealThing

public class StringThing
extends java.lang.Object
implements RealThing

The StringThing class is the internal representation of string types. This is somewhat special, as all types in Hecl may be represented as strings.

Version:
1.0
Author:
David N. Welton

Constructor Summary
StringThing()
          Creates a new, empty StringThing instance.
StringThing(java.lang.String s)
          Creates a new StringThing instance from a string.
StringThing(java.lang.StringBuffer sb)
          Creates a new StringThing instance from a stringbuffer.
 
Method Summary
 void append(char ch)
          append takes a character and appends it to the string.
 void append(java.lang.String str)
          append appends a string to the string.
static Thing create(java.lang.String s)
          The create method creates and returns a newly allocated Thing with a StringThing internal representation.
 RealThing deepcopy()
          deepcopy copies the string.
static java.lang.String get(Thing thing)
          get returns a string representation of a given Thing, transforming the thing into a string type at the same time.
 java.lang.String getStringRep()
          getStringRep returns its internal value.
 java.lang.String thingclass()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringThing

public StringThing()
Creates a new, empty StringThing instance.


StringThing

public StringThing(java.lang.String s)
Creates a new StringThing instance from a string.

Parameters:
s - a String value

StringThing

public StringThing(java.lang.StringBuffer sb)
Creates a new StringThing instance from a stringbuffer.

Parameters:
sb - a StringBuffer value
Method Detail

thingclass

public java.lang.String thingclass()
Specified by:
thingclass in interface RealThing

create

public static Thing create(java.lang.String s)
The create method creates and returns a newly allocated Thing with a StringThing internal representation.

Parameters:
s - A String value which may be null.
Returns:
A Thing value

get

public static java.lang.String get(Thing thing)
get returns a string representation of a given Thing, transforming the thing into a string type at the same time.

Parameters:
thing - a Thing value
Returns:
a String value
Throws:
HeclException

deepcopy

public RealThing deepcopy()
deepcopy copies the string.

Specified by:
deepcopy in interface RealThing
Returns:
a RealThing value

getStringRep

public java.lang.String getStringRep()
getStringRep returns its internal value.

Specified by:
getStringRep in interface RealThing
Returns:
a String value

append

public void append(char ch)
append takes a character and appends it to the string.

Parameters:
ch - a char value

append

public void append(java.lang.String str)
append appends a string to the string.

Parameters:
str - a String value