satin.aro
Class AROdatum

java.lang.Object
  |
  +--satin.aro.AROdatum
Direct Known Subclasses:
ARObooleanDatum, AROcompoundDatum, AROintegerDatum, AROobjectDatum, AROrealDatum, AROstringDatum

public abstract class AROdatum
extends java.lang.Object

This is an abstract base class for incoming data elements. Type-specific accessors are defined in this base class to reduce the need for downcasting.

Author:
Ed Stauff

Field Summary
protected boolean gotten
          Whether the value has ever been gotten.
protected java.lang.String name
          The name of the data element, or null if the element has no name.
 
Constructor Summary
protected AROdatum()
          Constructs an unnamed data element.
protected AROdatum(java.lang.String name)
          Constructs a named data element.
 
Method Summary
void addToOutput(AROoutgoingData d)
          Copies the incoming data (this object) into the given outgoing data.
abstract void addToOutput(AROoutgoingData d, java.lang.String name)
          Copies the incoming data (this object) into the given outgoing data.
void dump()
          Dumps the contents of the object for debugging.
void dump(java.lang.String indent)
          Dumps the contents of the object for debugging.
boolean getBoolean()
          Returns the value of a boolean data element.
AROcompoundDatum getCompound()
          Returns the value of a compound data element.
int getInteger()
          Returns the value of an integer data element.
java.lang.String getName()
          Returns the name of the data element.
AROobjectID getObjectID()
          Returns the id of an object data element.
double getReal()
          Returns the value of a real (floating point) data element.
java.lang.String getString()
          Returns the value of a string data element.
abstract java.lang.String toString()
          Converts the value of the data element to a string.
boolean wasGotten()
          Returns whether the value of the data element has ever been gotten; that is, if a get*** method has been called.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected java.lang.String name
The name of the data element, or null if the element has no name.

gotten

protected boolean gotten
Whether the value has ever been gotten. The value of this field starts out as false, changes to true the first time any get*** method is called, and never changes again for the life of the object.
Constructor Detail

AROdatum

protected AROdatum(java.lang.String name)
Constructs a named data element.

Parameters:
name
The name of the element, or null.

AROdatum

protected AROdatum()
Constructs an unnamed data element.
Method Detail

getName

public java.lang.String getName()
Returns the name of the data element. Returns null if the data element has no name.

Returns:
The name of the data element.

getBoolean

public boolean getBoolean()
Returns the value of a boolean data element. Throws an assertion if the data element is not a boolean.

Returns:
The value of the data element.

getInteger

public int getInteger()
Returns the value of an integer data element. Throws an assertion if the data element is not an integer.

Returns:
The value of the data element.

getReal

public double getReal()
Returns the value of a real (floating point) data element. Throws an assertion if the data element is not a real.

Returns:
The value of the data element.

getString

public java.lang.String getString()
Returns the value of a string data element. Throws an assertion if the data element is not a string.

Returns:
The value of the data element.

getObjectID

public AROobjectID getObjectID()
Returns the id of an object data element. Throws an assertion if the data element is not an ARO object.

Returns:
The value of the data element.

getCompound

public AROcompoundDatum getCompound()
Returns the value of a compound data element. Throws an assertion if the data element is not compound.

Returns:
The value of the data element.

wasGotten

public boolean wasGotten()
Returns whether the value of the data element has ever been gotten; that is, if a get*** method has been called.

Returns:
true if the data element's value has ever been gotten, otherwise false.

addToOutput

public abstract void addToOutput(AROoutgoingData d,
                                 java.lang.String name)
Copies the incoming data (this object) into the given outgoing data.

Parameters:
d
the outgoing data
name
the outgoing parameter name, or null for no parameter name.

addToOutput

public void addToOutput(AROoutgoingData d)
Copies the incoming data (this object) into the given outgoing data. If this datum has a name, it is copied as well. This is equivalent to x.addToOutput(d, x.getName()).

Parameters:
d
the outgoing data

toString

public abstract java.lang.String toString()
Converts the value of the data element to a string.

Overrides:
toString in class java.lang.Object

Returns:
the value of the data element as a string.

dump

public void dump()
Dumps the contents of the object for debugging. The output goes to System.out.

dump

public void dump(java.lang.String indent)
Dumps the contents of the object for debugging. The output consists of the class name, the datum's name in quotes, a colon, and the datum's value. The output goes to System.out.

Parameters:
indent
this string is prepended to each line of output.
Revision History

4/6/01 Ed Stauff - changes per initial code review.

4/5/01 Ed Stauff - made changes per review.

3/27/01 Ed Stauff - initial review.



Generated on 5/9/2001 19:37 from AROdatum.java (PRIVATE SOURCES)