anl.aida.data
Class DataManager

java.lang.Object
  extended by anl.aida.data.DataManager

public class DataManager
extends java.lang.Object

Manages the loading of data and the creation of data sets.

Version:
$Revision$ $Date$

Field Summary
private  AliasGenerator aliasGenerator
           
private  java.util.Map<java.lang.String,Dataset> datasets
           
private static org.apache.log4j.Logger logger
           
 
Constructor Summary
DataManager()
           
 
Method Summary
 Dataset addDataset(Dataset dataset)
          Adds the specified dataset to the list managed by this data manager.
 Dataset createDataset(java.lang.String className)
          Creates a DataSet from a classname of a class that implements Dataset.
 Dataset getDataset(java.lang.String alias)
          Gets the dataset with the specified alias.
 int getDatasetCount()
          Gets the number of datasets currently loaded.
 java.util.List<Dataset> getDatasets()
          Gets the datasets managed by this data manager.
 void replaceAliases(java.util.Map<Dataset,java.lang.String> aliasMap)
          Replaces the specified datasets current alias with the new one.
 java.lang.String[] splitVarName(java.lang.String variableName)
          Splits a formula variable name into the dataset alias and variable name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final org.apache.log4j.Logger logger

datasets

private java.util.Map<java.lang.String,Dataset> datasets

aliasGenerator

private AliasGenerator aliasGenerator
Constructor Detail

DataManager

public DataManager()
Method Detail

createDataset

public Dataset createDataset(java.lang.String className)
Creates a DataSet from a classname of a class that implements Dataset.

Parameters:
className - the className of the dataset.
Returns:
the created dataset or null if the dataset could not be created.

addDataset

public Dataset addDataset(Dataset dataset)
Adds the specified dataset to the list managed by this data manager.

Parameters:
dataset - the dataset to add
Returns:
the managed dataset.

getDatasets

public java.util.List<Dataset> getDatasets()
Gets the datasets managed by this data manager.

Returns:
the datasets managed by this data manager.

replaceAliases

public void replaceAliases(java.util.Map<Dataset,java.lang.String> aliasMap)
Replaces the specified datasets current alias with the new one. This does not effect formulas in any way.

Parameters:
aliasMap - key is the dataset and value is the new alias.

getDatasetCount

public int getDatasetCount()
Gets the number of datasets currently loaded.

Returns:
the number of datasets currently loaded.

getDataset

public Dataset getDataset(java.lang.String alias)
Gets the dataset with the specified alias.

Parameters:
alias - the alias of the dataset to get.
Returns:
the dataset with the specified alias.

splitVarName

public java.lang.String[] splitVarName(java.lang.String variableName)
Splits a formula variable name into the dataset alias and variable name.

Parameters:
variableName - the name to split
Returns:
a string array whose first element is the alias and whose second element is the unaliased variable name.