com.facetmap
Interface Selection

All Known Implementing Classes:
SelectionData

public interface Selection

Encapsulates the available navigation options as well as the current result set of Resources. A Selection is similar to a category that resources fit into -- except that, because it's a permutation of multiple Headings, it's not generally predefined as a category. An implementation of Selection should contain the logic to generate such "categories" on the fly.

The source data for a Selection are simply Headings, one along each Facet dimension. The resultant data -- selected Resources, forward navigation, and backward navigation -- can be determined from the Headings in the Selection.


Method Summary
 boolean containsAnyResources()
           
 void decodeRef(java.lang.String refCode)
          Sets the Headings of this Selection according to the given ref.
 java.util.Enumeration getBackwardSelections(int index)
          An Enumeration of the Selections that represent "backtracking" in navigation along the given dimension of facetspace.
 int getContainedResourceCount()
           
 Resource[] getContainedResources()
          A Resource may have a Heading that is contained by a Heading in this Selection.
 int getDimensionCount()
           
 java.util.Enumeration getForwardSelections(int index)
          An Enumeration of the Selections that are the possible "next steps" in navigation along the given dimension of facetspace.
 Heading getHeading(int index)
          Returns the Heading along the given dimension of facetspace.
 Map getMap()
           
 int getMatchedResourceCount()
           
 Resource[] getMatchedResources()
          If each of a Resource's Headings match this Selection's Headings, then that Resource is included in the returned array.
 java.lang.String getRef()
          Returns a String ID (known as a reference or "ref") that uniquely identifies this Selection.
 boolean isMasterRoot()
          Returns true if each of this Selection's Headings is the Root of its Facet.
 boolean matchesAnyResources()
           
 void setHeading(Heading heading)
          Sets the given Heading as a Heading of this Selection.
 

Method Detail

getMap

public Map getMap()

getDimensionCount

public int getDimensionCount()

isMasterRoot

public boolean isMasterRoot()
Returns true if each of this Selection's Headings is the Root of its Facet.

See Also:
Facet.getRootHeading()

getRef

public java.lang.String getRef()
Returns a String ID (known as a reference or "ref") that uniquely identifies this Selection.


decodeRef

public void decodeRef(java.lang.String refCode)
               throws UnknownReferenceException
Sets the Headings of this Selection according to the given ref.

Throws:
UnknownReferenceException

getHeading

public Heading getHeading(int index)
                   throws java.lang.ArrayIndexOutOfBoundsException
Returns the Heading along the given dimension of facetspace.

Throws:
java.lang.ArrayIndexOutOfBoundsException

setHeading

public void setHeading(Heading heading)
                throws java.lang.IllegalArgumentException
Sets the given Heading as a Heading of this Selection. The given Heading replaces any Heading that is from the same Facet.

Throws:
java.lang.IllegalArgumentException

containsAnyResources

public boolean containsAnyResources()
                             throws InternalException
Throws:
InternalException

matchesAnyResources

public boolean matchesAnyResources()
                            throws InternalException
Throws:
InternalException

getMatchedResourceCount

public int getMatchedResourceCount()
                            throws InternalException
Throws:
InternalException

getContainedResourceCount

public int getContainedResourceCount()
                              throws InternalException
Throws:
InternalException

getMatchedResources

public Resource[] getMatchedResources()
                               throws InternalException
If each of a Resource's Headings match this Selection's Headings, then that Resource is included in the returned array.

Throws:
InternalException

getContainedResources

public Resource[] getContainedResources()
                                 throws InternalException
A Resource may have a Heading that is contained by a Heading in this Selection. The definition of "contained" differs depending on the type of Facet (e.g. a Heading in a Taxonomy is contained if this Selection's Heading matches or is its ancestor). The returned array must include every Resource that would be returned by getMatchedResources(), but it also includes Resources that are otherwise "contained".

Throws:
InternalException

getForwardSelections

public java.util.Enumeration getForwardSelections(int index)
                                           throws InternalException,
                                                  java.lang.ArrayIndexOutOfBoundsException
An Enumeration of the Selections that are the possible "next steps" in navigation along the given dimension of facetspace.

If autoSelectOnlyChild is set true on this Selection's Map, then this method may not return exactly one Selection (an "only child"). If it would ordinarily return an only child, it must return the forward selections of that child (and act recursively until the size of the result set is not one).

If showEmptySelections is set true on this Selection's Map, this method will return all possible forward Selections, even those that contain no resources (as defined by getContainedResources). Otherwise, Selections with no contained resources must not appear in the result.

Throws:
InternalException
java.lang.ArrayIndexOutOfBoundsException
See Also:
Map.setAutoSelectOnlyChild(boolean), Map.setShowEmptySelections(boolean)

getBackwardSelections

public java.util.Enumeration getBackwardSelections(int index)
                                            throws InternalException,
                                                   java.lang.ArrayIndexOutOfBoundsException
An Enumeration of the Selections that represent "backtracking" in navigation along the given dimension of facetspace. Exactly what "backtracking" entails is a little dependent on the type of Facet used in this dimension. It is never required that a returned Selection be a Selection already visited by the user; see the notes on directionality in Facet.

Throws:
InternalException
java.lang.ArrayIndexOutOfBoundsException
See Also:
Facet