org.exist.dom
Class DefaultDocumentSet

java.lang.Object
  extended by org.exist.util.hashtable.AbstractHashtable
      extended by org.exist.util.hashtable.Int2ObjectHashMap
          extended by org.exist.dom.DefaultDocumentSet
All Implemented Interfaces:
DocumentSet, MutableDocumentSet

public class DefaultDocumentSet
extends Int2ObjectHashMap
implements MutableDocumentSet

Manages a set of documents. This class implements the NodeList interface for a collection of documents. It also contains methods to retrieve the collections these documents belong to.

Author:
wolf

Field Summary
 
Fields inherited from interface org.exist.dom.DocumentSet
EMPTY_DOCUMENT_SET
 
Constructor Summary
DefaultDocumentSet()
           
DefaultDocumentSet(int initialSize)
           
 
Method Summary
 void add(DocumentImpl doc)
           
 void add(DocumentImpl doc, boolean checkDuplicates)
           
 void add(Node node)
           
 void addAll(DBBroker broker, Collection collection, String[] paths, boolean checkPermissions)
          Fast method to add a bunch of documents from a Java collection.
 void addAll(DBBroker broker, Collection collection, String[] paths, LockedDocumentMap lockMap, int lockType)
          Fast method to add a bunch of documents from a Java collection.
 void addAll(DocumentSet other)
           
 void addCollection(Collection collection)
           
 void clear()
           
 boolean contains(DocumentSet other)
           
 boolean contains(int id)
           
 NodeSet docsToNodeSet()
           
 boolean equalDocs(DocumentSet other)
           
 int getCollectionCount()
           
 Iterator getCollectionIterator()
           
 DocumentImpl getDoc(int docId)
           
 DocumentImpl getDocumentAt(int pos)
           
 int getDocumentCount()
           
 Iterator getDocumentIterator()
           
 int getMaxDocId()
           
 int getMinDocId()
           
 XmldbURI[] getNames()
           
 DocumentSet intersection(DocumentSet other)
           
 void lock(DBBroker broker, boolean exclusive, boolean checkExisting)
           
 String toString()
           
 DocumentSet union(DocumentSet other)
           
 void unlock(boolean exclusive)
           
 
Methods inherited from class org.exist.util.hashtable.Int2ObjectHashMap
containsKey, get, iterator, put, remove, valueIterator
 
Methods inherited from class org.exist.util.hashtable.AbstractHashtable
getMaxRehash, isPrime, nextPrime, size
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultDocumentSet

public DefaultDocumentSet()

DefaultDocumentSet

public DefaultDocumentSet(int initialSize)
Method Detail

clear

public void clear()
Specified by:
clear in interface MutableDocumentSet
Overrides:
clear in class Int2ObjectHashMap

add

public void add(DocumentImpl doc)
Specified by:
add in interface MutableDocumentSet

add

public void add(DocumentImpl doc,
                boolean checkDuplicates)
Specified by:
add in interface MutableDocumentSet

add

public void add(Node node)

addAll

public void addAll(DocumentSet other)
Specified by:
addAll in interface MutableDocumentSet

addAll

public void addAll(DBBroker broker,
                   Collection collection,
                   String[] paths,
                   boolean checkPermissions)
Fast method to add a bunch of documents from a Java collection. The method assumes that no duplicate entries are in the input collection.

Specified by:
addAll in interface MutableDocumentSet

addAll

public void addAll(DBBroker broker,
                   Collection collection,
                   String[] paths,
                   LockedDocumentMap lockMap,
                   int lockType)
            throws LockException
Fast method to add a bunch of documents from a Java collection. A lock will be acquired on each document. The locked document is added to the specified LockedDocumentMap in order to keep track of the locks..

Specified by:
addAll in interface MutableDocumentSet
Parameters:
broker -
collection -
paths -
lockMap -
lockType -
Throws:
LockException

addCollection

public void addCollection(Collection collection)
Specified by:
addCollection in interface MutableDocumentSet

getDocumentIterator

public Iterator getDocumentIterator()
Specified by:
getDocumentIterator in interface DocumentSet

getCollectionIterator

public Iterator getCollectionIterator()
Specified by:
getCollectionIterator in interface DocumentSet

getDocumentCount

public int getDocumentCount()
Specified by:
getDocumentCount in interface DocumentSet

getCollectionCount

public int getCollectionCount()

getDocumentAt

public DocumentImpl getDocumentAt(int pos)
Specified by:
getDocumentAt in interface DocumentSet

getDoc

public DocumentImpl getDoc(int docId)
Specified by:
getDoc in interface DocumentSet

getNames

public XmldbURI[] getNames()
Specified by:
getNames in interface DocumentSet

intersection

public DocumentSet intersection(DocumentSet other)
Specified by:
intersection in interface DocumentSet

union

public DocumentSet union(DocumentSet other)

contains

public boolean contains(DocumentSet other)
Specified by:
contains in interface DocumentSet

contains

public boolean contains(int id)
Specified by:
contains in interface DocumentSet

docsToNodeSet

public NodeSet docsToNodeSet()
Specified by:
docsToNodeSet in interface DocumentSet

getMinDocId

public int getMinDocId()

getMaxDocId

public int getMaxDocId()

equalDocs

public boolean equalDocs(DocumentSet other)
Specified by:
equalDocs in interface DocumentSet

lock

public void lock(DBBroker broker,
                 boolean exclusive,
                 boolean checkExisting)
          throws LockException
Specified by:
lock in interface DocumentSet
Throws:
LockException

unlock

public void unlock(boolean exclusive)
Specified by:
unlock in interface DocumentSet

toString

public String toString()
Overrides:
toString in class Object


Copyright (C) Wolfgang Meier. All rights reserved.