Package org.goda.time

Examples of org.goda.time.ReadableDuration


     * @throws NullPointerException if the object is null
     * @throws ClassCastException if the given object is not supported
     */
    public int compareTo(Object obj) {
        // Comparable contract means we cannot handle null or other types gracefully
        ReadableDuration thisDuration = (ReadableDuration) this;
        ReadableDuration otherDuration = (ReadableDuration) obj;
       
        long thisMillis = thisDuration.getMillis();
        long otherMillis = otherDuration.getMillis();
       
        // cannot do (thisMillis - otherMillis) as it can overflow
        if (thisMillis < otherMillis) {
            return -1;
        }
View Full Code Here


            return true;
        }
        if (duration instanceof ReadableDuration == false) {
            return false;
        }
        ReadableDuration other = (ReadableDuration) duration;
        return (getMillis() == other.getMillis());
    }
View Full Code Here

     * @throws NullPointerException if the duration or object is null
     * @throws ClassCastException if the object is an invalid type
     * @throws IllegalArgumentException if the object is invalid
     */
    public void setInto(ReadWritablePeriod writablePeriod, Object object, Chronology chrono) {
        ReadableDuration dur = (ReadableDuration) object;
        chrono = DateTimeUtils.getChronology(chrono);
        long duration = dur.getMillis();
        int[] values = chrono.get(writablePeriod, duration);
        for (int i = 0; i < values.length; i++) {
            writablePeriod.setValue(i, values[i]);
        }
    }
View Full Code Here

TOP

Related Classes of org.goda.time.ReadableDuration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.