/** * Set the Configuration that contains this document * * @param config the Saxon configuration */ public void setConfiguration(/*@NotNull*/ Configuration config) { this.config = config; documentNumber = config.getDocumentNumberAllocator().allocateDocumentNumber(); }
/** * Set the Configuration that contains this document * * @param config the Saxon configuration */ public void setConfiguration(/*@NotNull*/ Configuration config) { this.config = config; documentNumber = config.getDocumentNumberAllocator().allocateDocumentNumber(); }
/** * Set the configuration, which defines the name pool used for all names in * this document. This is always called after a new document has been * created. The implementation must register the name pool with the * document, so that it can be retrieved using getNamePool(). It must also * call NamePool.allocateDocumentNumber(), and return the relevant document * number when getDocumentNumber() is subsequently called. * * @param config The configuration to be used */ public void setConfiguration(Configuration config) { this.config = config; documentNumber = config.getDocumentNumberAllocator().allocateDocumentNumber(); }
/** * Get the document number, which identifies this tree uniquely within a Configuration * @return the document number */ public long getDocumentNumber() { if (documentNumber == -1) { DocumentNumberAllocator dna = config.getDocumentNumberAllocator(); synchronized (this) { if (documentNumber == -1) { documentNumber = dna.allocateDocumentNumber(); } } } return documentNumber; }
/** * Get the document number, which identifies this tree uniquely within a Configuration * @return the document number */ public long getDocumentNumber() { if (documentNumber == -1) { DocumentNumberAllocator dna = config.getDocumentNumberAllocator(); synchronized (this) { if (documentNumber == -1) { documentNumber = dna.allocateDocumentNumber(); } } } return documentNumber; }
/** * Set the configuration, which defines the name pool used for all names in * this document. This is always called after a new document has been * created. The implementation must register the name pool with the * document, so that it can be retrieved using getNamePool(). It must also * call NamePool.allocateDocumentNumber(), and return the relevant document * number when getDocumentNumber() is subsequently called. * * @param config The configuration to be used */ public void setConfiguration(Configuration config) { this.config = config; documentNumber = config.getDocumentNumberAllocator().allocateDocumentNumber(); }
/** * Set the configuration, which defines the name pool used for all names in * this document. This is always called after a new document has been * created. The implementation must register the name pool with the * document, so that it can be retrieved using getNamePool(). It must also * call NamePool.allocateDocumentNumber(), and return the relevant document * number when getDocumentNumber() is subsequently called. * * @param config The configuration to be used */ public void setConfiguration(Configuration config) { this.config = config; documentNumber = config.getDocumentNumberAllocator().allocateDocumentNumber(); }
/** * Public factory method: create a parentless virtual tree as a copy of an existing node * * @param original the node to be copied * @return the virtual copy. If the original was already a virtual copy, this will be a virtual copy * of the real underlying node. */ public static VirtualCopy makeVirtualCopy(NodeInfo original) { VirtualCopy vc; // Don't allow copies of copies of copies: define the new copy in terms of the original while (original instanceof VirtualCopy) { original = ((VirtualCopy) original).original; } vc = new VirtualCopy(original, original); Configuration config = original.getConfiguration(); VirtualTreeInfo doc = new VirtualTreeInfo(config, vc); long docNr = config.getDocumentNumberAllocator().allocateDocumentNumber(); doc.setDocumentNumber(docNr); vc.tree = doc; return vc; }
/** * Public factory method: create a parentless virtual tree as a copy of an existing node * * @param original the node to be copied * @return the virtual copy. If the original was already a virtual copy, this will be a virtual copy * of the real underlying node. */ public static VirtualCopy makeVirtualCopy(NodeInfo original) { VirtualCopy vc; // Don't allow copies of copies of copies: define the new copy in terms of the original while (original instanceof VirtualCopy) { original = ((VirtualCopy) original).original; } vc = new VirtualCopy(original, original); Configuration config = original.getConfiguration(); VirtualTreeInfo doc = new VirtualTreeInfo(config, vc); long docNr = config.getDocumentNumberAllocator().allocateDocumentNumber(); doc.setDocumentNumber(docNr); vc.tree = doc; return vc; }
/** * Public factory method: create a virtual tree as a copy of an existing node, grafted onto a new * parent * * @param original the node to be copied * @param graftingHost the node in the host tree that represents the root of the grafted tree * @return the virtual copy. If the original was already a virtual copy, this will be a virtual copy * of the real underlying node. */ public static VirtualCopy makeVirtualCopy(NodeInfo original, GraftedElement graftingHost) { VirtualCopy vc = new VirtualCopy(original, original); Configuration config = original.getConfiguration(); VirtualTreeInfo doc = new VirtualTreeInfo(config, vc); long docNr = config.getDocumentNumberAllocator().allocateDocumentNumber(); doc.setDocumentNumber(docNr); vc.tree = doc; vc.graftingHost = graftingHost; vc.systemId = graftingHost.getSystemId(); return vc; }
/** * Public factory method: create a virtual tree as a copy of an existing node, grafted onto a new * parent * * @param original the node to be copied * @param graftingHost the node in the host tree that represents the root of the grafted tree * @return the virtual copy. If the original was already a virtual copy, this will be a virtual copy * of the real underlying node. */ public static VirtualCopy makeVirtualCopy(NodeInfo original, GraftedElement graftingHost) { VirtualCopy vc = new VirtualCopy(original, original); Configuration config = original.getConfiguration(); VirtualTreeInfo doc = new VirtualTreeInfo(config, vc); long docNr = config.getDocumentNumberAllocator().allocateDocumentNumber(); doc.setDocumentNumber(docNr); vc.tree = doc; vc.graftingHost = graftingHost; vc.systemId = graftingHost.getSystemId(); return vc; }
setDocumentNumber(getConfiguration().getDocumentNumberAllocator().allocateDocumentNumber());
setDocumentNumber(getConfiguration().getDocumentNumberAllocator().allocateDocumentNumber());
/** * Public factory method: apply the snapshot function to a node * * @param original the node to be copied * @return the snapshot. */ public static SnapshotNode makeSnapshot(NodeInfo original) { SnapshotNode vc = new SnapshotNode(original, original); Configuration config = original.getConfiguration(); VirtualTreeInfo doc = new VirtualTreeInfo(config); long docNr = config.getDocumentNumberAllocator().allocateDocumentNumber(); doc.setDocumentNumber(docNr); doc.setCopyAccumulators(true); vc.tree = doc; doc.setRootNode(vc.getRoot()); return vc; }
/** * Public factory method: apply the snapshot function to a node * * @param original the node to be copied * @return the snapshot. */ public static SnapshotNode makeSnapshot(NodeInfo original) { SnapshotNode vc = new SnapshotNode(original, original); Configuration config = original.getConfiguration(); VirtualTreeInfo doc = new VirtualTreeInfo(config); long docNr = config.getDocumentNumberAllocator().allocateDocumentNumber(); doc.setDocumentNumber(docNr); doc.setCopyAccumulators(true); vc.tree = doc; doc.setRootNode(vc.getRoot()); return vc; }
setFieldValue(tree, "commentBuffer", commentBuffer); setFieldValue(tree, "documentNumber", config .getDocumentNumberAllocator().allocateDocumentNumber()); } catch (IllegalArgumentException e) { e.printStackTrace();