Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.history
Class OrderedQueryResultSet<T>

java.lang.Object
  extended by net.java.sip.communicator.impl.history.OrderedQueryResultSet<T>
Type Parameters:
T - element type of query
All Implemented Interfaces:
Iterator<T>, BidirectionalIterator<T>, QueryResultSet<T>

public class OrderedQueryResultSet<T>
extends Object
implements QueryResultSet<T>

This implementation is the same as DefaultQueryResultSet but the container holding the records is LinkedList - so guarantees that values are ordered

Author:
Damian Minkov

Constructor Summary
OrderedQueryResultSet(Set<T> records)
          Constructor.
 
Method Summary
 boolean hasNext()
          Returns true if the iteration has more elements.
 boolean hasPrev()
          Returns true if the iteration has elements preceeding the current one.
 T next()
          Returns the next element in the iteration.
 T nextRecord()
          A strongly-typed variant of next().
 T prev()
          Returns the previous element in the iteration.
 T prevRecord()
          A strongly-typed variant of prev().
 void remove()
          Removes from the underlying collection the last element returned by the iterator (optional operation).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OrderedQueryResultSet

public OrderedQueryResultSet(Set<T> records)
Constructor.

Parameters:
records - the Set of records
Method Detail

hasNext

public boolean hasNext()
Returns true if the iteration has more elements.

Specified by:
hasNext in interface Iterator<T>
Returns:
true if the iterator has more elements.

hasPrev

public boolean hasPrev()
Returns true if the iteration has elements preceeding the current one.

Specified by:
hasPrev in interface BidirectionalIterator<T>
Returns:
true if the iterator has preceeding elements.

next

public T next()
Returns the next element in the iteration.

Specified by:
next in interface Iterator<T>
Returns:
the next element in the iteration.

nextRecord

public T nextRecord()
             throws NoSuchElementException
A strongly-typed variant of next().

Specified by:
nextRecord in interface QueryResultSet<T>
Returns:
the next history record.
Throws:
NoSuchElementException - iteration has no more elements.

prev

public T prev()
       throws NoSuchElementException
Returns the previous element in the iteration.

Specified by:
prev in interface BidirectionalIterator<T>
Returns:
the previous element in the iteration.
Throws:
NoSuchElementException - iteration has no more elements.

prevRecord

public T prevRecord()
             throws NoSuchElementException
A strongly-typed variant of prev().

Specified by:
prevRecord in interface QueryResultSet<T>
Returns:
the previous history record.
Throws:
NoSuchElementException - iteration has no more elements.

remove

public void remove()
Removes from the underlying collection the last element returned by the iterator (optional operation).

Specified by:
remove in interface Iterator<T>

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.