edu.unh.sdb.datasource
Class DataSourceCollection

java.lang.Object
  extended by edu.unh.sdb.datasource.DataSourceCollection

public class DataSourceCollection
extends java.lang.Object

The DataSourceCollection class provides for a list of datasources with customary list functionality. The list was intended to be populated either by reading a database or by processing some Data Description Language. The list is only allowed to grow. Elements are never deleted from the list.


Constructor Summary
DataSourceCollection()
           
 
Method Summary
 void add(DataSource ds)
          Add a DataSource to the end of the list
 DataSource get(int i)
          Returns the DataSource at the designated index or null DataSource object if no more exists.
 DataSource get(java.lang.String s)
          Returns the DataSource object corresponding to the DataSource named by the string.
 DataSource getDataSource(java.lang.String s)
          Returns the DataSource object corresponding to the DataSource named by the string
 DataSource getElementAt(int i)
          Returns the DataSource at the designated index or null DataSource object if no more exists.
 int indexOf(java.lang.String s)
          Returns the integer index of the datasource corresponding to the DataSource named by the string.
 int indexOfName(java.lang.String s)
          Returns the integer index value for the DataSource denoted by string.
 void merge(DataSourceCollection dsColl)
          if name exists in both collections, the new one is discarded
 boolean nameExists(java.lang.String s)
          Returns true if DataSource named by String is in the list
 DataSource next()
          returns the next DataSource object or null DataSource object if no more exists
 void rewind()
          Resets the index to beginning of the list
 int size()
          Returns the number of elements stored this DataSource collection as an integer
 java.lang.String toString()
          for debugging - prints the total number of datasource collections stored.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataSourceCollection

public DataSourceCollection()
Method Detail

next

public DataSource next()
returns the next DataSource object or null DataSource object if no more exists


getElementAt

public DataSource getElementAt(int i)
Returns the DataSource at the designated index or null DataSource object if no more exists. Returns a null DataSource object if index does not exist.


get

public DataSource get(int i)
Returns the DataSource at the designated index or null DataSource object if no more exists. Returns a null DataSource object if index does not exist. This is a shorthand method to getElementAt() added for compatibility with SDB naming conventions.


add

public void add(DataSource ds)
Add a DataSource to the end of the list


rewind

public void rewind()
Resets the index to beginning of the list


indexOfName

public int indexOfName(java.lang.String s)
Returns the integer index value for the DataSource denoted by string. Returns -1 if the DataSource name does not exist


nameExists

public boolean nameExists(java.lang.String s)
Returns true if DataSource named by String is in the list


indexOf

public int indexOf(java.lang.String s)
Returns the integer index of the datasource corresponding to the DataSource named by the string. If name does not exist, a null DataSource will be returned


getDataSource

public DataSource getDataSource(java.lang.String s)
Returns the DataSource object corresponding to the DataSource named by the string


get

public DataSource get(java.lang.String s)
Returns the DataSource object corresponding to the DataSource named by the string. This is a shorthand for getDataSource(String) to comply with SDB naming conventions.


size

public int size()
Returns the number of elements stored this DataSource collection as an integer


merge

public void merge(DataSourceCollection dsColl)
if name exists in both collections, the new one is discarded


toString

public java.lang.String toString()
for debugging - prints the total number of datasource collections stored. Later will give names of each datasource

Overrides:
toString in class java.lang.Object