OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [classpath/] [javax/] [xml/] [datatype/] [XMLGregorianCalendar.java] - Blame information for rev 772

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 772 jeremybenn
/* XMLGregorianCalendar.java --
2
   Copyright (C) 2004, 2005  Free Software Foundation, Inc.
3
 
4
This file is part of GNU Classpath.
5
 
6
GNU Classpath is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2, or (at your option)
9
any later version.
10
 
11
GNU Classpath is distributed in the hope that it will be useful, but
12
WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
General Public License for more details.
15
 
16
You should have received a copy of the GNU General Public License
17
along with GNU Classpath; see the file COPYING.  If not, write to the
18
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19
02110-1301 USA.
20
 
21
Linking this library statically or dynamically with other modules is
22
making a combined work based on this library.  Thus, the terms and
23
conditions of the GNU General Public License cover the whole
24
combination.
25
 
26
As a special exception, the copyright holders of this library give you
27
permission to link this library with independent modules to produce an
28
executable, regardless of the license terms of these independent
29
modules, and to copy and distribute the resulting executable under
30
terms of your choice, provided that you also meet, for each linked
31
independent module, the terms and conditions of the license of that
32
module.  An independent module is a module which is not derived from
33
or based on this library.  If you modify this library, you may extend
34
this exception to your version of the library, but you are not
35
obligated to do so.  If you do not wish to do so, delete this
36
exception statement from your version. */
37
 
38
package javax.xml.datatype;
39
 
40
import java.math.BigDecimal;
41
import java.math.BigInteger;
42
import java.util.GregorianCalendar;
43
import java.util.Locale;
44
import java.util.TimeZone;
45
import javax.xml.namespace.QName;
46
 
47
/**
48
 * An XML Schema 1.0 date/time data type.
49
 *
50
 * @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
51
 * @since 1.3
52
 */
53
public abstract class XMLGregorianCalendar
54
  implements Cloneable
55
{
56
 
57
  /**
58
   * Resets all fields to undefined.
59
   */
60
  public abstract void clear();
61
 
62
  /**
63
   * Resets all fields to their original values.
64
   */
65
  public abstract void reset();
66
 
67
  public abstract void setYear(BigInteger year);
68
 
69
  public abstract void setYear(int year);
70
 
71
  public abstract void setMonth(int month);
72
 
73
  public abstract void setDay(int day);
74
 
75
  public abstract void setTimezone(int offset);
76
 
77
  public void setTime(int hour, int minute, int second)
78
  {
79
    setHour(hour);
80
    setMinute(minute);
81
    setSecond(second);
82
  }
83
 
84
  public abstract void setHour(int hour);
85
 
86
  public abstract void setMinute(int minute);
87
 
88
  public abstract void setSecond(int second);
89
 
90
  public abstract void setMillisecond(int millisecond);
91
 
92
  public abstract void setFractionalSecond(BigDecimal fractional);
93
 
94
  public void setTime(int hour, int minute, int second, BigDecimal fractional)
95
  {
96
    setHour(hour);
97
    setMinute(minute);
98
    setSecond(second);
99
    setFractionalSecond(fractional);
100
  }
101
 
102
  public void setTime(int hour, int minute, int second, int millisecond)
103
  {
104
    setHour(hour);
105
    setMinute(minute);
106
    setSecond(second);
107
    setMillisecond(millisecond);
108
  }
109
 
110
  public abstract BigInteger getEon();
111
 
112
  public abstract int getYear();
113
 
114
  public abstract BigInteger getEonAndYear();
115
 
116
  public abstract int getMonth();
117
 
118
  public abstract int getDay();
119
 
120
  public abstract int getTimezone();
121
 
122
  public abstract int getHour();
123
 
124
  public abstract int getMinute();
125
 
126
  public abstract int getSecond();
127
 
128
  public int getMillisecond()
129
  {
130
    BigDecimal factor = BigDecimal.valueOf(1000L);
131
    BigDecimal val = getFractionalSecond().multiply(factor);
132
    return val.intValue();
133
  }
134
 
135
  public abstract BigDecimal getFractionalSecond();
136
 
137
  public abstract int compare(XMLGregorianCalendar xmlGregorianCalendar);
138
 
139
  public abstract XMLGregorianCalendar normalize();
140
 
141
  public boolean equals(Object obj)
142
  {
143
    if (obj instanceof XMLGregorianCalendar)
144
      {
145
        XMLGregorianCalendar xgc = (XMLGregorianCalendar) obj;
146
        BigInteger y1 = getEonAndYear();
147
        BigInteger y2 = xgc.getEonAndYear();
148
        BigDecimal f1 = getFractionalSecond();
149
        BigDecimal f2 = xgc.getFractionalSecond();
150
        return ((y1 == null && y2 == null) || (y1 != null && y1.equals(y2))) &&
151
          getMonth() == xgc.getMonth() &&
152
          getDay() == xgc.getDay() &&
153
          getTimezone() == xgc.getTimezone() &&
154
          getHour() == xgc.getHour() &&
155
          getMinute() == xgc.getMinute() &&
156
          getSecond() == xgc.getSecond() &&
157
          ((f1 == null && f2 == null) || (f1 != null && f1.equals(f2)));
158
      }
159
    return false;
160
  }
161
 
162
  public int hashCode()
163
  {
164
    int hash = 0;
165
    BigInteger y = getEonAndYear();
166
    BigDecimal f = getFractionalSecond();
167
    if (y != null)
168
      {
169
        hash *= 31 + y.hashCode();
170
      }
171
    hash *= 31 + getMonth();
172
    hash *= 31 + getDay();
173
    hash *= 31 + getTimezone();
174
    hash *= 31 + getHour();
175
    hash *= 31 + getMinute();
176
    hash *= 31 + getSecond();
177
    if (f != null)
178
      {
179
        hash *= 31 + f.hashCode();
180
      }
181
    return hash;
182
  }
183
 
184
  /**
185
   * Returns the XML Schema lexical representation of this calendar.
186
   */
187
  public abstract String toXMLFormat();
188
 
189
  public abstract QName getXMLSchemaType();
190
 
191
  public String toString()
192
  {
193
    return toXMLFormat();
194
  }
195
 
196
  /**
197
   * Determines the validity of this calendar by
198
   * <code>getXMLSchemaType</code> constraints.
199
   */
200
  public abstract boolean isValid();
201
 
202
  /**
203
   * Adds the specified duration to this calendar.
204
   */
205
  public abstract void add(Duration duration);
206
 
207
  public abstract GregorianCalendar toGregorianCalendar();
208
 
209
  public abstract GregorianCalendar toGregorianCalendar(TimeZone timezone,
210
                                                        Locale locale,
211
                                                        XMLGregorianCalendar defaults);
212
 
213
  public abstract TimeZone getTimeZone(int defaultZoneoffset);
214
 
215
  public abstract Object clone();
216
 
217
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.