1:
37:
38: package ;
39:
40: import ;
41: import ;
42: import ;
43: import ;
44: import ;
45: import ;
46:
47:
53: public abstract class XMLGregorianCalendar
54: implements Cloneable
55: {
56:
57:
60: public abstract void clear();
61:
62:
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:
187: public abstract String toXMLFormat();
188:
189: public abstract QName getXMLSchemaType();
190:
191: public String toString()
192: {
193: return toXMLFormat();
194: }
195:
196:
200: public abstract boolean isValid();
201:
202:
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: }