KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > xquark > xquery > typing > ElementTools


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.xquery.typing;
24
25 import org.xquark.schema.Particle;
26 import org.xquark.schema.SimpleType;
27 import org.xquark.schema.Wildcard;
28 import org.xquark.xquery.parser.XQueryExpression;
29
30 public class ElementTools {
31
32     private static final String JavaDoc RCSRevision = "$Revision: 1.2 $";
33     private static final String JavaDoc RCSName = "$Name: $";
34
35     private int countSimpleType = 0;
36     private int countAttribute = 0;
37     private int countSimpleList = 0;
38     private int size = 0;
39     private boolean mixed = false;
40     private SimpleType simpleType = null;
41     private XQueryExpression name = null;
42     private Particle wildcard = null;
43
44     public ElementTools(int size, XQueryExpression name)
45     {
46         this.size = size;
47         this.name = name;
48     }
49     
50     // ******************************************
51
// FOR ACCESS TO PRIVATE/PROTECTED ATTRIBUTES
52
// ******************************************
53

54     public int getCountSimpleType() { return countSimpleType; }
55
56 // public void setCountSimpleType(int countSimpleType) { this.countSimpleType = countSimpleType; }
57

58     public int getCountAttribute() { return countAttribute; }
59
60 // public void setCountAttribute(int countAttribute) { this.countAttribute = countAttribute; }
61

62     public int getCountSimpleList() { return countSimpleList; }
63
64 // public void setCountSimpleList(int countSimpleList) { this.countSimpleList = countSimpleList; }
65

66     public int getSize() { return size; }
67
68     public void setSize(int size) { this.size = size; }
69
70     public boolean getMixed() { return mixed; }
71
72     public void setMixed(boolean mixed) { this.mixed = mixed; }
73     
74     public SimpleType getSimpleType() { return simpleType; }
75
76     public void setSimpleType(SimpleType simpleType) { this.simpleType = simpleType; }
77     
78     public XQueryExpression getName() { return name; }
79
80     public void setName(XQueryExpression name) { this.name = name; }
81     
82     public void addWildCard(Particle wildcard) {
83         this.wildcard = wildcard;
84     }
85     public Particle getWildCard() {
86         return wildcard;
87     }
88     // Increment methods
89

90     public void incSize() { size++; }
91
92     public void incCountSimpleType() { countSimpleType++; }
93
94     public void incCountAttribute() { countAttribute++; }
95
96     public void incCountSimpleList() { countSimpleList++; }
97
98     // ***********************
99
// STUFF JUST FOR PRINTING
100
// ***********************
101

102     public String JavaDoc toString()
103     {
104         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
105         sb.append("*** ElementTools ***\n");
106         sb.append("countSimpleType: "+countSimpleType+"\n");
107         sb.append("countAttribute: "+countAttribute+"\n");
108         sb.append("countSimpleList: "+countSimpleList+"\n");
109         sb.append("size: "+size+"\n");
110         sb.append("mixed: "+mixed+"\n");
111         sb.append("********************");
112         return sb.toString();
113     }
114 }
115
Popular Tags