All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ibm.icu.util.TimeZoneTransition Maven / Gradle / Ivy

There is a newer version: 4.15.0-HBase-1.5
Show newest version
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html#License
/*
 *******************************************************************************
 * Copyright (C) 2007-2010, International Business Machines Corporation and    *
 * others. All Rights Reserved.                                                *
 *******************************************************************************
 */
package com.ibm.icu.util;
/**
 * TimeZoneTransition is a class representing a time zone transition.
 * An instance has a time of transition and rules for both before and
 * after the transition.
 *
 * @stable ICU 3.8
 */
public class TimeZoneTransition {
    private final TimeZoneRule from;
    private final TimeZoneRule to;
    private final long time;

    /**
     * Constructs a TimeZoneTransition with the time and the rules before/after
     * the transition.
     *
     * @param time  The time of transition in milliseconds since the base time.
     * @param from  The time zone rule used before the transition.
     * @param to    The time zone rule used after the transition.
     *
     * @stable ICU 3.8
     */
    public TimeZoneTransition(long time, TimeZoneRule from, TimeZoneRule to) {
        this.time = time;
        this.from = from;
        this.to = to;
    }

    /**
     * Returns the time of transition in milliseconds since the base time.
     *
     * @return The time of the transition in milliseconds since the base time.
     *
     * @stable ICU 3.8
     */
    public long getTime() {
        return time;
    }

    /**
     * Returns the rule used after the transition.
     *
     * @return The time zone rule used after the transition.
     *
     * @stable ICU 3.8
     */
    public TimeZoneRule getTo() {
        return to;
    }

    /**
     * Returns the rule used before the transition.
     *
     * @return The time zone rule used after the transition.
     *
     * @stable ICU 3.8
     */
    public TimeZoneRule getFrom() {
        return from;
    }

    /**
     * Returns a String representation of this TimeZoneTransition object.
     * This method is used for debugging purpose only.  The string representation can be changed
     * in future version of ICU without any notice.
     *
     * @stable ICU 3.8
     */
    @Override
    public String toString() {
        StringBuilder buf = new StringBuilder();
        buf.append("time=" + time);
        buf.append(", from={" + from + "}");
        buf.append(", to={" + to + "}");
        return buf.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy