com.fdsapi
Class DataSet

java.lang.Object
  |
  +--com.fdsapi.DataSet
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
DataSetBase, DataSetCellBase, DataSetDecorator, DataSetNext

public abstract class DataSet
extends java.lang.Object
implements java.lang.Cloneable

This class represents a command to be issued gainst TabularData. The command can take any action against the TabularData. The current actions all render text, however the DataSet execute() method is generic and so can execute any command. DataIterator iterates through TabularData executing commands against it vi the DataSet. DataIterator, TabularData, and DataSets together execute the Gang of 4 Iterator and Command design patterns. They are also the most fundamental objects behind the FormattedDataSet.

Template objects contain multiple DataSet's. A DataSet is mapped to a Template tag via Template files/strings. For example you can map a particular DataSet (i.e. command) to a column of the TabularData.



View Code


Field Summary
protected  DataSetParm dataSetParm
           
protected  java.lang.String templateTagType
           
protected  TemplateVariables variables
           
 
Constructor Summary
DataSet()
           
 
Method Summary
 java.lang.Object clone()
          Note clone() returns a shallow copy of the object.
 DataIterator createDataIterator()
          Iterator factory method
abstract  DataSet createFactoryInstance()
          A Factory method that creates a clone of this DataSet (see gang of 4 "Factory method" pattern).
 DataSet createFactoryInstance(DataSetFactoryParm parm)
          A Factory method that creates a clone of this DataSet with whatever data that makes this instance unique .
 java.lang.Object execute()
          This function should be implemented in DataSetDecorator class for the client program to call to get the process started.
abstract  void execute(int y)
          Execute a command against the specified index.
protected  java.lang.Object getCellData()
           
protected  DataSetParm getDataSetParm()
          Convenience method that gets the DataSetParm object associated with the DataSet.
protected  java.util.Map getMiscDataMap()
           
protected  java.lang.StringBuffer getStringBuffer()
           
protected  TabularData getTabularData()
          Convenience method that gets the underlying TabularData object that the DataSet is working on.
protected  TemplateVariables getTemplateVariables()
          Convenience method that gets the TemplateVariables object associated with the DataSet.
protected  java.lang.String getVariableValue(java.lang.String variableName)
          Return the value of a template variable.
protected  void initialize(java.lang.String templateContents)
          by default does nothing.
protected  void log(java.lang.String logStr)
          Log to the standard logging device
 boolean next()
          Increment the underlying TabularData's iterator
 void setDataSetParm(DataSetParm dsp)
          Method that sets the DataSetParm for the DataSet instance.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

variables

protected TemplateVariables variables

dataSetParm

protected DataSetParm dataSetParm

templateTagType

protected java.lang.String templateTagType
Constructor Detail

DataSet

public DataSet()
Method Detail

next

public boolean next()
Increment the underlying TabularData's iterator


createFactoryInstance

public DataSet createFactoryInstance(DataSetFactoryParm parm)
A Factory method that creates a clone of this DataSet with whatever data that makes this instance unique .


createFactoryInstance

public abstract DataSet createFactoryInstance()
A Factory method that creates a clone of this DataSet (see gang of 4 "Factory method" pattern). This allows the type of DataSet to be determined at runtime.


setDataSetParm

public void setDataSetParm(DataSetParm dsp)
Method that sets the DataSetParm for the DataSet instance.


log

protected void log(java.lang.String logStr)
Log to the standard logging device


createDataIterator

public DataIterator createDataIterator()
Iterator factory method


clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException

Note clone() returns a shallow copy of the object. This means the cloned instance variables of a DataSet will only clone the references not the underlying objects. When instance variables are stateless this works ok, but a deeper copy will have to be implemented if the instance variables are stateful.

This is an implementation of the Prototype factory pattern as discussed in the Erich Gamma Design Patterns book.

The CloneNotSupportedException could only be thrown if this class didn't implement the Cloneable tag interface.

Overrides:
clone in class java.lang.Object
java.lang.CloneNotSupportedException

execute

public abstract void execute(int y)
Execute a command against the specified index. Index can represent a particular column, cell or other entity


execute

public java.lang.Object execute()
This function should be implemented in DataSetDecorator class for the client program to call to get the process started. After the first call the execute(int) method will be called.


initialize

protected void initialize(java.lang.String templateContents)
by default does nothing. DataSetDecorators provide real behaviour.


getVariableValue

protected java.lang.String getVariableValue(java.lang.String variableName)

Return the value of a template variable. It will bring back the variable with any of the dynamic portions populated. For example given the following template variable:

myVariable==##2, ##1

and given the following 2 column row from the tabular data:

Steve Souza

String value=getVariableValue("myVariable");  // value will contain "Souza, Steve"

Note the variable name is case insensitive.


getTemplateVariables

protected TemplateVariables getTemplateVariables()

Convenience method that gets the TemplateVariables object associated with the DataSet.


getDataSetParm

protected DataSetParm getDataSetParm()

Convenience method that gets the DataSetParm object associated with the DataSet. DataSetParm has contains TabularData and the StringBuffer that is written too among other things. There are other convenience methods that make getting information form DataSetParm more direct.


getTabularData

protected TabularData getTabularData()

Convenience method that gets the underlying TabularData object that the DataSet is working on. There are other convenience methods that make dealing with TabularData objects more direct.


getCellData

protected java.lang.Object getCellData()

getMiscDataMap

protected java.util.Map getMiscDataMap()

getStringBuffer

protected java.lang.StringBuffer getStringBuffer()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object