~vcs-imports/xena/trunk

« back to all changes in this revision

Viewing changes to ext/src/xerces-2_9_1/src/org/apache/xerces/xs/datatypes/XSDateTime.java

  • Committer: matthewoliver
  • Date: 2009-12-10 03:18:07 UTC
  • Revision ID: vcs-imports@canonical.com-20091210031807-l086qguzdlljtkl9
Merged Xena Testing into Xena Stable for the Xena 5 release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
 
3
 * contributor license agreements.  See the NOTICE file distributed with
 
4
 * this work for additional information regarding copyright ownership.
 
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
 
6
 * (the "License"); you may not use this file except in compliance with
 
7
 * the License.  You may obtain a copy of the License at
 
8
 * 
 
9
 *      http://www.apache.org/licenses/LICENSE-2.0
 
10
 * 
 
11
 * Unless required by applicable law or agreed to in writing, software
 
12
 * distributed under the License is distributed on an "AS IS" BASIS,
 
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
14
 * See the License for the specific language governing permissions and
 
15
 * limitations under the License.
 
16
 */
 
17
package org.apache.xerces.xs.datatypes;
 
18
 
 
19
import javax.xml.datatype.Duration;
 
20
import javax.xml.datatype.XMLGregorianCalendar;
 
21
 
 
22
/**
 
23
 * <p>Interface to expose the values for all date-time related types. The following 
 
24
 * table shows the methods defined for various XML Schema 1.0 built-in types. 'X' 
 
25
 * marks whether a particular method is defined for a particular type. Accessing undefined
 
26
 * methods may return unexpected values.
 
27
 * 
 
28
 * <table border="1">
 
29
 * <br/>
 
30
 * <tr>
 
31
 * <td> XML Schema Datatype </td>
 
32
 * <td> getYears() </td>
 
33
 * <td> getMonths() </td>
 
34
 * <td> getDays() </td>
 
35
 * <td> getHours() </td>
 
36
 * <td> getMinutes() </td>
 
37
 * <td> getSeconds() </td>
 
38
 * <td> getTimeZoneHours() </td>
 
39
 * <td> getTimeZoneMinutes() </td>
 
40
 * <td> getXMLGregorianCalendar() </td>
 
41
 * <td> getDuration() </td>
 
42
 * <td> hasTimeZone() </td>
 
43
 * <td> normalize() </td>
 
44
 * <td> isNormalized() </td>
 
45
 * <td> getLexicalValue() </td>
 
46
 * </tr>
 
47
 * <tr>
 
48
 * <td> gYear </td>
 
49
 * <td>X</td>
 
50
 * <td>-</td>
 
51
 * <td>-</td>
 
52
 * <td>-</td>
 
53
 * <td>-</td>
 
54
 * <td>-</td>
 
55
 * <td>X</td>
 
56
 * <td>X</td>
 
57
 * <td>X</td>
 
58
 * <td>-</td>
 
59
 * <td>X</td>
 
60
 * <td>X</td>
 
61
 * <td>X</td>
 
62
 * <td>X</td>
 
63
 * </tr>
 
64
 * <tr>
 
65
 * <td> gMonth </td>
 
66
 * <td>-</td>
 
67
 * <td>X</td>
 
68
 * <td>-</td>
 
69
 * <td>-</td>
 
70
 * <td>-</td>
 
71
 * <td>-</td>
 
72
 * <td>X</td>
 
73
 * <td>X</td>
 
74
 * <td>X</td>
 
75
 * <td>-</td>
 
76
 * <td>X</td>
 
77
 * <td>X</td>
 
78
 * <td>X</td>
 
79
 * <td>X</td>
 
80
 * </tr>
 
81
 * <tr>
 
82
 * <td> gDay </td>
 
83
 * <td>-</td>
 
84
 * <td>-</td>
 
85
 * <td>X</td>
 
86
 * <td>-</td>
 
87
 * <td>-</td>
 
88
 * <td>-</td>
 
89
 * <td>X</td>
 
90
 * <td>X</td>
 
91
 * <td>X</td>
 
92
 * <td>-</td>
 
93
 * <td>X</td>
 
94
 * <td>X</td>
 
95
 * <td>X</td>
 
96
 * <td>X</td>
 
97
 * </tr>
 
98
 * <tr>
 
99
 * <td> gYearMonth </td>
 
100
 * <td>X</td>
 
101
 * <td>X</td>
 
102
 * <td>-</td>
 
103
 * <td>-</td>
 
104
 * <td>-</td>
 
105
 * <td>-</td>
 
106
 * <td>X</td>
 
107
 * <td>X</td>
 
108
 * <td>X</td>
 
109
 * <td>-</td>
 
110
 * <td>X</td>
 
111
 * <td>X</td>
 
112
 * <td>X</td>
 
113
 * <td>X</td>
 
114
 * </tr>
 
115
 * <tr>
 
116
 * <td> gMonthDay </td>
 
117
 * <td>-</td>
 
118
 * <td>X</td>
 
119
 * <td>X</td>
 
120
 * <td>-</td>
 
121
 * <td>-</td>
 
122
 * <td>-</td>
 
123
 * <td>X</td>
 
124
 * <td>X</td>
 
125
 * <td>X</td>
 
126
 * <td>-</td>
 
127
 * <td>X</td>
 
128
 * <td>X</td>
 
129
 * <td>X</td>
 
130
 * <td>X</td>
 
131
 * </tr>
 
132
 * <tr>
 
133
 * <td> date </td>
 
134
 * <td>X</td>
 
135
 * <td>X</td>
 
136
 * <td>X</td>
 
137
 * <td>-</td>
 
138
 * <td>-</td>
 
139
 * <td>-</td>
 
140
 * <td>X</td>
 
141
 * <td>X</td>
 
142
 * <td>X</td>
 
143
 * <td>-</td>
 
144
 * <td>X</td>
 
145
 * <td>X</td>
 
146
 * <td>X</td>
 
147
 * <td>X</td>
 
148
 * </tr>
 
149
 * <tr>
 
150
 * <td> time </td>
 
151
 * <td>-</td>
 
152
 * <td>-</td>
 
153
 * <td>-</td>
 
154
 * <td>X</td>
 
155
 * <td>X</td>
 
156
 * <td>X</td>
 
157
 * <td>X</td>
 
158
 * <td>X</td>
 
159
 * <td>X</td>
 
160
 * <td>-</td>
 
161
 * <td>X</td>
 
162
 * <td>X</td>
 
163
 * <td>X</td>
 
164
 * <td>X</td>
 
165
 * </tr>
 
166
 * <tr>
 
167
 * <td> datetime </td>
 
168
 * <td>X</td>
 
169
 * <td>X</td>
 
170
 * <td>X</td>
 
171
 * <td>X</td>
 
172
 * <td>X</td>
 
173
 * <td>X</td>
 
174
 * <td>X</td>
 
175
 * <td>X</td>
 
176
 * <td>X</td>
 
177
 * <td>-</td>
 
178
 * <td>X</td>
 
179
 * <td>X</td>
 
180
 * <td>X</td>
 
181
 * <td>X</td>
 
182
 * </tr>
 
183
 * <tr>
 
184
 * <td> duration </td>
 
185
 * <td>-</td>
 
186
 * <td>X</td>
 
187
 * <td>-</td>
 
188
 * <td>-</td>
 
189
 * <td>-</td>
 
190
 * <td>X</td>
 
191
 * <td>-</td>
 
192
 * <td>-</td>
 
193
 * <td>-</td>
 
194
 * <td>X</td>
 
195
 * <td>-</td>
 
196
 * <td>-</td>
 
197
 * <td>-</td>
 
198
 * <td>X</td>
 
199
 * </tr>
 
200
 * </table>
 
201
 * </p>
 
202
 * 
 
203
 * @author Ankit Pasricha, IBM
 
204
 * 
 
205
 * @version $Id: XSDateTime.java,v 1.2 2009/12/10 03:18:45 matthewoliver Exp $
 
206
 */
 
