com.facetmap.simple
Class SimpleCompoundHeading

java.lang.Object
  extended by com.facetmap.simple.SimpleHeading
      extended by com.facetmap.simple.SimpleCompoundHeading
All Implemented Interfaces:
CompoundHeading, Heading
Direct Known Subclasses:
CompoundIndexedHeading

public class SimpleCompoundHeading
extends SimpleHeading
implements CompoundHeading

This Heading can represent any combination of Headings from its underlying Facet. An ID is only present on CompoundHeadings representing less than two Headings.


Field Summary
protected  SimpleCompoundHeadingFacet compoundFacet
           
protected  java.util.List headings
           
 
Fields inherited from class com.facetmap.simple.SimpleHeading
id, title
 
Constructor Summary
SimpleCompoundHeading(SimpleCompoundHeadingFacet compoundFacet)
           
SimpleCompoundHeading(SimpleCompoundHeadingFacet compoundFacet, Heading heading)
           
SimpleCompoundHeading(SimpleCompoundHeadingFacet compoundFacet, java.util.List headings)
          headings is a list of assigned headings.
SimpleCompoundHeading(SimpleCompoundHeadingFacet compoundFacet, java.util.List headings, java.lang.String title)
           
 
Method Summary
 Heading getBackwardHeading()
          It seems reasonable to assume that a set of many headings can have a backward heading that also represents many headings.
 Facet getFacet()
          Facet to which this Heading belongs.
 java.util.Iterator getForwardHeadings()
          This method doesn't try to define the forward heading set of multiple headings.
 java.util.Collection getHeadings()
           
 boolean isRoot()
          Returns true if this Heading is the root, the starting Heading, of its Facet.
 boolean matches(Heading resourceHeading)
          Determines whether this heading matches the input heading, for the purposes of SimpleFacetmap routines.
 Heading popHeading()
          This type of heading, since it technically aggregates headings from different facets, doesn't fit the facetmap model well.
 void setTitle(java.lang.String title)
           
 java.lang.String toString()
           
 
Methods inherited from class com.facetmap.simple.SimpleHeading
getId, getTitle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.facetmap.Heading
getId, getTitle
 

Field Detail

compoundFacet

protected SimpleCompoundHeadingFacet compoundFacet

headings

protected java.util.List headings
Constructor Detail

SimpleCompoundHeading

public SimpleCompoundHeading(SimpleCompoundHeadingFacet compoundFacet)

SimpleCompoundHeading

public SimpleCompoundHeading(SimpleCompoundHeadingFacet compoundFacet,
                             java.util.List headings)
headings is a list of assigned headings.

Parameters:
groupFacet -
headings -

SimpleCompoundHeading

public SimpleCompoundHeading(SimpleCompoundHeadingFacet compoundFacet,
                             Heading heading)

SimpleCompoundHeading

public SimpleCompoundHeading(SimpleCompoundHeadingFacet compoundFacet,
                             java.util.List headings,
                             java.lang.String title)
Method Detail

getBackwardHeading

public Heading getBackwardHeading()
It seems reasonable to assume that a set of many headings can have a backward heading that also represents many headings. Here we try a scheme in which each Heading in the compound set takes a step backwards at the same time. Any non-root results are compounded into the returned CompoundHeading.

Specified by:
getBackwardHeading in interface Heading

getForwardHeadings

public java.util.Iterator getForwardHeadings()
This method doesn't try to define the forward heading set of multiple headings. If there more than one Heading is represented in this CompoundHeading, only forward headings from the last Heading will be provided.

TODO: determine whether it makes sense to return forward headings of all headings represented here.

Specified by:
getForwardHeadings in interface Heading

matches

public boolean matches(Heading resourceHeading)
Description copied from class: SimpleHeading
Determines whether this heading matches the input heading, for the purposes of SimpleFacetmap routines. In this method, a match of the resourceHeading's backward headings is not sufficient to return true; the resourceHeading itself must actually match. Beyond that, the definition of "match" is left to the implementation.

Note: if x.isRoot() && y.isRoot() , x must match y.

Overrides:
matches in class SimpleHeading

isRoot

public boolean isRoot()
Description copied from interface: Heading
Returns true if this Heading is the root, the starting Heading, of its Facet.

Specified by:
isRoot in interface Heading
Overrides:
isRoot in class SimpleHeading
See Also:
Facet.getRootHeading()

popHeading

public Heading popHeading()
This type of heading, since it technically aggregates headings from different facets, doesn't fit the facetmap model well. User will only be able to backtrack along the same path that was traversed to create this Heading, which is probably good enough.

To do better, this method would have to return multiple Headings: all the possible results of removing one tag from this Heading.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getHeadings

public java.util.Collection getHeadings()
Specified by:
getHeadings in interface CompoundHeading

setTitle

public void setTitle(java.lang.String title)

getFacet

public Facet getFacet()
Description copied from interface: Heading
Facet to which this Heading belongs. A Heading must belong to a Facet.

Specified by:
getFacet in interface Heading