com.hp.hpl.swade.portal
Class FilterState

java.lang.Object
  |
  +--com.hp.hpl.swade.portal.FilterState

public class FilterState
extends java.lang.Object

Representation for the current state of a multi-dimensional filter. Instances of this will comprise a number of FacetStates each representing one dimension of the filter.

Version:
$Revision: 1.3 $ on $Date: 2004/07/09 12:28:27 $
Author:
Dave Reynolds

Field Summary
protected  DataSource datasource
          The data source underlying this facet set
protected  java.util.Map refinementMap
          Map from facets to cached refinement count states
protected  java.util.ArrayList states
          The set of FacetStates in this filter set
protected  java.util.List wrappedResults
          An optional cached set of results of running this filter
 
Constructor Summary
FilterState(DataSource datasource)
          Constructor.
 
Method Summary
 void addFacetState(FacetState facetState)
          Add a new FacetState to filter set.
 DataSource getDataSource()
          Return the data source being filtered by this set.
 java.lang.String getEncoding()
          Return the set of facet states as a URLencoded string that could be embedded in an HTML tag to allow linking to this state.
 FacetState getFacetState(Facet facet)
          Return the facet state corresponding to the given facet.
 java.util.List getFacetStates()
          Return an iterator over all the FacetStates which make up this set.
 NodeWrapper getMatch(int i)
          Return the resource at position i in the match list.
 java.util.Iterator getMatches()
          Return an unordered iterator over those RDF root resources which match this filter state.
 int getMatchIndex(ResourceWrapper resource)
          Return the index of the given resource in the match list (-1 if not there).
 java.util.List getMatchList()
          Return a set of wrapper resource objects which match this filter state.
 java.util.List getMatchList(int start, int length)
          Return length limited subset of the wrapper resource objects which match this filter state.
 int getRefinementCount(FacetState facetState)
          Return how many times the given FacetState refinement occurs in the context of this filter state.
 java.util.List getRefinements(Facet facet)
          Return a list of all of the refinements (child facet states) for the given facet available within the context of the current filter.
 int getSize()
          Return the number of matches in the list.
 boolean isRoot()
          Return true if this is the empty filter state (all facetstates are root).
 boolean matchesReady()
          Return true if there is already a cached copy of the list of RDF resources matching this filter.
 FilterState refine(FacetState facetState)
          Refine the filter by using the supplied facetstate instead of the current state for the corresponding facet.
 FilterState removeFacet(Facet facet)
          Return a new filter state which is a clone of this one except with the given facet removed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

states

protected java.util.ArrayList states
The set of FacetStates in this filter set


refinementMap

protected java.util.Map refinementMap
Map from facets to cached refinement count states


datasource

protected DataSource datasource
The data source underlying this facet set


wrappedResults

protected java.util.List wrappedResults
An optional cached set of results of running this filter

Constructor Detail

FilterState

public FilterState(DataSource datasource)
Constructor.

Method Detail

matchesReady

public boolean matchesReady()
Return true if there is already a cached copy of the list of RDF resources matching this filter.


getMatches

public java.util.Iterator getMatches()
Return an unordered iterator over those RDF root resources which match this filter state.


getMatchList

public java.util.List getMatchList()
Return a set of wrapper resource objects which match this filter state.


getMatchList

public java.util.List getMatchList(int start,
                                   int length)
Return length limited subset of the wrapper resource objects which match this filter state.


getMatchIndex

public int getMatchIndex(ResourceWrapper resource)
Return the index of the given resource in the match list (-1 if not there).


getMatch

public NodeWrapper getMatch(int i)
Return the resource at position i in the match list.


getSize

public int getSize()
Return the number of matches in the list.


isRoot

public boolean isRoot()
Return true if this is the empty filter state (all facetstates are root).


getDataSource

public DataSource getDataSource()
Return the data source being filtered by this set.


getFacetStates

public java.util.List getFacetStates()
Return an iterator over all the FacetStates which make up this set.


getFacetState

public FacetState getFacetState(Facet facet)
Return the facet state corresponding to the given facet.


removeFacet

public FilterState removeFacet(Facet facet)
Return a new filter state which is a clone of this one except with the given facet removed.


addFacetState

public void addFacetState(FacetState facetState)
Add a new FacetState to filter set.


getRefinements

public java.util.List getRefinements(Facet facet)
Return a list of all of the refinements (child facet states) for the given facet available within the context of the current filter.


getRefinementCount

public int getRefinementCount(FacetState facetState)
Return how many times the given FacetState refinement occurs in the context of this filter state.


refine

public FilterState refine(FacetState facetState)
Refine the filter by using the supplied facetstate instead of the current state for the corresponding facet.

Returns:
a new filter which is a clone of current filter after refinement

getEncoding

public java.lang.String getEncoding()
Return the set of facet states as a URLencoded string that could be embedded in an HTML tag to allow linking to this state.



Copyright © 2004 Hewlett-Packard. All Rights Reserved.