207
public interface XSDateTime {
 
208
        
 
209
    /**
 
210
     * @return years - can be negative for date-time related types;
 
211
     *          
 
212
     */
 
213
    public int getYears();
 
214
    
 
215
    /**
 
216
     * @return months - can be negative only for duration types;
 
217
     *                  For duration types, it returns years*12 + months
 
218
     */
 
219
    public int getMonths();
 
220
    
 
221
    /**
 
222
     * @return days - cannot be negative;
 
223
     *          
 
224
     */
 
225
    public int getDays();
 
226
    
 
227
    /**
 
228
     * @return hours - cannot be negative;
 
229
     *          
 
230
     */
 
231
    public int getHours();
 
232
    
 
233
    /**
 
234
     * @return minutes - cannot be negative;
 
235
     *          
 
236
     */
 
237
    public int getMinutes();
 
238
    
 
239
    /**
 
240
     * @return seconds - can be negative only for durations;
 
241
     *                   For duration types, it returns days*24*3600 + hours*3600 
 
242
     *                                                  + minutes*60 + seconds 
 
243
     */
 
244
    public double getSeconds();
 
245
    
 
246
    /**
 
247
     * @return boolean (true when timezone is specified in the original lexical value)
 
248
     *                  
 
249
     */
 
250
    public boolean hasTimeZone();
 
251
    
 
252
    /**
 
253
     * @return timezone hours (for GMT-xx:xx this will be negative),
 
254
     *                          
 
255
     */
 
256
    public int getTimeZoneHours();
 
257
    
 
258
    /**
 
259
     * @return timezone minutes (for GMT-xx:xx this will be negative),
 
260
     *                          
 
261
     */
 
262
    public int getTimeZoneMinutes();
 
263
    
 
264
    /**
 
265
     * @return the original lexical value
 
266
     */
 
267
    public String getLexicalValue();
 
268
    
 
269
    /**
 
270
     * @return a new date-time related object with normalized values
 
271
     *         (has no effect on objects already
 
272
     *          normalized)
 
273
     */
 
274
    public XSDateTime normalize();
 
275
    
 
276
    /**
 
277
     * @return whether a date-time related object is normalized or not
 
278
     *         (value is not useful for types where timezone is not specified)
 
279
     */
 
280
    public boolean isNormalized();
 
281
       
 
282
    /**
 
283
     * @return an un-normalized XMLGregorianCalendar (if applicable otherwise null)
 
284
     */
 
285
    public XMLGregorianCalendar getXMLGregorianCalendar();
 
286
        
 
287
    /**
 
288
     * @return a Duration (if applicable otherwise null)
 
289
     */
 
290
    public Duration getDuration();
 
291
}