2 *******************************************************************************
\r
3 * Copyright (C) 2008-2009, International Business Machines
\r
4 * Corporation and others. All Rights Reserved.
\r
5 *******************************************************************************
\r
8 package com.ibm.icu.util;
\r
10 import java.io.Serializable;
\r
14 * This class represents date interval.
\r
15 * It is a pair of long representing from date 1 to date 2.
\r
18 public final class DateInterval implements Serializable {
\r
20 private static final long serialVersionUID = 1;
\r
22 private final long fromDate;
\r
23 private final long toDate;
\r
26 * Constructor given from date and to date.
\r
27 * @param from The from date in date interval.
\r
28 * @param to The to date in date interval.
\r
31 public DateInterval(long from, long to)
\r
38 * Get the from date.
\r
39 * @return the from date in dateInterval.
\r
42 public long getFromDate()
\r
49 * @return the to date in dateInterval.
\r
52 public long getToDate()
\r
61 public boolean equals(Object a) {
\r
62 if ( a instanceof DateInterval ) {
\r
63 DateInterval di = (DateInterval)a;
\r
64 return fromDate == di.fromDate && toDate == di.toDate;
\r
73 public int hashCode() {
\r
74 return (int)(fromDate + toDate);
\r
81 public String toString() {
\r
82 return String.valueOf(fromDate) + " " + String.valueOf(toDate);
\r
85 } // end class DateInterval
\r