org.hecl
Class Thing

java.lang.Object
  extended by org.hecl.Thing

public class Thing
extends java.lang.Object

The Thing class is what Hecl revolves around. "Things" can be of several types, include strings, integers, lists, hash tables.

Version:
1.1
Author:
David N. Welton

Field Summary
protected  boolean copy
           
 boolean global
           
protected  boolean literal
          literal is used to indicate Things which come directly from the parser and thus should not be changed.
 
Constructor Summary
Thing(RealThing realthing)
          Creates a new Thing instance from an internal representation.
Thing(java.lang.String s)
          Creates a new Thing instance from a string.
Thing(java.lang.StringBuffer s)
          Creates a new Thing instance from a string buffer.
 
Method Summary
 Thing deepcopy()
          deepcopy copies the thing, its value, and any elements the value might contain.
static Thing emptyThing()
           
 boolean equals(java.lang.Object obj)
          The equals method overrides the object equals method, using either the two objects, in the case of two ObjectThings, or the two string representations.
 RealThing getVal()
          getVal fetches the internal value of the Thing.
 int hashCode()
          The hashCode method overrides the object hashCode method, using the hash of the string representation.
 boolean isLiteral()
           
static boolean isTrue(Thing thing)
          isTrue is a convenience function that lets us know if the result of a calculation is true or false.
 void makeref(Thing newval)
          makeref sets the 'this' Thing to be a reference to the newval that was passed to it.
 void setCopyVal(RealThing realthing)
           
 Thing setLiteral()
          The setLiteral method sets the thing in question to be a literal Thing, and returns it.
 void setVal(RealThing realthing)
          setVal sets the internal representation of the Thing.
 java.lang.String toString()
          toString returns the String value of a Thing.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

copy

protected boolean copy

literal

protected boolean literal
literal is used to indicate Things which come directly from the parser and thus should not be changed.


global

public boolean global
Constructor Detail

Thing

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

Parameters:
s - a String value

Thing

public Thing(java.lang.StringBuffer s)
Creates a new Thing instance from a string buffer.

Parameters:
s - a StringBuffer value

Thing

public Thing(RealThing realthing)
Creates a new Thing instance from an internal representation.

Parameters:
realthing - a RealThing value
Method Detail

setVal

public void setVal(RealThing realthing)
setVal sets the internal representation of the Thing.

Parameters:
realthing - a RealThing value

setCopyVal

public void setCopyVal(RealThing realthing)

getVal

public RealThing getVal()
getVal fetches the internal value of the Thing.

Returns:
a RealThing value

emptyThing

public static final Thing emptyThing()

isTrue

public static boolean isTrue(Thing thing)
                      throws HeclException
isTrue is a convenience function that lets us know if the result of a calculation is true or false.

Parameters:
thing - a Thing value
Returns:
a boolean value
Throws:
HeclException - if an error occurs

makeref

public void makeref(Thing newval)
makeref sets the 'this' Thing to be a reference to the newval that was passed to it.

Parameters:
newval - a Thing value.

toString

public java.lang.String toString()
toString returns the String value of a Thing.

Overrides:
toString in class java.lang.Object
Returns:
a String value

hashCode

public int hashCode()
The hashCode method overrides the object hashCode method, using the hash of the string representation.

Overrides:
hashCode in class java.lang.Object
Returns:
an int value

equals

public boolean equals(java.lang.Object obj)
The equals method overrides the object equals method, using either the two objects, in the case of two ObjectThings, or the two string representations.

Overrides:
equals in class java.lang.Object
Parameters:
obj - an Object value
Returns:
a boolean value

setLiteral

public Thing setLiteral()
The setLiteral method sets the thing in question to be a literal Thing, and returns it.

Returns:
a Thing value

isLiteral

public boolean isLiteral()

deepcopy

public Thing deepcopy()
               throws HeclException
deepcopy copies the thing, its value, and any elements the value might contain.

Returns:
a Thing value
Throws:
HeclException