當前位置: 首頁>>代碼示例>>Java>>正文


Java ZoneOffset.equals方法代碼示例

本文整理匯總了Java中java.time.ZoneOffset.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java ZoneOffset.equals方法的具體用法?Java ZoneOffset.equals怎麽用?Java ZoneOffset.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.time.ZoneOffset的用法示例。


在下文中一共展示了ZoneOffset.equals方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: withEarlierOffsetAtOverlap

import java.time.ZoneOffset; //導入方法依賴的package包/類
@Override
public ChronoZonedDateTime<D> withEarlierOffsetAtOverlap() {
    ZoneOffsetTransition trans = getZone().getRules().getTransition(LocalDateTime.from(this));
    if (trans != null && trans.isOverlap()) {
        ZoneOffset earlierOffset = trans.getOffsetBefore();
        if (earlierOffset.equals(offset) == false) {
            return new ChronoZonedDateTimeImpl<>(dateTime, earlierOffset, zone);
        }
    }
    return this;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:12,代碼來源:ChronoZonedDateTimeImpl.java

示例2: withLaterOffsetAtOverlap

import java.time.ZoneOffset; //導入方法依賴的package包/類
@Override
public ChronoZonedDateTime<D> withLaterOffsetAtOverlap() {
    ZoneOffsetTransition trans = getZone().getRules().getTransition(LocalDateTime.from(this));
    if (trans != null) {
        ZoneOffset offset = trans.getOffsetAfter();
        if (offset.equals(getOffset()) == false) {
            return new ChronoZonedDateTimeImpl<>(dateTime, offset, zone);
        }
    }
    return this;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:12,代碼來源:ChronoZonedDateTimeImpl.java

示例3: readExternal

import java.time.ZoneOffset; //導入方法依賴的package包/類
/**
 * Reads the state from the stream.
 *
 * @param in  the input stream, not null
 * @return the created object, not null
 * @throws IOException if an error occurs
 */
static ZoneOffsetTransition readExternal(DataInput in) throws IOException {
    long epochSecond = Ser.readEpochSec(in);
    ZoneOffset before = Ser.readOffset(in);
    ZoneOffset after = Ser.readOffset(in);
    if (before.equals(after)) {
        throw new IllegalArgumentException("Offsets must not be equal");
    }
    return new ZoneOffsetTransition(epochSecond, before, after);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:17,代碼來源:ZoneOffsetTransition.java

示例4: of

import java.time.ZoneOffset; //導入方法依賴的package包/類
/**
 * Obtains an instance defining a transition between two offsets.
 * <p>
 * Applications should normally obtain an instance from {@link ZoneRules}.
 * This factory is only intended for use when creating {@link ZoneRules}.
 *
 * @param transition  the transition date-time at the transition, which never
 *  actually occurs, expressed local to the before offset, not null
 * @param offsetBefore  the offset before the transition, not null
 * @param offsetAfter  the offset at and after the transition, not null
 * @return the transition, not null
 * @throws IllegalArgumentException if {@code offsetBefore} and {@code offsetAfter}
 *         are equal, or {@code transition.getNano()} returns non-zero value
 */
public static ZoneOffsetTransition of(LocalDateTime transition, ZoneOffset offsetBefore, ZoneOffset offsetAfter) {
    Objects.requireNonNull(transition, "transition");
    Objects.requireNonNull(offsetBefore, "offsetBefore");
    Objects.requireNonNull(offsetAfter, "offsetAfter");
    if (offsetBefore.equals(offsetAfter)) {
        throw new IllegalArgumentException("Offsets must not be equal");
    }
    if (transition.getNano() != 0) {
        throw new IllegalArgumentException("Nano-of-second must be zero");
    }
    return new ZoneOffsetTransition(transition, offsetBefore, offsetAfter);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:27,代碼來源:ZoneOffsetTransition.java


注:本文中的java.time.ZoneOffset.equals方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。