|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.tax; import org.netbeans.tax.spec.Document; import org.netbeans.tax.spec.DocumentType; import org.netbeans.tax.spec.DTD; import java.util.*; /** * * @author Libor Kramolis * @version 0.1 */ public class TreeDocumentType extends AbstractTreeDTD implements TreeDTDRoot, Document.Child { /** */ public static final String PROP_ELEMENT_NAME = "elementName"; // NOI18N /** */ public static final String PROP_PUBLIC_ID = "publicId"; // NOI18N /** */ public static final String PROP_SYSTEM_ID = "systemId"; // NOI18N /** */ private String elementName; /** -- can be null. */ private String publicId; /** -- can be null. */ private String systemId; // strong reference to keep a key in bellow map private DTDIdentity dtdIdentity; // holds DTD-ID -> TreeDocumentFragment mapping private static final WeakHashMap externalEntities = new WeakHashMap(); private String internalDTDText; //!!! it is accesed by introspection, it a hack // // init // /** * Creates new TreeDocumentType. * @throws InvalidArgumentException */ public TreeDocumentType (String elementName, String publicId, String systemId) throws InvalidArgumentException { super (); checkElementName (elementName); checkPublicId (publicId); checkSystemId (systemId); this.elementName = elementName; this.publicId = publicId; this.systemId = systemId; this.dtdIdentity = new DTDIdentity(); } /** Creates new TreeDocumentType. * @throws InvalidArgumentException */ public TreeDocumentType (String elementName) throws InvalidArgumentException { this (elementName, null, null); } /** Creates new TreeDocumentType -- copy constructor. */ protected TreeDocumentType (TreeDocumentType documentType, boolean deep) { super (documentType, deep); this.elementName = documentType.elementName; this.publicId = documentType.publicId; this.systemId = documentType.systemId; this.internalDTDText = documentType.internalDTDText; this.dtdIdentity = documentType.dtdIdentity; } // // from TreeObject // /** */ public Object clone (boolean deep) { return new TreeDocumentType (this, deep); } /** */ public boolean equals (Object object, boolean deep) { if (!!! super.equals (object, deep)) return false; TreeDocumentType peer = (TreeDocumentType) object; if (!!! Util.equals (this.getElementName (), peer.getElementName ())) return false; if (!!! Util.equals (this.getPublicId (), peer.getPublicId ())) return false; if (!!! Util.equals (this.getSystemId (), peer.getSystemId ())) return false; if (!!! Util.equals (this.dtdIdentity, peer.dtdIdentity)) return false; return true; } /* * Merges documet root name, publicId and system ID properties. * External DTD list merging is delegated. */ public void merge (TreeObject treeObject) throws CannotMergeException { super.merge (treeObject); TreeDocumentType peer = (TreeDocumentType) treeObject; setElementNameImpl (peer.getElementName ()); setPublicIdImpl (peer.getPublicId ()); setSystemIdImpl (peer.getSystemId ()); internalDTDText = peer.internalDTDText; dtdIdentity = peer.dtdIdentity; } // // read only // /** * It's not propagated to exteranl entity. It's always read only. */ protected void setReadOnly (boolean newReadOnly) { super.setReadOnly (newReadOnly); } // // parent // /** */ public boolean hasChildNodes (Class childClass, boolean recursive) { TreeObjectList external = getExternalDTD(); Iterator externalIterator = external != null ? external.iterator() : Collections.EMPTY_SET.iterator(); Iterator[] its = new Iterator[] { getChildNodes ().iterator (), externalIterator }; for (int i = 0; i |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.