org.hecl
Class HashThing

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

public class HashThing
extends java.lang.Object
implements RealThing

The HashThing class represents a hash table type in Hecl.

Version:
1.0
Author:
David N. Welton

Constructor Summary
HashThing()
          Creates a new, empty HashThing instance.
HashThing(java.util.Hashtable h)
          Creates a new HashThing instance from a Hashtable.
HashThing(java.util.Vector v)
          Creates a new HashThing instance from a Vector.
 
Method Summary
static Thing create(java.util.Hashtable h)
          create allocates and returns a new HashThing typed Thing.
 RealThing deepcopy()
          deepcopy copies the hash table and all its elements.
static java.util.Hashtable get(Thing thing)
          get attempts to return a Hashtable from a given Thing, in the process transforming that Thing into a HashThing internally.
 java.lang.String getStringRep()
          getStringRep returns a string representation of a HashThing, which is in reality a string representation of a ListThing, only that there are guaranteed to be an even number of elements.
 java.lang.String thingclass()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HashThing

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


HashThing

public HashThing(java.util.Hashtable h)
Creates a new HashThing instance from a Hashtable.

Parameters:
h - a Hashtable value

HashThing

public HashThing(java.util.Vector v)
          throws HeclException
Creates a new HashThing instance from a Vector. This may throw an exception, because if the Vector doesn't have an even number of elements, it won't be a valid hash table.

Parameters:
v - a Vector value
Throws:
HeclException - if an error occurs
Method Detail

thingclass

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

create

public static Thing create(java.util.Hashtable h)
create allocates and returns a new HashThing typed Thing.

Parameters:
h - a Hashtable value
Returns:
a Thing value

get

public static java.util.Hashtable get(Thing thing)
                               throws HeclException
get attempts to return a Hashtable from a given Thing, in the process transforming that Thing into a HashThing internally.

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

deepcopy

public RealThing deepcopy()
                   throws HeclException
deepcopy copies the hash table and all its elements.

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

getStringRep

public java.lang.String getStringRep()
getStringRep returns a string representation of a HashThing, which is in reality a string representation of a ListThing, only that there are guaranteed to be an even number of elements.

Specified by:
getStringRep in interface RealThing
Returns:
a String value
Throws:
HeclException - if an error occurs