1 /* GENERATED SOURCE. DO NOT MODIFY. */ 2 // © 2016 and later: Unicode, Inc. and others. 3 // License & terms of use: http://www.unicode.org/copyright.html#License 4 /* 5 ******************************************************************************* 6 * Copyright (C) 2008-2009, International Business Machines 7 * Corporation and others. All Rights Reserved. 8 ******************************************************************************* 9 */ 10 11 package android.icu.util; 12 13 import java.io.Serializable; 14 15 16 /** 17 * This class represents date interval. 18 * It is a pair of long representing from date 1 to date 2. 19 */ 20 public final class DateInterval implements Serializable { 21 22 private static final long serialVersionUID = 1; 23 24 private final long fromDate; 25 private final long toDate; 26 27 /** 28 * Constructor given from date and to date. 29 * @param from The from date in date interval. 30 * @param to The to date in date interval. 31 */ DateInterval(long from, long to)32 public DateInterval(long from, long to) 33 { 34 fromDate = from; 35 toDate = to; 36 } 37 38 /** 39 * Get the from date. 40 * @return the from date in dateInterval. 41 */ getFromDate()42 public long getFromDate() 43 { 44 return fromDate; 45 } 46 47 /** 48 * Get the to date. 49 * @return the to date in dateInterval. 50 */ getToDate()51 public long getToDate() 52 { 53 return toDate; 54 } 55 56 /** 57 * Override equals 58 */ equals(Object a)59 public boolean equals(Object a) { 60 if ( a instanceof DateInterval ) { 61 DateInterval di = (DateInterval)a; 62 return fromDate == di.fromDate && toDate == di.toDate; 63 } 64 return false; 65 } 66 67 /** 68 * Override hashcode 69 */ hashCode()70 public int hashCode() { 71 return (int)(fromDate + toDate); 72 } 73 74 /** 75 * Override toString 76 */ toString()77 public String toString() { 78 return String.valueOf(fromDate) + " " + String.valueOf(toDate); 79 } 80 81 } // end class DateInterval 82