net.time4j.tz.ZonalTransition.isGap()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(94)

本文整理了Java中net.time4j.tz.ZonalTransition.isGap()方法的一些代码示例,展示了ZonalTransition.isGap()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZonalTransition.isGap()方法的具体详情如下:
包路径:net.time4j.tz.ZonalTransition
类名称:ZonalTransition
方法名:isGap

ZonalTransition.isGap介绍

[英]Queries if this transition represents a gap on the local timeline where local timestamps are invalid.
[中]查询此转换是否表示本地时间戳无效的本地时间轴上的间隔。

代码示例

代码示例来源:origin: net.time4j/time4j-core

@Override
public boolean isInvalid(
  GregorianDate localDate,
  WallTime localTime
) {
  ZonalTransition t = this.history.getConflictTransition(localDate, localTime);
  return ((t != null) && t.isGap());
}

代码示例来源:origin: net.time4j/time4j-core

private Moment atFirstMoment(Timezone tz) {
  TransitionHistory history = tz.getHistory();
  if (history == null) {
    throw new UnsupportedOperationException(
      "Timezone repository does not expose its transition history: "
      + Timezone.getProviderInfo());
  }
  ZonalTransition conflict = history.getConflictTransition(this, PlainTime.MIN);
  if ((conflict != null) && conflict.isGap()) {
    return Moment.of(conflict.getPosixTime(), TimeScale.POSIX);
  }
  return this.at(PlainTime.MIN).in(tz);
}

代码示例来源:origin: net.time4j/time4j-core

if (conflict.isGap()) {
  switch (this.gapResolver) {
    case PUSH_FORWARD:

代码示例来源:origin: net.time4j/time4j-core

private PlainTimestamp atStartOfDay(TransitionHistory history) {
  if (history == null) {
    throw new UnsupportedOperationException(
      "Timezone repository does not expose its transition history: "
      + Timezone.getProviderInfo());
  }
  ZonalTransition conflict = history.getConflictTransition(this, PlainTime.MIN);
  if ((conflict != null) && conflict.isGap()) {
    long localSeconds =
      conflict.getPosixTime() + conflict.getTotalOffset();
    PlainDate date =
      PlainDate.of(
        MathUtils.floorDivide(localSeconds, 86400),
        EpochDays.UNIX);
    int secondsOfDay = MathUtils.floorModulo(localSeconds, 86400);
    int second = secondsOfDay % 60;
    int minutesOfDay = secondsOfDay / 60;
    int minute = minutesOfDay % 60;
    int hour = minutesOfDay / 60;
    PlainTime time = PlainTime.of(hour, minute, second);
    return PlainTimestamp.of(date, time);
  }
  return this.at(PlainTime.MIN);
}

代码示例来源:origin: net.time4j/time4j-olson

ZonalTransition getConflictTransition(
  GregorianDate localDate,
  long localSecs
) {
  long preModel = this.initial.getPosixTime();
  int max =
    Math.max(
      this.initial.getPreviousOffset(),
      this.initial.getTotalOffset());
  if (localSecs <= preModel + max) {
    return null;
  }
  for (ZonalTransition t : this.getTransitions(localDate)) {
    long tt = t.getPosixTime();
    if (t.isGap()) {
      if (localSecs < tt + t.getPreviousOffset()) {
        return null; // offset = t.getPreviousOffset()
      } else if (localSecs < tt + t.getTotalOffset()) {
        return t;
      }
    } else if (t.isOverlap()) {
      if (localSecs < tt + t.getTotalOffset()) {
        return null; // offset = t.getPreviousOffset()
      } else if (localSecs < tt + t.getPreviousOffset()) {
        return t;
      }
    }
  }
  return null; // offset = lastTotalOffset
}

代码示例来源:origin: net.time4j/time4j-core

if (conflict.isGap()) {
  if (this.gapResolver == GapResolver.ABORT) {
    throwInvalidException(date, time, tz);

代码示例来源:origin: net.time4j/time4j-olson

List<ZonalOffset> getValidOffsets(
  GregorianDate localDate,
  long localSecs
) {
  long preModel = this.initial.getPosixTime();
  int last = this.initial.getTotalOffset();
  int max = Math.max(this.initial.getPreviousOffset(), last);
  if (localSecs <= preModel + max) {
    return TransitionModel.toList(last);
  }
  for (ZonalTransition t : this.getTransitions(localDate)) {
    long tt = t.getPosixTime();
    last = t.getTotalOffset();
    if (t.isGap()) {
      if (localSecs < tt + t.getPreviousOffset()) {
        return TransitionModel.toList(t.getPreviousOffset());
      } else if (localSecs < tt + last) {
        return Collections.emptyList();
      }
    } else if (t.isOverlap()) {
      if (localSecs < tt + last) {
        return TransitionModel.toList(t.getPreviousOffset());
      } else if (localSecs < tt + t.getPreviousOffset()) {
        return TransitionModel.toList(last, t.getPreviousOffset());
      }
    }
  }
  return TransitionModel.toList(last);
}

代码示例来源:origin: net.time4j/time4j-olson

if (test.isGap()) {
  assert (test.getPosixTime() + test.getTotalOffset() > localSecs);
  if (test.getPosixTime() + test.getPreviousOffset() <= localSecs) {

代码示例来源:origin: net.time4j/time4j-olson

if (test.isGap()) {
  assert (test.getPosixTime() + test.getTotalOffset() > localSecs);
  if (test.getPosixTime() + test.getPreviousOffset() <= localSecs) {

相关文章