|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.facetmap.simple.SelectionData
public class SelectionData
A class intended for storage of Selection state. There's very little logic in here; it just accepts data and spits it out on request. It will do a bit of dynamic allocation when you set its facetmap, and it does have a rudimentary system to encode and decode its own ref.
Consider adding an equals() implementation and other basics.
| Field Summary | |
|---|---|
Facetmap |
facetmap
|
java.util.Set[] |
headingSets
Array of Sets of Headings, one Set per facet |
static Logger |
logger
|
java.util.Properties |
properties
|
RefCodec |
refCodec
|
int |
resultCount
|
int |
resultLimit
|
java.util.ArrayList |
results
|
java.util.List[] |
subsets
Array of Lists of Selections, one List per facet |
java.util.List[] |
supersets
Array of Lists of Selections, one List per facet |
| Constructor Summary | |
|---|---|
SelectionData()
Construct a SelectionData with no state defined at all. |
|
SelectionData(Facetmap facetmap)
Create a SelectionData with default or null values. |
|
SelectionData(Selection selection)
Selectively copy a Selection from another Selection. |
|
| Method Summary | |
|---|---|
boolean |
containsAnyResources()
|
void |
decodeRef(java.lang.String refCode)
Sets the Headings of this Selection according to the given ref. |
java.util.Iterator |
getBackwardSelections(Facet facet)
An Enumeration of the Selections that represent "backtracking" in navigation along the given dimension of facetspace. |
java.util.Iterator |
getBackwardSelections(int index)
An array-oriented version of Selection.getHeadings(Facet) . |
int |
getFacetCount()
|
Facetmap |
getFacetmap()
|
java.util.Iterator |
getForwardSelections(Facet facet)
An Enumeration of the Selections that are the possible "next steps" in navigation along the given dimension of facetspace. |
java.util.Iterator |
getForwardSelections(int index)
An array-oriented version of Selection.getHeadings(Facet) . |
Heading[] |
getHeadings()
|
Heading[] |
getHeadings(Facet facet)
Returns the Heading(s) of this selection in a specified facet. |
Heading[] |
getHeadings(int index)
Returns the Heading along the given dimension of facetspace. |
java.util.Properties |
getProperties()
The properties that were used in the creation of this Selection. |
java.lang.String |
getRef()
Returns a String ID (known as a reference or "ref") that uniquely identifies the Headings used to construct this Selection. |
int |
getResourceCount()
The number of Resources specified by the Headings in this Selection (regardless of any maximum specified by property com.facetmap.Selection.resultLimit). |
SelectedResourceIterator |
getResources()
Return an Iterator containing all Resources specified by this Selection, or the first N Resources specified by this Selection where N is the value of com.facetmap.Selection.resultLimit . |
java.util.Collection |
getSubset(int facetIndex)
|
java.util.Collection |
getSuperset(int facetIndex)
|
boolean |
isMasterRoot()
Returns true if each of this Selection's Headings is the Root of its Facet. |
static Heading[] |
replaceHeadings(Heading[] headings,
Selection selection)
Create a list of Headings by combining the two input arguments. |
Heading[] |
serializeHeadings(java.util.Set[] headingSets)
Inverse of sortHeadings() , but imposes some order: headings are ordered according to their facet index (ascending). |
void |
setHeadings(Heading[] headings)
Sets the given Headings as all the Headings of this Selection. |
void |
setHeadings(int index,
Heading[] headings)
Sets the given Headings as the Headings in a particular Facet of this Selection. |
void |
setHeadings(java.util.Set[] headingSets)
Sets the given Headings as all the Headings of this Selection. |
java.util.Set[] |
sortHeadings(Heading[] headings)
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final Logger logger
public java.util.Properties properties
public java.util.Set[] headingSets
public java.util.List[] supersets
public java.util.List[] subsets
public int resultCount
public int resultLimit
public java.util.ArrayList results
public Facetmap facetmap
public RefCodec refCodec
| Constructor Detail |
|---|
public SelectionData()
public SelectionData(Facetmap facetmap)
public SelectionData(Selection selection)
| Method Detail |
|---|
public java.util.Collection getSuperset(int facetIndex)
public java.util.Collection getSubset(int facetIndex)
public Heading[] getHeadings(int index)
throws java.lang.ArrayIndexOutOfBoundsException
getHeadings in interface Selectionjava.lang.ArrayIndexOutOfBoundsExceptionpublic Heading[] getHeadings()
public void setHeadings(int index,
Heading[] headings)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public void setHeadings(Heading[] headings)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic void setHeadings(java.util.Set[] headingSets)
public boolean isMasterRoot()
isMasterRoot in interface SelectionFacet.getRootHeading()public java.lang.String getRef()
SelectionThe reference does not contain information about the Properties used in this selection. If desired, those must be serialized separately.
getRef in interface Selection
public void decodeRef(java.lang.String refCode)
throws UnknownReferenceException
UnknownReferenceException
public boolean containsAnyResources()
throws InternalException
InternalException
public java.util.Iterator getForwardSelections(int index)
throws InternalException,
java.lang.ArrayIndexOutOfBoundsException
SelectionSelection.getHeadings(Facet) . Provide
the ordinal index number of the Facet within the FacetSpace, instead
of the Facet itself.
getForwardSelections in interface SelectionInternalException
java.lang.ArrayIndexOutOfBoundsException
public java.util.Iterator getBackwardSelections(int index)
throws InternalException,
java.lang.ArrayIndexOutOfBoundsException
SelectionSelection.getHeadings(Facet) . Provide
the ordinal index number of the Facet within the FacetSpace, instead
of the Facet itself.
getBackwardSelections in interface SelectionInternalException
java.lang.ArrayIndexOutOfBoundsExceptionpublic int getFacetCount()
getFacetCount in interface Selectionpublic Facetmap getFacetmap()
getFacetmap in interface Selectionpublic java.util.Properties getProperties()
Selection
getProperties in interface SelectionFacetmap.getSelection(Heading[], Properties)
public int getResourceCount()
throws InternalException
SelectionThis could be regarded as just a special case of getResourceWeight() , but of course it's by far the most common and we want a method that returns an int.
getResourceCount in interface SelectionInternalException
public SelectedResourceIterator getResources()
throws InternalException
Selection
getResources in interface SelectionInternalException
public java.util.Iterator getBackwardSelections(Facet facet)
throws InternalException,
java.lang.ArrayIndexOutOfBoundsException
Selection
getBackwardSelections in interface SelectionInternalException
java.lang.ArrayIndexOutOfBoundsExceptionFacet
public java.util.Iterator getForwardSelections(Facet facet)
throws InternalException,
java.lang.ArrayIndexOutOfBoundsException
SelectionIf property com.facetmap.Selection.autoSelectOnlyChild is set true, 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 property com.facetmap.Selection.showEmptySelections is set true, this method will return all possible forward Selections in the Facet, even those that contain no resources (as defined by getContainedResources). Otherwise, Selections with no contained resources must not appear in the result.
getForwardSelections in interface SelectionInternalException
java.lang.ArrayIndexOutOfBoundsException
public Heading[] getHeadings(Facet facet)
throws java.lang.ArrayIndexOutOfBoundsException
SelectionNote that the return value, because it is an array, can be modified. However, modifying it does not change the state of this underlying Selection. Implementors of Selection should take care that this rule is enforced.
getHeadings in interface Selectionjava.lang.ArrayIndexOutOfBoundsExceptionpublic java.util.Set[] sortHeadings(Heading[] headings)
public Heading[] serializeHeadings(java.util.Set[] headingSets)
public static Heading[] replaceHeadings(Heading[] headings,
Selection selection)
headings,
headings are copied from headings ; for all other
facets, headings are copied from selection .
public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||