Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.database
Class ForumMessageBlockIterator

java.lang.Object
  extended by com.jivesoftware.forum.ForumMessageIterator
      extended by com.jivesoftware.forum.database.ForumMessageBlockIterator
All Implemented Interfaces:
java.util.Iterator

public class ForumMessageBlockIterator
extends ForumMessageIterator

A iterator for blocks of message ID's.


Field Summary
 
Fields inherited from class com.jivesoftware.forum.ForumMessageIterator
EMPTY_ITERATOR
 
Constructor Summary
protected ForumMessageBlockIterator(long[] block, CachedPreparedStatement query, int startIndex, int endIndex, int objectType, long objectID)
          Constructs a new ForumMessageBlockIterator.
 
Method Summary
 boolean hasNext()
          Returns true if this iterator has more messages when traversing the list in the forward direction.
 boolean hasPrevious()
          Returns true if this list iterator has more messages when traversing the list in the reverse direction.
 java.lang.Object next()
          Returns the next message in the list.
 java.lang.Object previous()
          Returns the previous element in the list.
 void setIndex(long messageID)
          Sets the index for the iteration to the specified message ID.
 
Methods inherited from class com.jivesoftware.forum.ForumMessageIterator
remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ForumMessageBlockIterator

protected ForumMessageBlockIterator(long[] block,
                                    CachedPreparedStatement query,
                                    int startIndex,
                                    int endIndex,
                                    int objectType,
                                    long objectID)
Constructs a new ForumMessageBlockIterator.

Parameters:
block - the array of id's to iterate through.
query - the query used to select the block.
startIndex - the starting index in the block to being iteration at.
endIndex - the endeding index in the set to end iteration at. This may or not be in the current block. If it ends after the current block, the next block will be loaded automatically as necessary.
objectType - the object type associated with this block.
objectID - the ID of the object associated with this block.
Method Detail

hasNext

public boolean hasNext()
Description copied from class: ForumMessageIterator
Returns true if this iterator has more messages when traversing the list in the forward direction. (In other words, returns true if next would return a message rather than throwing an exception.)

Specified by:
hasNext in interface java.util.Iterator
Specified by:
hasNext in class ForumMessageIterator
Returns:
true if the iterator has more messages when traversing the list in the forward direction.

hasPrevious

public boolean hasPrevious()
Description copied from class: ForumMessageIterator
Returns true if this list iterator has more messages when traversing the list in the reverse direction. (In other words, returns true if previous would return a thread rather than throwing an exception.)

Specified by:
hasPrevious in class ForumMessageIterator
Returns:
true if the list iterator has more elements when traversing the list in the reverse direction.

next

public java.lang.Object next()
                      throws java.util.NoSuchElementException
Description copied from class: ForumMessageIterator
Returns the next message in the list. This method may be called repeatedly to iterate through the list, or intermixed with calls to previous to go back and forth. (Note that alternating calls to next and previous will return the same element repeatedly.)

Specified by:
next in interface java.util.Iterator
Specified by:
next in class ForumMessageIterator
Returns:
the next thread in the list.
Throws:
java.util.NoSuchElementException - if the iteration has no next element.

previous

public java.lang.Object previous()
Description copied from class: ForumMessageIterator
Returns the previous element in the list. This method may be called repeatedly to iterate through the list backwards, or intermixed with calls to next to go back and forth. (Note that alternating calls to next and previous will return the same element repeatedly.)

Specified by:
previous in class ForumMessageIterator
Returns:
the previous element in the list.

setIndex

public void setIndex(long messageID)
Description copied from class: ForumMessageIterator
Sets the index for the iteration to the specified message ID.

Implementation note: a performance setting allows an optional short-term query cache so that object invalidations are delayed for a period of time. This can mean that trying to set the index for a newly created message can fail. Ensure that this performance setting is disabled, or refrain from calling this method with newly created messages.

Specified by:
setIndex in class ForumMessageIterator

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.