~ubuntu-branches/ubuntu/gutsy/libjaxp1.3-java/gutsy

« back to all changes in this revision

Viewing changes to javax/xml/datatype/DatatypeConstants.java

  • Committer: Bazaar Package Importer
  • Author(s): Arnaud Vandyck
  • Date: 2006-08-03 10:30:58 UTC
  • Revision ID: james.westby@ubuntu.com-20060803103058-7jwwiqv9g8w9094d
Tags: upstream-1.3.03
ImportĀ upstreamĀ versionĀ 1.3.03

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2003-2004 The Apache Software Foundation.
 
3
 *
 
4
 * Licensed under the Apache License, Version 2.0 (the "License");
 
5
 * you may not use this file except in compliance with the License.
 
6
 * You may obtain a copy of the License at
 
7
 *
 
8
 *     http://www.apache.org/licenses/LICENSE-2.0
 
9
 *
 
10
 * Unless required by applicable law or agreed to in writing, software
 
11
 * distributed under the License is distributed on an "AS IS" BASIS,
 
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
13
 * See the License for the specific language governing permissions and
 
14
 * limitations under the License.
 
15
 */
 
16
 
 
17
// $Id: DatatypeConstants.java 226183 2005-04-08 10:39:14Z neeraj $
 
18
 
 
19
package javax.xml.datatype;
 
20
 
 
21
import javax.xml.XMLConstants;
 
22
import javax.xml.namespace.QName;
 
23
 
 
24
/**
 
25
 * <p>Utility class to contain basic Datatype values as constants.</p>
 
26
 *
 
27
 * @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a>
 
28
 * @version $Revision: 226183 $, $Date: 2005-04-08 06:39:14 -0400 (Fri, 08 Apr 2005) $
 
29
 * @since 1.5
 
30
 */
 
31
 
 
32
public final class DatatypeConstants {
 
33
        
 
34
    /**
 
35
     * <p>Private constructor to prevent instantiation.</p>
 
36
     */
 
37
        private DatatypeConstants() {
 
38
        }
 
39
        
 
40
        /**
 
41
         * Value for first month of year.
 
42
         */
 
43
        public static final int JANUARY  = 1;
 
44
 
 
45
        /**
 
46
         * Value for second month of year.
 
47
         */
 
48
        public static final int FEBRUARY = 2;
 
49
 
 
50
        /**
 
51
         * Value for third month of year.
 
52
         */
 
53
        public static final int MARCH    = 3;
 
54
 
 
55
        /**
 
56
         * Value for fourth month of year.
 
57
         */
 
58
        public static final int APRIL    = 4;
 
59
 
 
60
        /**
 
61
         * Value for fifth month of year.
 
62
         */
 
63
        public static final int MAY      = 5;
 
64
 
 
65
        /**
 
66
         * Value for sixth month of year.
 
67
         */
 
68
        public static final int JUNE     = 6;
 
69
 
 
70
        /**
 
71
         * Value for seventh month of year.
 
72
         */
 
73
        public static final int JULY     = 7;
 
74
 
 
75
        /**
 
76
         * Value for eighth month of year.
 
77
         */
 
78
        public static final int AUGUST   = 8;
 
79
 
 
80
        /**
 
81
         * Value for ninth month of year.
 
82
         */
 
83
        public static final int SEPTEMBER = 9;
 
84
 
 
85
        /**
 
86
         * Value for tenth month of year.
 
87
         */
 
88
        public static final int OCTOBER = 10;
 
89
 
 
90
        /**
 
91
         * Value for eleven month of year.
 
92
         */
 
93
        public static final int NOVEMBER = 11;
 
94
 
 
95
        /**
 
96
         * Value for twelve month of year.
 
97
         */
 
98
        public static final int DECEMBER = 12;
 
99
 
 
100
        /**
 
101
         * <p>Comparison result.</p>
 
102
         */
 
103
        public static final int LESSER = -1;
 
104
 
 
105
        /**
 
106
         * <p>Comparison result.</p>
 
107
         */
 
108
        public static final int EQUAL =  0;
 
109
 
 
110
        /**
 
111
         * <p>Comparison result.</p>
 
112
         */
 
113
        public static final int GREATER =  1;
 
114
 
 
115
        /**
 
116
         * <p>Comparison result.</p>
 
117
         */
 
118
        public static final int INDETERMINATE =  2;
 
119
        
 
120
        /**
 
121
         * Designation that an "int" field is not set.
 
122
         */
 
123
        public static final int FIELD_UNDEFINED = Integer.MIN_VALUE;
 
124
 
 
125
        /**
 
126
         * <p>A constant that represents the years field.</p>
 
127
         */
 
128
        public static final Field YEARS = new Field("YEARS", 0);
 
129
    
 
130
        /**
 
131
         * <p>A constant that represents the months field.</p>
 
132
         */
 
133
        public static final Field MONTHS = new Field("MONTHS", 1);
 
134
    
 
135
        /**
 
136
         * <p>A constant that represents the days field.</p>
 
137
         */
 
138
        public static final Field DAYS = new Field("DAYS", 2);
 
139
    
 
140
        /**
 
141
         * <p>A constant that represents the hours field.</p>
 
142
         */
 
143
        public static final Field HOURS = new Field("HOURS", 3);
 
144
    
 
145
        /**
 
146
         * <p>A constant that represents the minutes field.</p>
 
147
         */
 
148
        public static final Field MINUTES = new Field("MINUTES", 4);
 
149
    
 
150
        /**
 
151
         * <p>A constant that represents the seconds field.</p>
 
152
         */
 
153
        public static final Field SECONDS = new Field("SECONDS", 5);
 
154
    
 
155
        /**
 
156
         * Type-safe enum class that represents six fields
 
157
         * of the {@link Duration} class.
 
158
         */
 
159
        public static final class Field {
 
160
        
 
161
                /**
 
162
                 * <p><code>String</code> representation of <ode>Field</code>.</p>
 
163
                 */
 
164
                private final String str;
 
165
                /**
 
166
                 * <p>Unique id of the field.</p>
 
167
                 * 
 
168
                 * <p>This value allows the {@link Duration} class to use switch
 
169
                 * statements to process fields.</p>  
 
170
                 */
 
171
                private final int id;
 
172
        
 
173
                /**
 
174
                 * <p>Construct a <code>Field</code> with specified values.</p>
 
175
                 * @param str <code>String</code> representation of <code>Field</code>
 
176
                 * @param id  <code>int</code> representation of <code>Field</code>
 
177
                 */
 
178
                private Field(final String str, final int id) {
 
179
                        this.str = str;
 
180
                        this.id = id;
 
181
                }
 
182
                /**
 
183
                 * Returns a field name in English. This method 
 
184
                 * is intended to be used for debugging/diagnosis
 
185
                 * and not for display to end-users.
 
186
                 * 
 
187
                 * @return
 
188
                 *      a non-null valid String constant.
 
189
                 */
 
190
                public String toString() { return str; }
 
191
                
 
192
                /**
 
193
                 * <p>Get id of this Field.</p>
 
194
                 * 
 
195
                 * @return Id of field.
 
196
                 */
 
197
                public int getId() {
 
198
                        return id;
 
199
                }
 
200
        }
 
201
        
 
202
        /**
 
203
         * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>dateTime</code>.</p> 
 
204
         */
 
205
        public static final QName DATETIME = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "dateTime");
 
