com.facetmap.sql
Class SpectrumImpl
java.lang.Object
com.facetmap.simple.SimpleFacet
com.facetmap.simple.SimpleTaxonomyFacet
com.facetmap.sql.LinearFacet
com.facetmap.sql.SpectrumImpl
- All Implemented Interfaces:
- Facet, SpectrumFacet, SqlFacet, TaxonomyFacet
public class SpectrumImpl
- extends LinearFacet
- implements SpectrumFacet
| Nested classes/interfaces inherited from interface com.facetmap.Facet |
Facet.Util |
|
Constructor Summary |
SpectrumImpl(SpectrumFacet sourceSpectrum)
|
SpectrumImpl(java.lang.String id,
java.lang.String title,
SpectrumHeadingImpl heading)
Constructs a Spectrum that covers the range of the given
SpectrumHeading. |
SpectrumImpl(java.lang.String id,
java.lang.String title,
java.lang.String rootHeadingTitle,
int min,
int max)
Constructs a Spectrum ranging from min to
max. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
defaultTitleTemplate
public static java.lang.String defaultTitleTemplate
constrainRootMinimum
protected boolean constrainRootMinimum
- Mutates the spectrum's root
minimum and maximum values so the range is the narrowest range that
fits all resources in the spectrum.
constrainRootMaximum
protected boolean constrainRootMaximum
SpectrumImpl
public SpectrumImpl(SpectrumFacet sourceSpectrum)
SpectrumImpl
public SpectrumImpl(java.lang.String id,
java.lang.String title,
java.lang.String rootHeadingTitle,
int min,
int max)
- Constructs a Spectrum ranging from
min to
max. The rootHeadingTitle argument may be left null,
in which case the root heading's title will be automatically
created from the min and max values.
SpectrumImpl
public SpectrumImpl(java.lang.String id,
java.lang.String title,
SpectrumHeadingImpl heading)
- Constructs a Spectrum that covers the range of the given
SpectrumHeading. That heading becomes the root of the new Spectrum.
This is useful for importing a desired part of a remote Spectrum,
or for other internal purposes.
sqlCreate
public void sqlCreate(java.sql.Connection connection,
java.lang.String vendor)
throws java.sql.SQLException
- Specified by:
sqlCreate in interface SqlFacet- Overrides:
sqlCreate in class LinearFacet
- Throws:
java.sql.SQLException
getRootHeading
public Heading getRootHeading()
- Description copied from interface:
Facet
- A facet structure is rooted at the heading returned by this method.
The root provides a starting point for navigation through this facet
structure; the root will be one of the headings in the Selection
that contains all Resources. The root Heading should have no backward
Heading.
In most cases, Resources that are not mapped to any Heading in this
Facet are implicitly mapped to this function's return value.
Selection.getBackwardSelections(). In some subinterfaces, the root
takes on a more familiar role, e.g. the root node of a Taxonomy.
- Specified by:
getRootHeading in interface Facet- Overrides:
getRootHeading in class SimpleFacet
- See Also:
Selection.getForwardSelections(com.facetmap.Facet)
getDefinedHeadingCount
public int getDefinedHeadingCount()
- Specified by:
getDefinedHeadingCount in interface SpectrumFacet
getSpectrumHeading
public SpectrumHeading getSpectrumHeading(int min,
int max)
- Description copied from interface:
SpectrumFacet
- Encapsulates a range of values in this Spectrum as a Heading. If the
specified minimum or maximum is beyond the range of the Spectrum,
this method may silently accept the arguments anyway. The result
will be the same as if they were within the Spectrum, since no
Resource can be classified with a value outside the Spectrum.
- Specified by:
getSpectrumHeading in interface SpectrumFacet
getSpectrumHeading
public SpectrumHeading getSpectrumHeading(int value)
- Description copied from interface:
SpectrumFacet
- Get a SpectrumHeading that represents a single discrete value,
not a range. This is usually the sort of SpectrumHeading mapped
to a Resource.
- Specified by:
getSpectrumHeading in interface SpectrumFacet
getSqlHeading
public Heading getSqlHeading(Heading sourceHeading)
throws UnknownReferenceException
- Description copied from interface:
SqlFacet
- Returns the Heading from this SqlFacet that corresponds to the input
sourceHeading. This is used to rapidly translate true resource headings
to SQL-based resource headings.
If no such heading exists in this SqlFacet (and if it is not correct
behavior to create it), then this method returns null. This method may
throw UnknownReferenceException if the sourceHeading contains
references which do not resolve correctly.
- Specified by:
getSqlHeading in interface SqlFacet- Overrides:
getSqlHeading in class LinearFacet
- Throws:
UnknownReferenceException
getSpectrumHeading
public SpectrumHeading getSpectrumHeading(java.lang.String id)
throws UnknownReferenceException
- Specified by:
getSpectrumHeading in interface SpectrumFacet
- Throws:
UnknownReferenceException
getTitleTemplate
public java.lang.String getTitleTemplate()
setTitleTemplate
public void setTitleTemplate(java.lang.String template)
- Sets the title template for range Headings in this Spectrum. The
string "%0" is replaced with the minimum of the range, and the string
"%1" is replaced with the maximum of the range.
createHeadingTitle
public java.lang.String createHeadingTitle(Range range)
createAnonymousSpectrumHeading
public SpectrumHeadingImpl createAnonymousSpectrumHeading(int min,
int max)
getHeadingsWithin
public java.util.Vector getHeadingsWithin(IndexedHeading heading)