KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > xquark > schema > AttributeGroupDefinition


1 /*
2  * This file belongs to the XQuark distribution.
3  * Copyright (C) 2003 Universite de Versailles Saint-Quentin.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307.
18  * You can also get it at http://www.gnu.org/licenses/lgpl.html
19  *
20  * For more information on this software, see http://www.xquark.org.
21  */

22
23 package org.xquark.schema;
24
25 import java.util.ArrayList JavaDoc;
26 import java.util.Collection JavaDoc;
27
28 /**
29  * class for Attribute Group Definition.
30  *
31  * <p>This is the implementation of the Attribute Group Definition.
32  * The following properties are defined:</p>
33  * <p> 1. name : optional, null or a NCName, defined in SchemaComponent.</p>
34  * <p> 2. target namespace : null or a namespace name, defined in SchemaComponent.</p>
35  * <p> 3. attribue declarations : a set of attribute declarations. </p>
36  * <p> 4. attribute wildcard : optional, either a wildcard or null. </p>
37  *
38  * <p>See XML Schema Part 1: Structures 3.6
39  * W3C Recommendation 2 May 2001</p>
40  *
41  * @see org.xquark.xml.schema.SchemaComponent
42  */

43 public final class AttributeGroupDefinition extends SchemaComponent
44 {
45 private static final String JavaDoc RCSRevision = "$Revision: 1.1 $";
46 private static final String JavaDoc RCSName = "$Name: $";
47   
48   private ArrayList JavaDoc contents = new ArrayList JavaDoc();
49   private Wildcard attributeWildcard = null;
50
51   /**
52    * Create a new AttributeGroupDefinition.
53    *
54    * @param schema The schema which contains this attribute group declaration.
55    * @param name The attribute group name, a NCName.
56    */

57   public AttributeGroupDefinition(Schema schema, String JavaDoc name) {
58     super(schema, name);
59   }
60
61   public void accept(SchemaVisitor visitor) throws SchemaException {
62     visitor.visit(this);
63   }
64
65   /**
66    * Look up the attribute wildcard, if any
67    *
68    * @return The ElementDeclaration, or null if there is none.
69    */

70   public Wildcard getAttributeWildcard() {
71     return attributeWildcard;
72   }
73
74   /**
75    * Deprecated. This methode has been replaced by getAttributeDeclarations()
76    * Look up all local attribute declarations.
77    *
78    * @return The collection view of all attribute Declarations.
79    */

80   public Collection JavaDoc getContents() {
81     return contents;
82   }
83   
84   /**
85    * Look up all local attribute declarations.
86    *
87    * @return The collection view of all attribute Declarations.
88    */

89   public Collection JavaDoc getAttributeDeclarations() {
90     return contents;
91   }
92
93   public void add(Object JavaDoc declaration) {
94     contents.add(declaration);
95   }
96   
97   public boolean attributeFind(Object JavaDoc decl) {
98     if ( contents.indexOf(decl) == -1 ) return false;
99     else return true;
100   }
101
102   public void setAttributeWildcard(Wildcard wildcard) {
103     attributeWildcard = wildcard;
104   }
105 }
106
Popular Tags