org.apache.cocoon.components.search
Class LuceneCocoonPager

java.lang.Object
  |
  +--org.apache.cocoon.components.search.LuceneCocoonPager
All Implemented Interfaces:
java.util.Iterator, java.util.ListIterator

public class LuceneCocoonPager
extends java.lang.Object
implements java.util.ListIterator

This class should help you to manage paging of hits.

Version:
CVS $Id: LuceneCocoonPager.java,v 1.4 2002/02/22 07:00:12 cziegeler Exp $
Author:
Bernhard Huber

Inner Class Summary
static class LuceneCocoonPager.HitWrapper
          A helper class encapsulating found document, and its score
 
Field Summary
static int COUNT_OF_HITS_PER_PAGE_DEFAULT
          Description of the Field
static int HITS_INDEX_START_DEFAULT
          Description of the Field
 
Constructor Summary
LuceneCocoonPager()
          Constructor for the LuceneCocoonPager object
LuceneCocoonPager(org.apache.lucene.search.Hits hits)
           
 
Method Summary
 void add(java.lang.Object o)
          Inserts the specified element into the list (optional operation).
 int getCountOfHits()
          Get count of hits
 int getCountOfHitsPerPage()
          Get count of hits displayed per single page
 int getCountOfPages()
          Caluclate count of pages for displaying all hits
 int getStartIndex()
          Set starting index for retrieving hits
 boolean hasNext()
          Returns true if this list iterator has more elements when traversing the list in the forward direction.
 boolean hasPrevious()
          Returns true if this list iterator has more elements when traversing the list in the reverse direction.
 java.lang.Object next()
          Returns the next element in the list.
 int nextIndex()
          Returns the index of the element that would be returned by a subsequent call to next.
 java.lang.Object previous()
          Returns the previous element in the list.
 int previousIndex()
          Returns the index of the element that would be returned by a subsequent call to previous.
 void remove()
          Removes from the list the last element that was returned by next or previous (optional operation).
 void set(java.lang.Object o)
          Replaces the last element returned by next or previous with the specified element (optional operation).
 void setCountOfHitsPerPage(int countOfHitsPerPage)
          Set count of hits displayed per single page
 void setHits(org.apache.lucene.search.Hits hits)
          Sets the hits attribute of the LuceneCocoonPager object
 void setStartIndex(int start_index)
          Get starting index for retrieving hits
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COUNT_OF_HITS_PER_PAGE_DEFAULT

public static final int COUNT_OF_HITS_PER_PAGE_DEFAULT
Description of the Field
Since:
 

HITS_INDEX_START_DEFAULT

public static final int HITS_INDEX_START_DEFAULT
Description of the Field
Since:
 
Constructor Detail

LuceneCocoonPager

public LuceneCocoonPager(org.apache.lucene.search.Hits hits)
Parameters:
hits - Description of Parameter
Since:
 

LuceneCocoonPager

public LuceneCocoonPager()
Constructor for the LuceneCocoonPager object
Since:
 
Method Detail

setHits

public void setHits(org.apache.lucene.search.Hits hits)
Sets the hits attribute of the LuceneCocoonPager object
Parameters:
hits - The new hits value
Since:
 

setCountOfHitsPerPage

public void setCountOfHitsPerPage(int countOfHitsPerPage)
Set count of hits displayed per single page
Parameters:
countOfHitsPerPage - The new countOfHitsPerPage value
Since:
 

setStartIndex

public void setStartIndex(int start_index)
Get starting index for retrieving hits
Parameters:
start_index - The new startIndex value
Since:
 

set

public void set(java.lang.Object o)
Replaces the last element returned by next or previous with the specified element (optional operation).
Specified by:
set in interface java.util.ListIterator
Parameters:
o - Description of Parameter
Since:
 

getCountOfHits

public int getCountOfHits()
Get count of hits
Returns:
The count of hits
Since:
 

getCountOfHitsPerPage

public int getCountOfHitsPerPage()
Get count of hits displayed per single page
Returns:
The countOfHitsPerPage value
Since:
 

getCountOfPages

public int getCountOfPages()
Caluclate count of pages for displaying all hits
Returns:
The countOfPages value
Since:
 

getStartIndex

public int getStartIndex()
Set starting index for retrieving hits
Returns:
The startIndex value
Since:
 

add

public void add(java.lang.Object o)
         throws java.lang.UnsupportedOperationException
Inserts the specified element into the list (optional operation).
Specified by:
add in interface java.util.ListIterator
Parameters:
o - Description of Parameter
Throws:
java.lang.UnsupportedOperationException - Description of Exception
Since:
 

hasNext

public boolean hasNext()
Returns true if this list iterator has more elements when traversing the list in the forward direction.
Specified by:
hasNext in interface java.util.ListIterator
Returns:
Description of the Returned Value
Since:
 

hasPrevious

public boolean hasPrevious()
Returns true if this list iterator has more elements when traversing the list in the reverse direction.
Specified by:
hasPrevious in interface java.util.ListIterator
Returns:
Description of the Returned Value
Since:
 

next

public java.lang.Object next()
Returns the next element in the list.
Specified by:
next in interface java.util.ListIterator
Returns:
Description of the Returned Value
Since:
 

nextIndex

public int nextIndex()
Returns the index of the element that would be returned by a subsequent call to next.
Specified by:
nextIndex in interface java.util.ListIterator
Returns:
Description of the Returned Value
Since:
 

previous

public java.lang.Object previous()
Returns the previous element in the list.
Specified by:
previous in interface java.util.ListIterator
Returns:
Description of the Returned Value
Since:
 

previousIndex

public int previousIndex()
Returns the index of the element that would be returned by a subsequent call to previous.
Specified by:
previousIndex in interface java.util.ListIterator
Returns:
Description of the Returned Value
Since:
 

remove

public void remove()
Removes from the list the last element that was returned by next or previous (optional operation).
Specified by:
remove in interface java.util.ListIterator
Since:
 


Copyright © 1999-2002 Apache Software Foundation. All Rights Reserved.