gov.usda.gdpc
Class AbstractDBElementGroup

java.lang.Object
  extended bygov.usda.gdpc.AbstractGroup
      extended bygov.usda.gdpc.AbstractDBElementGroup
All Implemented Interfaces:
java.util.Collection, DBElementGroup, Group, java.util.List
Direct Known Subclasses:
AbstractEnvironmentExperimentGroup, AbstractGenotypeExperimentGroup, AbstractGenotypeGroup, AbstractLocalityGroup, AbstractLocusGroup, AbstractPhenotypeGroup, AbstractPhenotypeOntologyGroup, AbstractTaxonGroup

public abstract class AbstractDBElementGroup
extends AbstractGroup
implements DBElementGroup

This class provides a skeletal implementation of the DBElementGroup interface to minimize the effort required to implement this interface.

Author:
terryc

Field Summary
protected  java.util.Map myIndex
          This map indexes the elements in the group based on the value returned by DBElement.getKey()
 
Constructor Summary
AbstractDBElementGroup()
          AbstractDBElementGroup constructor.
AbstractDBElementGroup(DBElement[] list)
          AbstractDBElementGroup constructor.
AbstractDBElementGroup(DBElementGroup[] groups)
          AbstractDBElementGroup constructor.
AbstractDBElementGroup(Group[] groups, boolean sorted)
          AbstractDBElementGroup constructor.
AbstractDBElementGroup(java.util.List list)
          AbstractDBElementGroup constructor.
AbstractDBElementGroup(java.util.List list, boolean sorted)
          AbstractDBElementGroup constructor.
AbstractDBElementGroup(java.lang.Object[] list, boolean sorted)
          AbstractDBElementGroup constructor.
 
Method Summary
protected  java.util.List getDBElementGroup(Filter filter)
          Gets the group of elements that match the given filter from this group.
 java.util.List getDBElements(java.lang.String dataSource)
          Returns the list of elements contained in this group which originated from the given data source.
 java.util.List getDefinedProperties()
          This returns a distinct list of properties defined by the elements in this group.
 DistinctPropertyValues getDistinctProperties(Property[] properties)
          Returns list(s) of distinct property values for the given properties.
 void index()
          Indexes this group of taxa based on the unique key.
 java.lang.String toString()
          This returns the string representation of this group.
 
Methods inherited from class gov.usda.gdpc.AbstractGroup
add, add, addAll, addAll, clear, contains, containsAll, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gov.usda.gdpc.DBElementGroup
getType
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray
 

Field Detail

myIndex

protected java.util.Map myIndex
This map indexes the elements in the group based on the value returned by DBElement.getKey()

Constructor Detail

AbstractDBElementGroup

public AbstractDBElementGroup(DBElement[] list)
AbstractDBElementGroup constructor.

Parameters:
list - list of objects to be a part of this group. Any null in the list will be discarded.

AbstractDBElementGroup

public AbstractDBElementGroup(java.lang.Object[] list,
                              boolean sorted)
AbstractDBElementGroup constructor.

Parameters:
list - list of objects to be a part of this group. Any null in the list will be discarded.
sorted - true if group should be sorted.

AbstractDBElementGroup

public AbstractDBElementGroup()
AbstractDBElementGroup constructor. Creates an empty group.


AbstractDBElementGroup

public AbstractDBElementGroup(java.util.List list)
AbstractDBElementGroup constructor.

Parameters:
list - list of objects to be a part of this group. Any null in the list will be discarded.

AbstractDBElementGroup

public AbstractDBElementGroup(java.util.List list,
                              boolean sorted)
AbstractDBElementGroup constructor.

Parameters:
list - list of objects to be a part of this group. Any null in the list will be discarded.
sorted - true if group should be sorted.

AbstractDBElementGroup

public AbstractDBElementGroup(DBElementGroup[] groups)
AbstractDBElementGroup constructor.

Parameters:
groups - groups to include in this new group.

AbstractDBElementGroup

public AbstractDBElementGroup(Group[] groups,
                              boolean sorted)
AbstractDBElementGroup constructor.

Parameters:
groups - groups to include in this new group.
sorted - true if group should be sorted.
Method Detail

getDBElements

public final java.util.List getDBElements(java.lang.String dataSource)
Returns the list of elements contained in this group which originated from the given data source.

Specified by:
getDBElements in interface DBElementGroup
Parameters:
dataSource - data source
Returns:
list of elements

getDistinctProperties

public DistinctPropertyValues getDistinctProperties(Property[] properties)
Returns list(s) of distinct property values for the given properties. The list(s) are values retrieved from this group.

Specified by:
getDistinctProperties in interface DBElementGroup
Parameters:
properties - list of properties
Returns:
list(s) of distinct property values

getDBElementGroup

protected java.util.List getDBElementGroup(Filter filter)
Gets the group of elements that match the given filter from this group.

Parameters:
filter - filter
Returns:
group

index

public final void index()
Indexes this group of taxa based on the unique key. The performance of the getTaxon method improves after executing this method. Additional memory used.

Specified by:
index in interface DBElementGroup

toString

public java.lang.String toString()
This returns the string representation of this group.

Overrides:
toString in class AbstractGroup
Returns:
string representation

getDefinedProperties

public java.util.List getDefinedProperties()
This returns a distinct list of properties defined by the elements in this group.

Specified by:
getDefinedProperties in interface DBElementGroup
Returns:
list of properties