Package net.sf.saxon.om

## Class DocumentPool

- java.lang.Object
- - net.sf.saxon.om.DocumentPool

-     public final class DocumentPool
      extends java.lang.Object

  An object representing the collection of documents handled during a single transformation.

  The function of allocating document numbers is performed by the DocumentNumberAllocator in the Configuration, not by the DocumentPool. This has a number of effects: in particular it allows operations involving multiple documents (such as generateId() and document()) to occur in a free-standing XPath environment.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DocumentPool()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `add​(TreeInfo doc, java.lang.String uri)` | Add a document to the pool
    `void` | `add​(TreeInfo doc, DocumentKey uri)` | Add a document to the pool
    `boolean` | `contains​(TreeInfo doc)` | Determine whether a given document is present in the pool
    `TreeInfo` | `discard​(TreeInfo doc)` | Release a document from the document pool.
    `void` | `discardIndexes​(KeyManager keyManager)` | Release all indexs for documents in this pool held by the KeyManager
    `TreeInfo` | `find​(java.lang.String uri)` | Get the document with a given document-uri
    `TreeInfo` | `find​(DocumentKey uri)` | Get the document with a given document-uri
    `java.lang.String` | `getDocumentURI​(NodeInfo doc)` | Get the URI for a given document node, if it is present in the pool.
    `boolean` | `isMarkedUnavailable​(DocumentKey uri)` | Ask whether a document URI is in the set of URIs known to be unavailable, because doc-available() has been previously called and has returned false
    `void` | `markUnavailable​(DocumentKey uri)` | Add a document URI to the set of URIs known to be unavailable (because doc-available() has returned false

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DocumentPool

          public DocumentPool()

  - ### Method Detail

    - #### add

          public void add​(TreeInfo doc,
                          java.lang.String uri)

      Add a document to the pool
      Parameters:
        `doc` - The DocumentInfo for the document in question
        `uri` - The document-uri property of the document.

    - #### add

          public void add​(TreeInfo doc,
                          DocumentKey uri)

      Add a document to the pool
      Parameters:
        `doc` - The DocumentInfo for the document in question
        `uri` - The document-uri property of the document.

    - #### find

          public TreeInfo find​(java.lang.String uri)

      Get the document with a given document-uri
      Parameters:
        `uri` - The document-uri property of the document.
      Returns:
        the DocumentInfo with the given document-uri property if it exists, or null if it is not found.

    - #### find

          public TreeInfo find​(DocumentKey uri)

      Get the document with a given document-uri
      Parameters:
        `uri` - The document-uri property of the document.
      Returns:
        the DocumentInfo with the given document-uri property if it exists, or null if it is not found.

    - #### getDocumentURI

          public java.lang.String getDocumentURI​(NodeInfo doc)

      Get the URI for a given document node, if it is present in the pool. This supports the document-uri() function.
      Parameters:
        `doc` - The document node
      Returns:
        The uri of the document node, if present in the pool, or the systemId of the document node otherwise

    - #### contains

          public boolean contains​(TreeInfo doc)

      Determine whether a given document is present in the pool
      Parameters:
        `doc` - the document being sought
      Returns:
        true if the document is present, false otherwise

    - #### discard

          public TreeInfo discard​(TreeInfo doc)

      Release a document from the document pool. This means that if the same document is loaded again later, the source will need to be re-parsed, and nodes will get new identities.
      Parameters:
        `doc` - the document to be discarded from the pool
      Returns:
        the document supplied in the doc parameter

    - #### discardIndexes

          public void discardIndexes​(KeyManager keyManager)

      Release all indexs for documents in this pool held by the KeyManager
      Parameters:
        `keyManager` - the keymanager from which indexes are to be released

    - #### markUnavailable

          public void markUnavailable​(DocumentKey uri)

      Add a document URI to the set of URIs known to be unavailable (because doc-available() has returned false
      Parameters:
        `uri` - the URI of the unavailable document

    - #### isMarkedUnavailable

          public boolean isMarkedUnavailable​(DocumentKey uri)

      Ask whether a document URI is in the set of URIs known to be unavailable, because doc-available() has been previously called and has returned false