当前位置: 首页>>代码示例>>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;未经允许,请勿转载。