org.jscience.biology.taxonomy
Class WeakTaxon

java.lang.Object
  extended by org.jscience.biology.taxonomy.AbstractTaxon
      extended by org.jscience.biology.taxonomy.WeakTaxon
All Implemented Interfaces:
Taxon

public class WeakTaxon
extends AbstractTaxon

An implementation of Taxon that keeps only weak references to children, but full references to parents.

This may be suitable for deriving memory-savy implementations of TaxonFactory.

To manipulate the children set, use the getChildrenRaw and setChildrenRaw methods. These 'box' the actual weak reference, but recognize null to mean that there are no children currently known. A code-fragment may wish to do something like this:


 Set children = weakTaxon.getChildrenRaw();
 if(children == null) {
   children = new HashSet();
   weakTaxon.setChildrenRaw(children);
 }
 // do stuff to update child set e.g. add children
 


Field Summary
protected  Taxon parent
           
 
Constructor Summary
WeakTaxon(java.lang.String scientificName, java.lang.String commonName)
          Creates a new WeakTaxon object.
 
Method Summary
 java.util.Set getChildren()
          DOCUMENT ME!
 java.util.Set getChildrenRaw()
          DOCUMENT ME!
 Taxon getParent()
          DOCUMENT ME!
 boolean isLeaf()
          DOCUMENT ME!
 boolean isRoot()
          DOCUMENT ME!
 void setChildrenRaw(java.util.Set children)
          DOCUMENT ME!
 
Methods inherited from class org.jscience.biology.taxonomy.AbstractTaxon
equals, getAppearance, getCommonName, getExtendedName, getExtinction, getScientificName, setAppearance, setCommonName, setExtinction, setScientificName, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

parent

protected Taxon parent
Constructor Detail

WeakTaxon

public WeakTaxon(java.lang.String scientificName,
                 java.lang.String commonName)
Creates a new WeakTaxon object.

Parameters:
scientificName - DOCUMENT ME!
commonName - DOCUMENT ME!
Method Detail

getParent

public Taxon getParent()
DOCUMENT ME!

Returns:
DOCUMENT ME!

isRoot

public boolean isRoot()
DOCUMENT ME!

Returns:
DOCUMENT ME!

isLeaf

public boolean isLeaf()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getChildren

public java.util.Set getChildren()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getChildrenRaw

public java.util.Set getChildrenRaw()
DOCUMENT ME!

Returns:
DOCUMENT ME!

setChildrenRaw

public void setChildrenRaw(java.util.Set children)
DOCUMENT ME!

Parameters:
children - DOCUMENT ME!