ICU-6157 merge from branch

X-SVN-Rev: 24056
This commit is contained in:
Xiaomei Ji 2008-05-28 22:45:28 +00:00
parent 5d4fddea88
commit ae6d1cd11b
2 changed files with 74 additions and 0 deletions

1
.gitattributes vendored
View file

@ -332,6 +332,7 @@ icu4j/src/com/ibm/icu/text/DateIntervalFormat.java -text
icu4j/src/com/ibm/icu/text/DateIntervalInfo.java -text
icu4j/src/com/ibm/icu/text/DurationFormat.java -text
icu4j/src/com/ibm/icu/text/ThaiBreakIterator.java -text
icu4j/src/com/ibm/icu/util/DateInterval.java -text
icu4j/src/com/ibm/richtext/textapps/resources/unicode.arabic.red -text
icu4j/src/com/ibm/richtext/textapps/resources/unicode.hebrew.red -text
tools/unicodetools/com/ibm/rbm/docs/images/TitleLogo_transparent.gif -text

View file

@ -0,0 +1,73 @@
/*
*******************************************************************************
* Copyright (C) 2008, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
*/
package com.ibm.icu.util;
import java.io.Serializable;
/**
* This class represents date interval.
* It is a pair of long representing from long 1 to long 2.
* @draft ICU 4.0
**/
public final class DateInterval implements Serializable {
private static final long serialVersionUID = 1;
private final long fromDate;
private final long toDate;
/**
* Constructor given from date and to date.
* @param from The from date in date interval.
* @param to The to date in date interval.
* @draft ICU 4.0
*/
public DateInterval(long from, long to)
{
fromDate = from;
toDate = to;
}
/**
* Get the from date.
* @return the from date in dateInterval.
* @draft ICU 4.0
*/
public long getFromDate()
{
return fromDate;
}
/**
* Get the to date.
* @return the to date in dateInterval.
* @draft ICU 4.0
*/
public long getToDate()
{
return toDate;
}
public boolean equals(Object a) {
if ( a instanceof DateInterval ) {
DateInterval di = (DateInterval)a;
return fromDate == di.fromDate && toDate == di.toDate;
}
return false;
}
public int hashCode() {
return (int)(fromDate + toDate);
}
public String toString() {
return String.valueOf(fromDate) + " " + String.valueOf(toDate);
}
} // end class DateInterval