com.facetmap.simple
Class SimpleFacetSpace

java.lang.Object
  extended bycom.facetmap.simple.SimpleFacetSpace
All Implemented Interfaces:
FacetSpace

public class SimpleFacetSpace
extends java.lang.Object
implements FacetSpace

A Vector-based FacetSpace that only supports Taxonomy facets. This object changes on the fly whenever the addFacet() method is used. Selection refs generated before such a change may not be valid after the change.


Field Summary
protected  java.util.Hashtable facetHash
          Indexes facets by name.
protected  java.util.Vector facets
          Indexes facets by number.
protected  int version
           
 
Constructor Summary
SimpleFacetSpace()
          Create an empty but valid SimpleFacetSpace.
 
Method Summary
 void addFacet(Facet facet)
          Appends the given Taxonomy to this FacetSpace.
 Facet createFacet(java.lang.String id, java.lang.String title, Heading root)
          Creates a new Facet structure suitable for adding to this FacetSpace.
 Spectrum createSpectrum(java.lang.String id, java.lang.String title, java.lang.String rootHeadingTitle, int min, int max)
          Creates a new Spectrum facet structure suitable for adding to this FacetSpace.
 Taxonomy createTaxonomy(java.lang.String id, java.lang.String title, java.lang.String rootHeadingTitle)
          Creates a new Taxonomy facet structure suitable for adding to this FacetSpace.
 Facet getFacet(int index)
          Returns the Facet at the given index.
 Facet getFacet(java.lang.String id)
          Returns the Facet with the given identifier.
 int getFacetCount()
          Returns the number of dimensions in this FacetSpace.
 Spectrum getSpectrum(java.lang.String id)
          Returns the Spectrum with the given identifier.
protected  Taxonomy getTaxonomy(int index)
           
 Taxonomy getTaxonomy(java.lang.String id)
          Returns the Taxonomy with the given identifier.
 java.lang.String getVersion()
          Returns zero -- version is not supported by this implementation.
 int indexOf(Facet t)
          Returns the index number of the dimension the Facet occupies.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

facets

protected java.util.Vector facets
Indexes facets by number.


facetHash

protected java.util.Hashtable facetHash
Indexes facets by name. If a taxonomy has no name, the name is its index number in the Vector.


version

protected int version
Constructor Detail

SimpleFacetSpace

public SimpleFacetSpace()
Create an empty but valid SimpleFacetSpace.

Method Detail

getFacetCount

public int getFacetCount()
Description copied from interface: FacetSpace
Returns the number of dimensions in this FacetSpace.

Specified by:
getFacetCount in interface FacetSpace

getFacet

public Facet getFacet(int index)
Description copied from interface: FacetSpace
Returns the Facet at the given index.

Specified by:
getFacet in interface FacetSpace

getFacet

public Facet getFacet(java.lang.String id)
               throws UnknownReferenceException
Description copied from interface: FacetSpace
Returns the Facet with the given identifier.

Specified by:
getFacet in interface FacetSpace
Throws:
UnknownReferenceException

getTaxonomy

public Taxonomy getTaxonomy(java.lang.String id)
Description copied from interface: FacetSpace
Returns the Taxonomy with the given identifier.

Specified by:
getTaxonomy in interface FacetSpace

getSpectrum

public Spectrum getSpectrum(java.lang.String id)
Description copied from interface: FacetSpace
Returns the Spectrum with the given identifier.

Specified by:
getSpectrum in interface FacetSpace

addFacet

public void addFacet(Facet facet)
Description copied from interface: FacetSpace
Appends the given Taxonomy to this FacetSpace. Currently, structures may not be inserted into a given index position.

Specified by:
addFacet in interface FacetSpace

createTaxonomy

public Taxonomy createTaxonomy(java.lang.String id,
                               java.lang.String title,
                               java.lang.String rootHeadingTitle)
Description copied from interface: FacetSpace
Creates a new Taxonomy facet structure suitable for adding to this FacetSpace.

Specified by:
createTaxonomy in interface FacetSpace

createSpectrum

public Spectrum createSpectrum(java.lang.String id,
                               java.lang.String title,
                               java.lang.String rootHeadingTitle,
                               int min,
                               int max)
                        throws DataException
Description copied from interface: FacetSpace
Creates a new Spectrum facet structure suitable for adding to this FacetSpace.

Specified by:
createSpectrum in interface FacetSpace
Throws:
DataException

createFacet

public Facet createFacet(java.lang.String id,
                         java.lang.String title,
                         Heading root)
                  throws DataException
Description copied from interface: FacetSpace
Creates a new Facet structure suitable for adding to this FacetSpace. The new Facet should be of the same type as the Facet that generated the root Heading. This method is NOT typesafe and will throw an exception at runtime if the Heading is badly typed. Use with discretion.

Specified by:
createFacet in interface FacetSpace
Throws:
DataException - if the root Heading is of a type not supported by the implementation.

getVersion

public java.lang.String getVersion()
Returns zero -- version is not supported by this implementation.

Specified by:
getVersion in interface FacetSpace

getTaxonomy

protected Taxonomy getTaxonomy(int index)

indexOf

public int indexOf(Facet t)
Description copied from interface: FacetSpace
Returns the index number of the dimension the Facet occupies. getFacet(indexOf(f)) should return f.

Specified by:
indexOf in interface FacetSpace