206
 
 
207
        /**
 
208
         * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>time</code>.</p> 
 
209
         */
 
210
        public static final QName TIME = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "time");
 
211
 
 
212
        /**
 
213
         * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>date</code>.</p> 
 
214
         */
 
215
        public static final QName DATE = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "date");
 
216
 
 
217
        /**
 
218
         * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gYearMonth</code>.</p> 
 
219
         */
 
220
        public static final QName GYEARMONTH = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gYearMonth");
 
221
 
 
222
        /**
 
223
         * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gMonthDay</code>.</p> 
 
224
         */
 
225
        public static final QName GMONTHDAY = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gMonthDay");
 
226
 
 
227
        /**
 
228
         * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gYear</code>.</p> 
 
229
         */
 
230
        public static final QName GYEAR = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gYear");
 
231
 
 
232
        /**
 
233
         * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gMonth</code>.</p> 
 
234
         */
 
235
        public static final QName GMONTH = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gMonth");
 
236
 
 
237
        /**
 
238
         * <p>Fully qualified name for W3C XML Schema 1.0 datatype <code>gDay</code>.</p> 
 
239
         */
 
240
        public static final QName GDAY = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "gDay");
 
241
 
 
242
        /**
 
243
         * <p>Fully qualified name for W3C XML Schema datatype <code>duration</code>.</p>
 
244
         */
 
245
        public static final QName DURATION = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "duration");
 
246
 
 
247
        /**
 
248
         * <p>Fully qualified name for XQuery 1.0 and XPath 2.0 datatype <code>dayTimeDuration</code>.</p>
 
249
         */
 
250
        public static final QName DURATION_DAYTIME = new QName(XMLConstants.W3C_XPATH_DATATYPE_NS_URI, "dayTimeDuration");
 
251
 
 
252
        /**
 
253
         * <p>Fully qualified name for XQuery 1.0 and XPath 2.0 datatype <code>yearMonthDuration</code>.</p>
 
254
         */
 
255
        public static final QName DURATION_YEARMONTH = new QName(XMLConstants.W3C_XPATH_DATATYPE_NS_URI, "yearMonthDuration");
 
256
 
 
257
        /**
 
258
         * W3C XML Schema max timezone offset is -14:00. Zone offset is in minutes.
 
259
         */
 
260
        public static final int MAX_TIMEZONE_OFFSET = -14 * 60;
 
261
 
 
262
        /**
 
263
         * W3C XML Schema min timezone offset is +14:00. Zone offset is in minutes.
 
264
         */
 
265
        public static final int MIN_TIMEZONE_OFFSET = 14 * 60;
 
266
        
 
267
}