Class AbstractDocumentCollection

    • Constructor Detail

      • AbstractDocumentCollection

        public AbstractDocumentCollection()
    • Method Detail

      • ensureDocumentIndex

        protected void ensureDocumentIndex​(long index)
        Checks that the index is correct (between 0, inclusive, and DocumentCollection.size(), exclusive), and throws an IndexOutOfBoundsException if the index is not correct.
        Parameters:
        index - the index to be checked.
      • iterator

        public DocumentIterator iterator()
                                  throws IOException
        Description copied from interface: DocumentSequence
        Returns an iterator over the sequence of documents.

        Warning: this method can be safely called just one time. For instance, implementations based on standard input will usually throw an exception if this method is called twice.

        Implementations may decide to override this restriction (in particular, if they implement DocumentCollection). Usually, however, it is not possible to obtain two iterators at the same time on a collection.

        Specified by:
        iterator in interface DocumentSequence
        Returns:
        an iterator over the sequence of documents.
        Throws:
        IOException
        See Also:
        DocumentCollection
      • printAllDocuments

        public static void printAllDocuments​(DocumentSequence seq)
                                      throws IOException
        Prints all documents in a given sequence.
        Parameters:
        seq - the sequence.
        Throws:
        IOException