|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jscience.biology.taxonomy.AbstractTaxon
org.jscience.biology.taxonomy.WeakTaxon
public class WeakTaxon
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 |
|---|
protected Taxon parent
| Constructor Detail |
|---|
public WeakTaxon(java.lang.String scientificName,
java.lang.String commonName)
scientificName - DOCUMENT ME!commonName - DOCUMENT ME!| Method Detail |
|---|
public Taxon getParent()
public boolean isRoot()
public boolean isLeaf()
public java.util.Set getChildren()
public java.util.Set getChildrenRaw()
public void setChildrenRaw(java.util.Set children)
children - DOCUMENT ME!
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||