com.xerox.bantam.util
Class DocumentListImpl

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--java.util.ArrayList
                    |
                    +--com.xerox.bantam.util.DocumentListImpl
All Implemented Interfaces:
Cloneable, Collection, DocumentList, List, Serializable

public class DocumentListImpl
extends ArrayList
implements DocumentList

An internal Document container (like ArrayList, only with some strong typing).

Version:
$Revision: 1.1 $, $Date: 2000/02/19 02:48:25 $
Author:
Keith Edwards
See Also:
Serialized Form

Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
DocumentListImpl()
           
DocumentListImpl(Collection col)
           
DocumentListImpl(int size)
           
 
Method Summary
 void add(int index, Object elem)
           
 boolean add(Object elem)
           
 boolean addAll(Collection c)
           
 void addDocument(Document doc)
          Appends the specified document to the end of the list
 void addDocument(int index, Document doc)
          Inserts the specified document at the specified position
 void addDocuments(DocumentList dl)
          Appends all of the documents in the supplied list to the end of this list, in their original order.
 boolean contains(Object elem)
           
 boolean containsDocument(Document item)
          Returns true if the list contains the specified document
 void deleteAll()
           
 Document getDocument(int index)
          Get the document at a specific position
 int indexOf(Object elem)
           
 int indexOfDocument(Document doc)
          Returns the index in this list of the first occurrence of the specified document, or -1 if this list does not contain this document.
 int lastIndexOf(Object elem)
           
 int lastIndexOfDocument(Document doc)
          Returns the index in this list of the last occurrence of the specified document, or -1 if this list does not contain this document
 boolean removeAllDocuments(Document doc)
          Removes all occurrences of the specified document, if present
 boolean removeDocument(Document doc)
          Removes the first occurrence of the specified document, if present
 Object set(int index, Object elem)
           
 void setDocument(int index, Document doc)
          Replaces the document at the specified position with the supplied document.
 
Methods inherited from class java.util.ArrayList
addAll, clear, clone, ensureCapacity, get, isEmpty, remove, removeRange, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, remove, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
addAll, clear, containsAll, equals, get, hashCode, isEmpty, iterator, listIterator, listIterator, remove, remove, removeAll, retainAll, size, subList, toArray, toArray
 

Constructor Detail

DocumentListImpl

public DocumentListImpl()

DocumentListImpl

public DocumentListImpl(int size)

DocumentListImpl

public DocumentListImpl(Collection col)
Method Detail

getDocument

public Document getDocument(int index)
Description copied from interface: DocumentList
Get the document at a specific position
Specified by:
getDocument in interface DocumentList
Following copied from interface: com.xerox.bantam.DocumentList
Parameters:
index - the index of the document to return
Returns:
the document at the specified position in this list

containsDocument

public boolean containsDocument(Document item)
Description copied from interface: DocumentList
Returns true if the list contains the specified document
Specified by:
containsDocument in interface DocumentList
Following copied from interface: com.xerox.bantam.DocumentList
Parameters:
item - - the document whose presence is to be tested.
true - iff the specified document is contained in the list

indexOfDocument

public int indexOfDocument(Document doc)
Description copied from interface: DocumentList
Returns the index in this list of the first occurrence of the specified document, or -1 if this list does not contain this document.
Specified by:
indexOfDocument in interface DocumentList
Following copied from interface: com.xerox.bantam.DocumentList
Parameters:
doc - - the document to find
Returns:
the index of the first occurrence or -1

lastIndexOfDocument

public int lastIndexOfDocument(Document doc)
Description copied from interface: DocumentList
Returns the index in this list of the last occurrence of the specified document, or -1 if this list does not contain this document
Specified by:
lastIndexOfDocument in interface DocumentList
Following copied from interface: com.xerox.bantam.DocumentList
Parameters:
doc - - the document to find
Returns:
the index of the last occurrence or -1

setDocument

public void setDocument(int index,
                        Document doc)
Description copied from interface: DocumentList
Replaces the document at the specified position with the supplied document.
Specified by:
setDocument in interface DocumentList
Following copied from interface: com.xerox.bantam.DocumentList
Parameters:
index - - index of the document to replace
doc - - the replacement document

addDocument

public void addDocument(int index,
                        Document doc)
Description copied from interface: DocumentList
Inserts the specified document at the specified position
Specified by:
addDocument in interface DocumentList
Following copied from interface: com.xerox.bantam.DocumentList
Parameters:
index - - the insertion position
doc - - the document to insert

addDocument

public void addDocument(Document doc)
Description copied from interface: DocumentList
Appends the specified document to the end of the list
Specified by:
addDocument in interface DocumentList
Following copied from interface: com.xerox.bantam.DocumentList
Parameters:
doc - - the document to append

addDocuments

public void addDocuments(DocumentList dl)
Description copied from interface: DocumentList
Appends all of the documents in the supplied list to the end of this list, in their original order.
Specified by:
addDocuments in interface DocumentList
Following copied from interface: com.xerox.bantam.DocumentList
Parameters:
dl - - list of documents to be appended

removeDocument

public boolean removeDocument(Document doc)
Description copied from interface: DocumentList
Removes the first occurrence of the specified document, if present
Specified by:
removeDocument in interface DocumentList
Following copied from interface: com.xerox.bantam.DocumentList
Parameters:
doc - - the document to remove
Returns:
true if the list contained the document

removeAllDocuments

public boolean removeAllDocuments(Document doc)
Description copied from interface: DocumentList
Removes all occurrences of the specified document, if present
Specified by:
removeAllDocuments in interface DocumentList
Following copied from interface: com.xerox.bantam.DocumentList
Parameters:
doc - - the document to remove
Returns:
true if the list contained the document

add

public void add(int index,
                Object elem)
Specified by:
add in interface List
Overrides:
add in class ArrayList

add

public boolean add(Object elem)
Specified by:
add in interface List
Overrides:
add in class ArrayList

addAll

public boolean addAll(Collection c)
Specified by:
addAll in interface List
Overrides:
addAll in class ArrayList

contains

public boolean contains(Object elem)
Specified by:
contains in interface List
Overrides:
contains in class ArrayList

indexOf

public int indexOf(Object elem)
Specified by:
indexOf in interface List
Overrides:
indexOf in class ArrayList

lastIndexOf

public int lastIndexOf(Object elem)
Specified by:
lastIndexOf in interface List
Overrides:
lastIndexOf in class ArrayList

set

public Object set(int index,
                  Object elem)
Specified by:
set in interface List
Overrides:
set in class ArrayList

deleteAll

public void deleteAll()
               throws StorageException

Project Harland