Class DocumentPool


  • public final class DocumentPool
    extends java.lang.Object
    An object representing the collection of documents handled during a single transformation
    Author:
    Michael H. Kay
    • Constructor Summary

      Constructors 
      Constructor Description
      DocumentPool()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int add​(DocumentInfo doc, java.lang.String name)
      Add a document to the pool, and allocate a document number
      DocumentInfo find​(java.lang.String name)
      Get the document with a given name
      int getDocumentNumber​(DocumentInfo doc)
      Get the document number of a document that is already in the pool.
      int getNumberOfDocuments()
      Get the number of documents in the pool
      • 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 int add​(DocumentInfo doc,
                       java.lang.String name)
        Add a document to the pool, and allocate a document number
        Parameters:
        doc - The DocumentInfo for the document in question
        name - The name of the document. May be null, in the case of the principal source document or a result tree fragment. Used for the URI of a document loaded using the document() function.
        Returns:
        the document number, unique within this document pool
      • getDocumentNumber

        public int getDocumentNumber​(DocumentInfo doc)
        Get the document number of a document that is already in the pool. If the document is not already in the pool, it is added, and a document number is allocated. (This can happen when a Java application has built the document independently of the Controller. In this case, it is still necessary that all documents use the same NamePool, but we don't actually check this).
        Returns:
        the document number
      • find

        public DocumentInfo find​(java.lang.String name)
        Get the document with a given name
        Returns:
        the DocumentInfo with the given name if it exists, or null if it is not found.
      • getNumberOfDocuments

        public int getNumberOfDocuments()
        Get the number of documents in the pool