15658
|
1 |
/*
|
|
2 |
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
|
7 |
* published by the Free Software Foundation. Oracle designates this
|
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
|
9 |
* by Oracle in the LICENSE file that accompanied this code.
|
|
10 |
*
|
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
15 |
* accompanied this code).
|
|
16 |
*
|
|
17 |
* You should have received a copy of the GNU General Public License version
|
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
20 |
*
|
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
22 |
* or visit www.oracle.com if you need additional information or have any
|
|
23 |
* questions.
|
|
24 |
*/
|
|
25 |
|
|
26 |
/*
|
|
27 |
* This file is available under and governed by the GNU General Public
|
|
28 |
* License version 2 only, as published by the Free Software Foundation.
|
|
29 |
* However, the following notice accompanied the original version of this
|
|
30 |
* file:
|
|
31 |
*
|
|
32 |
* Copyright (c) 2007-2012, Stephen Colebourne & Michael Nascimento Santos
|
|
33 |
*
|
|
34 |
* All rights reserved.
|
|
35 |
*
|
|
36 |
* Redistribution and use in source and binary forms, with or without
|
|
37 |
* modification, are permitted provided that the following conditions are met:
|
|
38 |
*
|
|
39 |
* * Redistributions of source code must retain the above copyright notice,
|
|
40 |
* this list of conditions and the following disclaimer.
|
|
41 |
*
|
|
42 |
* * Redistributions in binary form must reproduce the above copyright notice,
|
|
43 |
* this list of conditions and the following disclaimer in the documentation
|
|
44 |
* and/or other materials provided with the distribution.
|
|
45 |
*
|
|
46 |
* * Neither the name of JSR-310 nor the names of its contributors
|
|
47 |
* may be used to endorse or promote products derived from this software
|
|
48 |
* without specific prior written permission.
|
|
49 |
*
|
|
50 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
51 |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
52 |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
53 |
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
54 |
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
55 |
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
56 |
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
57 |
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
58 |
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
59 |
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
60 |
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
61 |
*/
|
|
62 |
package java.time.chrono;
|
|
63 |
|
|
64 |
import static java.time.temporal.ChronoField.EPOCH_DAY;
|
|
65 |
|
|
66 |
import java.io.IOException;
|
|
67 |
import java.io.InvalidObjectException;
|
|
68 |
import java.io.ObjectInput;
|
|
69 |
import java.io.ObjectOutput;
|
|
70 |
import java.io.ObjectStreamException;
|
|
71 |
import java.io.Serializable;
|
|
72 |
import java.time.DateTimeException;
|
|
73 |
import java.time.LocalTime;
|
|
74 |
import java.time.ZoneId;
|
|
75 |
import java.time.temporal.ChronoField;
|
|
76 |
import java.time.temporal.ChronoUnit;
|
|
77 |
import java.time.temporal.Temporal;
|
|
78 |
import java.time.temporal.TemporalAdjuster;
|
|
79 |
import java.time.temporal.TemporalField;
|
|
80 |
import java.time.temporal.TemporalUnit;
|
|
81 |
import java.time.temporal.ValueRange;
|
|
82 |
import java.util.Objects;
|
|
83 |
|
|
84 |
/**
|
|
85 |
* A date-time without a time-zone for the calendar neutral API.
|
|
86 |
* <p>
|
|
87 |
* {@code ChronoLocalDateTime} is an immutable date-time object that represents a date-time, often
|
|
88 |
* viewed as year-month-day-hour-minute-second. This object can also access other
|
|
89 |
* fields such as day-of-year, day-of-week and week-of-year.
|
|
90 |
* <p>
|
|
91 |
* This class stores all date and time fields, to a precision of nanoseconds.
|
|
92 |
* It does not store or represent a time-zone. For example, the value
|
|
93 |
* "2nd October 2007 at 13:45.30.123456789" can be stored in an {@code ChronoLocalDateTime}.
|
|
94 |
*
|
|
95 |
* <h3>Specification for implementors</h3>
|
|
96 |
* This class is immutable and thread-safe.
|
|
97 |
*
|
|
98 |
* @param <D> the concrete type for the date of this date-time
|
|
99 |
* @since 1.8
|
|
100 |
*/
|
|
101 |
final class ChronoLocalDateTimeImpl<D extends ChronoLocalDate<D>>
|
|
102 |
implements ChronoLocalDateTime<D>, Temporal, TemporalAdjuster, Serializable {
|
|
103 |
|
|
104 |
/**
|
|
105 |
* Serialization version.
|
|
106 |
*/
|
|
107 |
private static final long serialVersionUID = 4556003607393004514L;
|
|
108 |
/**
|
|
109 |
* Hours per day.
|
|
110 |
*/
|
|
111 |
static final int HOURS_PER_DAY = 24;
|
|
112 |
/**
|
|
113 |
* Minutes per hour.
|
|
114 |
*/
|
|
115 |
static final int MINUTES_PER_HOUR = 60;
|
|
116 |
/**
|
|
117 |
* Minutes per day.
|
|
118 |
*/
|
|
119 |
static final int MINUTES_PER_DAY = MINUTES_PER_HOUR * HOURS_PER_DAY;
|
|
120 |
/**
|
|
121 |
* Seconds per minute.
|
|
122 |
*/
|
|
123 |
static final int SECONDS_PER_MINUTE = 60;
|
|
124 |
/**
|
|
125 |
* Seconds per hour.
|
|
126 |
*/
|
|
127 |
static final int SECONDS_PER_HOUR = SECONDS_PER_MINUTE * MINUTES_PER_HOUR;
|
|
128 |
/**
|
|
129 |
* Seconds per day.
|
|
130 |
*/
|
|
131 |
static final int SECONDS_PER_DAY = SECONDS_PER_HOUR * HOURS_PER_DAY;
|
|
132 |
/**
|
|
133 |
* Milliseconds per day.
|
|
134 |
*/
|
|
135 |
static final long MILLIS_PER_DAY = SECONDS_PER_DAY * 1000L;
|
|
136 |
/**
|
|
137 |
* Microseconds per day.
|
|
138 |
*/
|
|
139 |
static final long MICROS_PER_DAY = SECONDS_PER_DAY * 1000_000L;
|
|
140 |
/**
|
|
141 |
* Nanos per second.
|
|
142 |
*/
|
|
143 |
static final long NANOS_PER_SECOND = 1000_000_000L;
|
|
144 |
/**
|
|
145 |
* Nanos per minute.
|
|
146 |
*/
|
|
147 |
static final long NANOS_PER_MINUTE = NANOS_PER_SECOND * SECONDS_PER_MINUTE;
|
|
148 |
/**
|
|
149 |
* Nanos per hour.
|
|
150 |
*/
|
|
151 |
static final long NANOS_PER_HOUR = NANOS_PER_MINUTE * MINUTES_PER_HOUR;
|
|
152 |
/**
|
|
153 |
* Nanos per day.
|
|
154 |
*/
|
|
155 |
static final long NANOS_PER_DAY = NANOS_PER_HOUR * HOURS_PER_DAY;
|
|
156 |
|
|
157 |
/**
|
|
158 |
* The date part.
|
|
159 |
*/
|
|
160 |
private final D date;
|
|
161 |
/**
|
|
162 |
* The time part.
|
|
163 |
*/
|
|
164 |
private final LocalTime time;
|
|
165 |
|
|
166 |
//-----------------------------------------------------------------------
|
|
167 |
/**
|
|
168 |
* Obtains an instance of {@code ChronoLocalDateTime} from a date and time.
|
|
169 |
*
|
|
170 |
* @param date the local date, not null
|
|
171 |
* @param time the local time, not null
|
|
172 |
* @return the local date-time, not null
|
|
173 |
*/
|
16852
|
174 |
@SuppressWarnings("rawtypes")
|
15658
|
175 |
static ChronoLocalDateTimeImpl<?> of(ChronoLocalDate<?> date, LocalTime time) {
|
|
176 |
return new ChronoLocalDateTimeImpl(date, time);
|
|
177 |
}
|
|
178 |
|
|
179 |
/**
|
|
180 |
* Constructor.
|
|
181 |
*
|
|
182 |
* @param date the date part of the date-time, not null
|
|
183 |
* @param time the time part of the date-time, not null
|
|
184 |
*/
|
|
185 |
private ChronoLocalDateTimeImpl(D date, LocalTime time) {
|
|
186 |
Objects.requireNonNull(date, "date");
|
|
187 |
Objects.requireNonNull(time, "time");
|
|
188 |
this.date = date;
|
|
189 |
this.time = time;
|
|
190 |
}
|
|
191 |
|
|
192 |
/**
|
|
193 |
* Returns a copy of this date-time with the new date and time, checking
|
|
194 |
* to see if a new object is in fact required.
|
|
195 |
*
|
|
196 |
* @param newDate the date of the new date-time, not null
|
|
197 |
* @param newTime the time of the new date-time, not null
|
|
198 |
* @return the date-time, not null
|
|
199 |
*/
|
|
200 |
private ChronoLocalDateTimeImpl<D> with(Temporal newDate, LocalTime newTime) {
|
|
201 |
if (date == newDate && time == newTime) {
|
|
202 |
return this;
|
|
203 |
}
|
|
204 |
// Validate that the new Temporal is a ChronoLocalDate (and not something else)
|
16852
|
205 |
D cd = (D) date.getChronology().ensureChronoLocalDate(newDate);
|
|
206 |
return new ChronoLocalDateTimeImpl<>(cd, newTime);
|
15658
|
207 |
}
|
|
208 |
|
|
209 |
//-----------------------------------------------------------------------
|
|
210 |
@Override
|
|
211 |
public D toLocalDate() {
|
|
212 |
return date;
|
|
213 |
}
|
|
214 |
|
|
215 |
@Override
|
|
216 |
public LocalTime toLocalTime() {
|
|
217 |
return time;
|
|
218 |
}
|
|
219 |
|
|
220 |
//-----------------------------------------------------------------------
|
|
221 |
@Override
|
|
222 |
public boolean isSupported(TemporalField field) {
|
|
223 |
if (field instanceof ChronoField) {
|
|
224 |
ChronoField f = (ChronoField) field;
|
16852
|
225 |
return f.isDateBased() || f.isTimeBased();
|
15658
|
226 |
}
|
|
227 |
return field != null && field.isSupportedBy(this);
|
|
228 |
}
|
|
229 |
|
|
230 |
@Override
|
|
231 |
public ValueRange range(TemporalField field) {
|
|
232 |
if (field instanceof ChronoField) {
|
|
233 |
ChronoField f = (ChronoField) field;
|
16852
|
234 |
return (f.isTimeBased() ? time.range(field) : date.range(field));
|
15658
|
235 |
}
|
|
236 |
return field.rangeRefinedBy(this);
|
|
237 |
}
|
|
238 |
|
|
239 |
@Override
|
|
240 |
public int get(TemporalField field) {
|
|
241 |
if (field instanceof ChronoField) {
|
|
242 |
ChronoField f = (ChronoField) field;
|
16852
|
243 |
return (f.isTimeBased() ? time.get(field) : date.get(field));
|
15658
|
244 |
}
|
|
245 |
return range(field).checkValidIntValue(getLong(field), field);
|
|
246 |
}
|
|
247 |
|
|
248 |
@Override
|
|
249 |
public long getLong(TemporalField field) {
|
|
250 |
if (field instanceof ChronoField) {
|
|
251 |
ChronoField f = (ChronoField) field;
|
16852
|
252 |
return (f.isTimeBased() ? time.getLong(field) : date.getLong(field));
|
15658
|
253 |
}
|
|
254 |
return field.getFrom(this);
|
|
255 |
}
|
|
256 |
|
|
257 |
//-----------------------------------------------------------------------
|
|
258 |
@SuppressWarnings("unchecked")
|
|
259 |
@Override
|
|
260 |
public ChronoLocalDateTimeImpl<D> with(TemporalAdjuster adjuster) {
|
|
261 |
if (adjuster instanceof ChronoLocalDate) {
|
|
262 |
// The Chronology is checked in with(date,time)
|
|
263 |
return with((ChronoLocalDate<D>) adjuster, time);
|
|
264 |
} else if (adjuster instanceof LocalTime) {
|
|
265 |
return with(date, (LocalTime) adjuster);
|
|
266 |
} else if (adjuster instanceof ChronoLocalDateTimeImpl) {
|
|
267 |
return (ChronoLocalDateTimeImpl<D>)(date.getChronology().ensureChronoLocalDateTime((ChronoLocalDateTimeImpl<?>) adjuster));
|
|
268 |
}
|
|
269 |
return (ChronoLocalDateTimeImpl<D>)(date.getChronology().ensureChronoLocalDateTime((ChronoLocalDateTimeImpl<?>) adjuster.adjustInto(this)));
|
|
270 |
}
|
|
271 |
|
|
272 |
@Override
|
|
273 |
public ChronoLocalDateTimeImpl<D> with(TemporalField field, long newValue) {
|
|
274 |
if (field instanceof ChronoField) {
|
|
275 |
ChronoField f = (ChronoField) field;
|
16852
|
276 |
if (f.isTimeBased()) {
|
15658
|
277 |
return with(date, time.with(field, newValue));
|
|
278 |
} else {
|
|
279 |
return with(date.with(field, newValue), time);
|
|
280 |
}
|
|
281 |
}
|
|
282 |
return (ChronoLocalDateTimeImpl<D>)(date.getChronology().ensureChronoLocalDateTime(field.adjustInto(this, newValue)));
|
|
283 |
}
|
|
284 |
|
|
285 |
//-----------------------------------------------------------------------
|
|
286 |
@Override
|
|
287 |
public ChronoLocalDateTimeImpl<D> plus(long amountToAdd, TemporalUnit unit) {
|
|
288 |
if (unit instanceof ChronoUnit) {
|
|
289 |
ChronoUnit f = (ChronoUnit) unit;
|
|
290 |
switch (f) {
|
|
291 |
case NANOS: return plusNanos(amountToAdd);
|
|
292 |
case MICROS: return plusDays(amountToAdd / MICROS_PER_DAY).plusNanos((amountToAdd % MICROS_PER_DAY) * 1000);
|
|
293 |
case MILLIS: return plusDays(amountToAdd / MILLIS_PER_DAY).plusNanos((amountToAdd % MILLIS_PER_DAY) * 1000000);
|
|
294 |
case SECONDS: return plusSeconds(amountToAdd);
|
|
295 |
case MINUTES: return plusMinutes(amountToAdd);
|
|
296 |
case HOURS: return plusHours(amountToAdd);
|
|
297 |
case HALF_DAYS: return plusDays(amountToAdd / 256).plusHours((amountToAdd % 256) * 12); // no overflow (256 is multiple of 2)
|
|
298 |
}
|
|
299 |
return with(date.plus(amountToAdd, unit), time);
|
|
300 |
}
|
|
301 |
return (ChronoLocalDateTimeImpl<D>)(date.getChronology().ensureChronoLocalDateTime(unit.addTo(this, amountToAdd)));
|
|
302 |
}
|
|
303 |
|
|
304 |
private ChronoLocalDateTimeImpl<D> plusDays(long days) {
|
|
305 |
return with(date.plus(days, ChronoUnit.DAYS), time);
|
|
306 |
}
|
|
307 |
|
|
308 |
private ChronoLocalDateTimeImpl<D> plusHours(long hours) {
|
|
309 |
return plusWithOverflow(date, hours, 0, 0, 0);
|
|
310 |
}
|
|
311 |
|
|
312 |
private ChronoLocalDateTimeImpl<D> plusMinutes(long minutes) {
|
|
313 |
return plusWithOverflow(date, 0, minutes, 0, 0);
|
|
314 |
}
|
|
315 |
|
|
316 |
ChronoLocalDateTimeImpl<D> plusSeconds(long seconds) {
|
|
317 |
return plusWithOverflow(date, 0, 0, seconds, 0);
|
|
318 |
}
|
|
319 |
|
|
320 |
private ChronoLocalDateTimeImpl<D> plusNanos(long nanos) {
|
|
321 |
return plusWithOverflow(date, 0, 0, 0, nanos);
|
|
322 |
}
|
|
323 |
|
|
324 |
//-----------------------------------------------------------------------
|
|
325 |
private ChronoLocalDateTimeImpl<D> plusWithOverflow(ChronoLocalDate<?> newDate, long hours, long minutes, long seconds, long nanos) {
|
|
326 |
// 9223372036854775808 long, 2147483648 int
|
|
327 |
if ((hours | minutes | seconds | nanos) == 0) {
|
|
328 |
return with(newDate, time);
|
|
329 |
}
|
|
330 |
long totDays = nanos / NANOS_PER_DAY + // max/24*60*60*1B
|
|
331 |
seconds / SECONDS_PER_DAY + // max/24*60*60
|
|
332 |
minutes / MINUTES_PER_DAY + // max/24*60
|
|
333 |
hours / HOURS_PER_DAY; // max/24
|
|
334 |
long totNanos = nanos % NANOS_PER_DAY + // max 86400000000000
|
|
335 |
(seconds % SECONDS_PER_DAY) * NANOS_PER_SECOND + // max 86400000000000
|
|
336 |
(minutes % MINUTES_PER_DAY) * NANOS_PER_MINUTE + // max 86400000000000
|
|
337 |
(hours % HOURS_PER_DAY) * NANOS_PER_HOUR; // max 86400000000000
|
|
338 |
long curNoD = time.toNanoOfDay(); // max 86400000000000
|
|
339 |
totNanos = totNanos + curNoD; // total 432000000000000
|
|
340 |
totDays += Math.floorDiv(totNanos, NANOS_PER_DAY);
|
|
341 |
long newNoD = Math.floorMod(totNanos, NANOS_PER_DAY);
|
|
342 |
LocalTime newTime = (newNoD == curNoD ? time : LocalTime.ofNanoOfDay(newNoD));
|
|
343 |
return with(newDate.plus(totDays, ChronoUnit.DAYS), newTime);
|
|
344 |
}
|
|
345 |
|
|
346 |
//-----------------------------------------------------------------------
|
|
347 |
@Override
|
|
348 |
public ChronoZonedDateTime<D> atZone(ZoneId zone) {
|
|
349 |
return ChronoZonedDateTimeImpl.ofBest(this, zone, null);
|
|
350 |
}
|
|
351 |
|
|
352 |
//-----------------------------------------------------------------------
|
|
353 |
@Override
|
|
354 |
public long periodUntil(Temporal endDateTime, TemporalUnit unit) {
|
|
355 |
if (endDateTime instanceof ChronoLocalDateTime == false) {
|
|
356 |
throw new DateTimeException("Unable to calculate period between objects of two different types");
|
|
357 |
}
|
|
358 |
@SuppressWarnings("unchecked")
|
|
359 |
ChronoLocalDateTime<D> end = (ChronoLocalDateTime<D>) endDateTime;
|
|
360 |
if (toLocalDate().getChronology().equals(end.toLocalDate().getChronology()) == false) {
|
|
361 |
throw new DateTimeException("Unable to calculate period between two different chronologies");
|
|
362 |
}
|
|
363 |
if (unit instanceof ChronoUnit) {
|
|
364 |
ChronoUnit f = (ChronoUnit) unit;
|
|
365 |
if (f.isTimeUnit()) {
|
|
366 |
long amount = end.getLong(EPOCH_DAY) - date.getLong(EPOCH_DAY);
|
|
367 |
switch (f) {
|
|
368 |
case NANOS: amount = Math.multiplyExact(amount, NANOS_PER_DAY); break;
|
|
369 |
case MICROS: amount = Math.multiplyExact(amount, MICROS_PER_DAY); break;
|
|
370 |
case MILLIS: amount = Math.multiplyExact(amount, MILLIS_PER_DAY); break;
|
|
371 |
case SECONDS: amount = Math.multiplyExact(amount, SECONDS_PER_DAY); break;
|
|
372 |
case MINUTES: amount = Math.multiplyExact(amount, MINUTES_PER_DAY); break;
|
|
373 |
case HOURS: amount = Math.multiplyExact(amount, HOURS_PER_DAY); break;
|
|
374 |
case HALF_DAYS: amount = Math.multiplyExact(amount, 2); break;
|
|
375 |
}
|
|
376 |
return Math.addExact(amount, time.periodUntil(end.toLocalTime(), unit));
|
|
377 |
}
|
|
378 |
D endDate = end.toLocalDate();
|
|
379 |
if (end.toLocalTime().isBefore(time)) {
|
16852
|
380 |
endDate = endDate.minus(1, ChronoUnit.DAYS);
|
15658
|
381 |
}
|
|
382 |
return date.periodUntil(endDate, unit);
|
|
383 |
}
|
|
384 |
return unit.between(this, endDateTime);
|
|
385 |
}
|
|
386 |
|
|
387 |
//-----------------------------------------------------------------------
|
|
388 |
private Object writeReplace() {
|
|
389 |
return new Ser(Ser.CHRONO_LOCAL_DATE_TIME_TYPE, this);
|
|
390 |
}
|
|
391 |
|
|
392 |
/**
|
|
393 |
* Defend against malicious streams.
|
|
394 |
* @return never
|
|
395 |
* @throws InvalidObjectException always
|
|
396 |
*/
|
|
397 |
private Object readResolve() throws ObjectStreamException {
|
|
398 |
throw new InvalidObjectException("Deserialization via serialization delegate");
|
|
399 |
}
|
|
400 |
|
|
401 |
void writeExternal(ObjectOutput out) throws IOException {
|
|
402 |
out.writeObject(date);
|
|
403 |
out.writeObject(time);
|
|
404 |
}
|
|
405 |
|
|
406 |
static ChronoLocalDateTime<?> readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
|
16852
|
407 |
ChronoLocalDate<?> date = (ChronoLocalDate<?>) in.readObject();
|
15658
|
408 |
LocalTime time = (LocalTime) in.readObject();
|
|
409 |
return date.atTime(time);
|
|
410 |
}
|
|
411 |
|
|
412 |
//-----------------------------------------------------------------------
|
|
413 |
@Override
|
|
414 |
public boolean equals(Object obj) {
|
|
415 |
if (this == obj) {
|
|
416 |
return true;
|
|
417 |
}
|
|
418 |
if (obj instanceof ChronoLocalDateTime) {
|
|
419 |
return compareTo((ChronoLocalDateTime<?>) obj) == 0;
|
|
420 |
}
|
|
421 |
return false;
|
|
422 |
}
|
|
423 |
|
|
424 |
@Override
|
|
425 |
public int hashCode() {
|
|
426 |
return toLocalDate().hashCode() ^ toLocalTime().hashCode();
|
|
427 |
}
|
|
428 |
|
|
429 |
@Override
|
|
430 |
public String toString() {
|
|
431 |
return toLocalDate().toString() + 'T' + toLocalTime().toString();
|
|
432 |
}
|
|
433 |
|
|
434 |
}
|