KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > tax > AbstractTreeDTD


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.tax;
20
21 import java.util.Iterator JavaDoc;
22 import java.util.Collection JavaDoc;
23 import java.util.LinkedList JavaDoc;
24
25 /**
26  * Introduces utility methods for quering DTD content.
27  *
28  * @author Libor Kramolis
29  * @version 0.1
30  */

31 public abstract class AbstractTreeDTD extends TreeParentNode {
32
33     //
34
// init
35
//
36

37     /** Creates new AbstractTreeDTD. */
38     protected AbstractTreeDTD () {
39         super ();
40     }
41
42     /** Creates new AbstractTreeDTD -- copy constructor. */
43     protected AbstractTreeDTD (AbstractTreeDTD abstractDTD, boolean deep) {
44         super (abstractDTD, deep);
45     }
46     
47     
48     //
49
// itself
50
//
51

52     /**
53      */

54     public final Collection JavaDoc getElementDeclarations () {
55         return getChildNodes (TreeElementDecl.class, true);
56     }
57     
58     /**
59      */

60     public final Collection JavaDoc getAttlistDeclarations () {
61         return getChildNodes (TreeAttlistDecl.class, true);
62     }
63     
64     /**
65      */

66     public final Collection JavaDoc getAttributeDeclarations (String JavaDoc elementName) {
67         Collection JavaDoc attrDefs = new LinkedList JavaDoc ();
68         Iterator JavaDoc it = getAttlistDeclarations ().iterator ();
69         while (it.hasNext ()) {
70             TreeAttlistDecl attlist = (TreeAttlistDecl)it.next ();
71             if ( attlist.getElementName ().equals (elementName) ) {
72                 attrDefs.addAll ((Collection JavaDoc)attlist.getAttributeDefs ());
73             }
74         }
75         return attrDefs;
76     }
77     
78     /**
79      */

80     public final Collection JavaDoc getEntityDeclarations () {
81         return getChildNodes (TreeEntityDecl.class, true);
82     }
83     
84     /**
85      */

86     public final Collection JavaDoc getNotationDeclarations () {
87         return getChildNodes (TreeNotationDecl.class, true);
88     }
89     
90     
91     //
92
// TreeObjectList.ContentManager
93
//
94

95     /**
96      *
97      */

98     protected abstract class ChildListContentManager extends TreeParentNode.ChildListContentManager {
99     } // end: class ChildListContentManager
100

101 }
102
Popular Tags