Class ResultSetImpl<E extends Result>

  • Type Parameters:
    E - Each result set should be a collection of instances of the exact same class. This class must implement the Result interface.
    All Implemented Interfaces:
    Iterable<E>, Collection<E>

    @Deprecated
    public class ResultSetImpl<E extends Result>
    extends ResultSet<E>
    Deprecated.
    Replaced by ResultSetImpl
    A 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 the List.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 Detail

      • resultList

        public final List<E extends Result> resultList
        Deprecated.
        A list of all results in this ResultSet
      • uidToIndex

        public final Map<String,​Integer> uidToIndex
        Deprecated.
        A mapping of the UIDs of all results in resultList, to the index of those entries in that list.
    • 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 which Collection.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

      • getAfter

        public List<E> getAfter​(String uid,
                                int maxAmount)
        Deprecated.
        Description copied from class: ResultSet
        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). 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:
        getAfter in class ResultSet<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: ResultSet
        Returns 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:
        getBefore in class ResultSet<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: ResultSet
        Returns the element denoted by the index.
        Specified by:
        get in class ResultSet<E extends Result>
        Parameters:
        index - Index of the element to be returned
        Returns:
        the Element at 'index'.
      • getFirst

        public List<E> getFirst​(int maxAmount)
        Deprecated.
        Description copied from class: ResultSet
        Returns the first elements from this result set.
        Specified by:
        getFirst in class ResultSet<E extends Result>
        Parameters:
        maxAmount - the number of elements to return.
        Returns:
        the last 'maxAmount' elements of this result set.
      • getLast

        public List<E> getLast​(int maxAmount)
        Deprecated.
        Description copied from class: ResultSet
        Returns the last elements from this result set.
        Specified by:
        getLast in class ResultSet<E extends Result>
        Parameters:
        maxAmount - the number of elements to return.
        Returns:
        the last 'maxAmount' elements of this result set.
      • get

        public List<E> get​(int fromIndex,
                           int maxAmount)
        Deprecated.
        Description copied from class: ResultSet
        Returns 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:
        get in class ResultSet<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.
      • indexOf

        public int indexOf​(String uid)
        Deprecated.
        Description copied from class: ResultSet
        Returns the index in the full resultset of the element identified by the UID in te supplied argument.
        Specified by:
        indexOf in class ResultSet<E extends Result>
        Parameters:
        uid - The UID of the element to search for
        Returns:
        The index of the element.