com.facetmap.simple
Class SimpleTaxonomyFacet

java.lang.Object
  extended by com.facetmap.simple.SimpleFacet
      extended by com.facetmap.simple.SimpleTaxonomyFacet
All Implemented Interfaces:
Facet, TaxonomyFacet
Direct Known Subclasses:
LinearFacet

public class SimpleTaxonomyFacet
extends SimpleFacet
implements TaxonomyFacet

Mutable reference implementation of TaxonomyFacet.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.facetmap.Facet
Facet.Util
 
Field Summary
 
Fields inherited from class com.facetmap.simple.SimpleFacet
facetid, index, nameMap, rootHeading, title
 
Constructor Summary
SimpleTaxonomyFacet(java.lang.String id, java.lang.String title, SimpleTaxonomyHeading root)
           
SimpleTaxonomyFacet(java.lang.String id, java.lang.String title, java.lang.String rootHeadingTitle)
          Construct Taxonomy with a dummy root Heading -- not recommended.
 
Method Summary
 void addHeading(SimpleTaxonomyHeading heading)
          In a TaxonomyFacet, it's clearer to add Headings with appendHeadingInto(SimpleTaxonomyHeading, SimpleTaxonomyHeading) since it indicates where the Heading is found in the taxonomy.
 void appendHeadingInto(SimpleTaxonomyHeading child, SimpleTaxonomyHeading parent)
          Convenience method to insert a heading into a parent heading, in a position after all existing children.
 Heading getHeading(java.lang.String name)
          Retrieves the Heading, with the specified ID, that is contained by this Facet.
 int getHeadingCount()
           
 SimpleTaxonomyHeading getSimpleTaxonomyHeading(java.lang.String name)
           
 TaxonomyHeading getTaxonomyHeading(java.lang.String name)
           
 void insertHeadingInto(SimpleTaxonomyHeading child, SimpleTaxonomyHeading parent, int indexWithinParent)
          A special subclass method that accommodates the index.
 int size()
           
 
Methods inherited from class com.facetmap.simple.SimpleFacet
connectHeading, containsHeading, getId, getRootHeading, getTitle, setTitle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.facetmap.Facet
getId, getRootHeading, getTitle
 

Constructor Detail

SimpleTaxonomyFacet

public SimpleTaxonomyFacet(java.lang.String id,
                           java.lang.String title,
                           java.lang.String rootHeadingTitle)
Construct Taxonomy with a dummy root Heading -- not recommended. Consumers have more control over the root Heading if they use one of the other constructors.


SimpleTaxonomyFacet

public SimpleTaxonomyFacet(java.lang.String id,
                           java.lang.String title,
                           SimpleTaxonomyHeading root)
Method Detail

getHeadingCount

public int getHeadingCount()

addHeading

public void addHeading(SimpleTaxonomyHeading heading)
In a TaxonomyFacet, it's clearer to add Headings with appendHeadingInto(SimpleTaxonomyHeading, SimpleTaxonomyHeading) since it indicates where the Heading is found in the taxonomy. If you do use addHeading, this Facet will place the specified Heading directly below the root Heading (i.e. the specified heading will be included in getRootHeading().getForwardHeadings() ).


insertHeadingInto

public void insertHeadingInto(SimpleTaxonomyHeading child,
                              SimpleTaxonomyHeading parent,
                              int indexWithinParent)
                       throws java.lang.IllegalArgumentException
A special subclass method that accommodates the index. This is the preferred method for adding headings to taxonomies.

Throws:
java.lang.IllegalArgumentException - if you break the tree model

appendHeadingInto

public void appendHeadingInto(SimpleTaxonomyHeading child,
                              SimpleTaxonomyHeading parent)
                       throws java.lang.IllegalArgumentException
Convenience method to insert a heading into a parent heading, in a position after all existing children.

Throws:
java.lang.IllegalArgumentException

getHeading

public Heading getHeading(java.lang.String name)
                   throws UnknownReferenceException
Description copied from interface: Facet
Retrieves the Heading, with the specified ID, that is contained by this Facet. If the facet doesn't recognize the ID, it will throw UnknownReferenceException.

Specified by:
getHeading in interface Facet
Overrides:
getHeading in class SimpleFacet
Throws:
UnknownReferenceException

getTaxonomyHeading

public TaxonomyHeading getTaxonomyHeading(java.lang.String name)
                                   throws UnknownReferenceException
Specified by:
getTaxonomyHeading in interface TaxonomyFacet
Throws:
UnknownReferenceException

getSimpleTaxonomyHeading

public SimpleTaxonomyHeading getSimpleTaxonomyHeading(java.lang.String name)
                                               throws UnknownReferenceException
Throws:
UnknownReferenceException

size

public int size()