Class ResultSetImpl<E extends Result>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- org.jivesoftware.openfire.resultsetmanager.ResultSet<E>
-
- org.jivesoftware.openfire.resultsetmanager.ResultSetImpl<E>
-
- Type Parameters:
E- Each result set should be a collection of instances of the exact same class. This class must implement theResultinterface.
- All Implemented Interfaces:
Iterable<E>,Collection<E>
@Deprecated public class ResultSetImpl<E extends Result> extends ResultSet<E>
Deprecated.Replaced byResultSetImplA result set representation as described in XEP-0059. Note that this result 'set' actually makes use of a List implementations, as the Java Set definition disallows duplicate elements, while the List definition supplies most of the required indexing operations. This ResultSet implementation loads all all results from the set into memory, which might be undesirable for very large sets, or for sets where the retrieval of a result is an expensive operation. sets. As most methods are backed by theList.subList(int, int)method, non-structural changes in the returned lists are reflected in the ResultSet, and vice-versa.- Author:
- Guus der Kinderen, guus@nimbuzz.com
- See Also:
List.subList(int, int)
-
-
Field Summary
Fields Modifier and Type Field Description List<E>resultListDeprecated.A list of all results in this ResultSetMap<String,Integer>uidToIndexDeprecated.A mapping of the UIDs of all results in resultList, to the index of those entries in that list.-
Fields inherited from class org.jivesoftware.openfire.resultsetmanager.ResultSet
NAMESPACE_RESULT_SET_MANAGEMENT
-
-
Constructor Summary
Constructors Constructor Description ResultSetImpl(Collection<E> results)Deprecated.Creates a new Result Set instance, based on a collection of Result implementing objects.ResultSetImpl(Collection<E> results, Comparator<E> comparator)Deprecated.Creates a new Result Set instance, based on a collection of Result implementing objects.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Eget(int index)Deprecated.Returns the element denoted by the index.List<E>get(int fromIndex, int maxAmount)Deprecated.Returns a list of results, starting with the result that's at the specified index.List<E>getAfter(String uid, int maxAmount)Deprecated.Returns a List of results starting with the first result after the result that's identified by the provided UID (the returned List is exclusive).List<E>getBefore(String uid, int maxAmount)Deprecated.Returns a list of results ending with the element right before the element identified by the provided UID (the returned List is exclusive).List<E>getFirst(int maxAmount)Deprecated.Returns the first elements from this result set.List<E>getLast(int maxAmount)Deprecated.Returns the last elements from this result set.intindexOf(String uid)Deprecated.Returns the index in the full resultset of the element identified by the UID in te supplied argument.intsize()Deprecated.-
Methods inherited from class org.jivesoftware.openfire.resultsetmanager.ResultSet
applyRSMDirectives, generateSetElementFromResults, getAfter, getBefore, getUID, indexOf, isValidRSMRequest, iterator
-
Methods inherited from class java.util.AbstractCollection
add, addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
-
-
-
-
Constructor Detail
-
ResultSetImpl
public ResultSetImpl(Collection<E> results)
Deprecated.Creates a new Result Set instance, based on a collection of Result implementing objects. The collection should contain elements of the exact same class only, and cannot contain 'null' elements. The order that's being used in the new ResultSet instance is the same order in whichCollection.iterator()iterates over the collection. Note that this constructor throws an IllegalArgumentException if the Collection that is provided contains Results that have duplicate UIDs.- Parameters:
results- The collection of Results that make up this result set.
-
ResultSetImpl
public ResultSetImpl(Collection<E> results, Comparator<E> comparator)
Deprecated.Creates a new Result Set instance, based on a collection of Result implementing objects. The collection should contain elements of the exact same class only, and cannot contain 'null' elements. The order that's being used in the new ResultSet instance is defined by the supplied Comparator class. Note that this constructor throws an IllegalArgumentException if the Collection that is provided contains Results that have duplicate UIDs.- Parameters:
results- The collection of Results that make up this result set.comparator- The Comparator that defines the order of the Results in this result set.
-
-
Method Detail
-
size
public int size()
Deprecated.- Specified by:
sizein interfaceCollection<E extends Result>- Specified by:
sizein classAbstractCollection<E extends Result>
-
getAfter
public List<E> getAfter(String uid, int maxAmount)
Deprecated.Description copied from class:ResultSetReturns a List of results starting with the first result after the result that's identified by the provided UID (the returned List is exclusive). The lenght of the list is equal to 'maxAmount', unless there are no more elements available (in which case the length of the result will be truncated).- Specified by:
getAfterin classResultSet<E extends Result>- Parameters:
uid- The UID of the element that is right before the first element in the result.maxAmount- The maximum number of elements to return.- Returns:
- A List of elements the are exactly after the element that is provided as a parameter.
-
getBefore
public List<E> getBefore(String uid, int maxAmount)
Deprecated.Description copied from class:ResultSetReturns a list of results ending with the element right before the element identified by the provided UID (the returned List is exclusive). At most 'maxAmount' elements are in the returned List, but the lenght of the result might be smaller if no more applicable elements are available. Note that the order of the result is equal to the order of the results of other methods of this class: the last element in the returned List immediately preceeds the element denoted by the 'result' parameter.- Specified by:
getBeforein classResultSet<E extends Result>- Parameters:
uid- The UID of the element preceding the last element returned by this function.maxAmount- The length of the List that is being returned.- Returns:
- A List of elements that are exactly before the element that's provided as a parameter.
-
get
public E get(int index)
Deprecated.Description copied from class:ResultSetReturns the element denoted by the index.
-
getFirst
public List<E> getFirst(int maxAmount)
Deprecated.Description copied from class:ResultSetReturns the first elements from this result set.
-
getLast
public List<E> getLast(int maxAmount)
Deprecated.Description copied from class:ResultSetReturns the last elements from this result set.
-
get
public List<E> get(int fromIndex, int maxAmount)
Deprecated.Description copied from class:ResultSetReturns a list of results, starting with the result that's at the specified index. If the difference between the startIndex and the index of the last element in the entire resultset is smaller than the size supplied in the 'amount' parameter, the length of the returned list will be smaller than the 'amount' paramater. If the supplied index is equal to, or larger than the size of the result set, an empty List is returned.- Specified by:
getin classResultSet<E extends Result>- Parameters:
fromIndex- The index of the first element to be returned.maxAmount- The maximum number of elements to return.- Returns:
- A list of elements starting with (inclusive) the element referenced by 'fromIndex'. An empty List if startIndex is equal to or bigger than the size of this entire result set.
-
-