gpt4 book ai didi

org.threeten.bp.zone.ZoneOffsetTransition.isGap()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 12:55:41 29 4
gpt4 key购买 nike

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

ZoneOffsetTransition.isGap介绍

[英]Does this transition represent a gap in the local time-line.

Gaps occur where there are local date-times that simply do not not exist. An example would be when the offset changes from +01:00 to +02:00. This might be described as 'the clocks will move forward one hour tonight at 1am'.
[中]这种转变是否代表了当地时间线的差距。
当本地日期时间根本不存在时,就会出现间隔。例如,偏移从+01:00更改为+02:00。这可能被描述为“时钟将在今晚凌晨1点向前移动一小时”。

代码示例

代码示例来源:origin: stackoverflow.com

LocalDateTime ldt = LocalDate.of(2015, 3, 29).atTime(LocalTime.of(1, 40)); 
ZoneOffsetTransition conflict = ZoneId.of("Europe/London").getRules().getTransition(ldt);
boolean gap = (conflict != null) && conflict.isGap(); // true

代码示例来源:origin: ThreeTen/threetenbp

/**
 * Returns a string describing this object.
 *
 * @return a string for debugging, not null
 */
@Override
public String toString() {
  StringBuilder buf = new StringBuilder();
  buf.append("Transition[")
    .append(isGap() ? "Gap" : "Overlap")
    .append(" at ")
    .append(transition)
    .append(offsetBefore)
    .append(" to ")
    .append(offsetAfter)
    .append(']');
  return buf.toString();
}

代码示例来源:origin: org.threeten/threetenbp

/**
 * Returns a string describing this object.
 *
 * @return a string for debugging, not null
 */
@Override
public String toString() {
  StringBuilder buf = new StringBuilder();
  buf.append("Transition[")
    .append(isGap() ? "Gap" : "Overlap")
    .append(" at ")
    .append(transition)
    .append(offsetBefore)
    .append(" to ")
    .append(offsetAfter)
    .append(']');
  return buf.toString();
}

代码示例来源:origin: ThreeTen/threetenbp

/**
 * Gets the valid offsets during this transition.
 * <p>
 * A gap will return an empty list, while an overlap will return both offsets.
 *
 * @return the list of valid offsets
 */
List<ZoneOffset> getValidOffsets() {
  if (isGap()) {
    return Collections.emptyList();
  }
  return Arrays.asList(getOffsetBefore(), getOffsetAfter());
}

代码示例来源:origin: org.threeten/threetenbp

/**
 * Gets the valid offsets during this transition.
 * <p>
 * A gap will return an empty list, while an overlap will return both offsets.
 *
 * @return the list of valid offsets
 */
List<ZoneOffset> getValidOffsets() {
  if (isGap()) {
    return Collections.emptyList();
  }
  return Arrays.asList(getOffsetBefore(), getOffsetAfter());
}

代码示例来源:origin: stackoverflow.com

LocalDateTime ldt = LocalDateTime.of(2015, 3, 29, 2, 30, 0, 0);
ZoneRules rules = ZoneId.of("Europe/Berlin").getRules();
ZoneOffsetTransition conflict = rules.getTransition(ldt);
if (conflict != null && conflict.isGap()) {
  ldt = conflict.getDateTimeAfter();
}
System.out.println(ldt); // 2015-03-29T03:00

代码示例来源:origin: org.threeten/threetenbp

localTransitionOffsetList.add(baseWallOffset);
for (ZoneOffsetTransition trans : transitionList) {
  if (trans.isGap()) {
    localTransitionList.add(trans.getDateTimeBefore());
    localTransitionList.add(trans.getDateTimeAfter());

代码示例来源:origin: ThreeTen/threetenbp

ZoneOffset after = wallOffsets[i + 1];
ZoneOffsetTransition trans = new ZoneOffsetTransition(savingsInstantTransitions[i], before, after);
if (trans.isGap()) {
  localTransitionList.add(trans.getDateTimeBefore());
  localTransitionList.add(trans.getDateTimeAfter());

代码示例来源:origin: ThreeTen/threetenbp

localTransitionOffsetList.add(baseWallOffset);
for (ZoneOffsetTransition trans : transitionList) {
  if (trans.isGap()) {
    localTransitionList.add(trans.getDateTimeBefore());
    localTransitionList.add(trans.getDateTimeAfter());

代码示例来源:origin: org.threeten/threetenbp

ZoneOffset after = wallOffsets[i + 1];
ZoneOffsetTransition trans = new ZoneOffsetTransition(savingsInstantTransitions[i], before, after);
if (trans.isGap()) {
  localTransitionList.add(trans.getDateTimeBefore());
  localTransitionList.add(trans.getDateTimeAfter());

代码示例来源:origin: ThreeTen/threetenbp

/**
 * Checks if the specified offset is valid during this transition.
 * <p>
 * This checks to see if the given offset will be valid at some point in the transition.
 * A gap will always return false.
 * An overlap will return true if the offset is either the before or after offset.
 *
 * @param offset  the offset to check, null returns false
 * @return true if the offset is valid during the transition
 */
public boolean isValidOffset(ZoneOffset offset) {
  return isGap() ? false : (getOffsetBefore().equals(offset) || getOffsetAfter().equals(offset));
}

代码示例来源:origin: org.threeten/threetenbp

/**
 * Checks if the specified offset is valid during this transition.
 * <p>
 * This checks to see if the given offset will be valid at some point in the transition.
 * A gap will always return false.
 * An overlap will return true if the offset is either the before or after offset.
 *
 * @param offset  the offset to check, null returns false
 * @return true if the offset is valid during the transition
 */
public boolean isValidOffset(ZoneOffset offset) {
  return isGap() ? false : (getOffsetBefore().equals(offset) || getOffsetAfter().equals(offset));
}

代码示例来源:origin: org.threeten/threetenbp

ZoneRules rules = zone.getRules();
ZoneOffsetTransition trans = rules.getTransition(ldt);
if (trans != null && trans.isGap()) {
  ldt = trans.getDateTimeAfter();

代码示例来源:origin: ThreeTen/threetenbp

ZoneRules rules = zone.getRules();
ZoneOffsetTransition trans = rules.getTransition(ldt);
if (trans != null && trans.isGap()) {
  ldt = trans.getDateTimeAfter();

代码示例来源:origin: ThreeTen/threetenbp

if (rules.isValidOffset(localDateTime, offset) == false) {
  ZoneOffsetTransition trans = rules.getTransition(localDateTime);
  if (trans != null && trans.isGap()) {

代码示例来源:origin: org.threeten/threetenbp

if (rules.isValidOffset(localDateTime, offset) == false) {
  ZoneOffsetTransition trans = rules.getTransition(localDateTime);
  if (trans != null && trans.isGap()) {

代码示例来源:origin: org.threeten/threetenbp

/**
 * Finds the offset info for a local date-time and transition.
 *
 * @param dt  the date-time, not null
 * @param trans  the transition, not null
 * @return the offset info, not null
 */
private Object findOffsetInfo(LocalDateTime dt, ZoneOffsetTransition trans) {
  LocalDateTime localTransition = trans.getDateTimeBefore();
  if (trans.isGap()) {
    if (dt.isBefore(localTransition)) {
      return trans.getOffsetBefore();
    }
    if (dt.isBefore(trans.getDateTimeAfter())) {
      return trans;
    } else {
      return trans.getOffsetAfter();
    }
  } else {
    if (dt.isBefore(localTransition) == false) {
      return trans.getOffsetAfter();
    }
    if (dt.isBefore(trans.getDateTimeAfter())) {
      return trans.getOffsetBefore();
    } else {
      return trans;
    }
  }
}

代码示例来源:origin: ThreeTen/threetenbp

/**
 * Finds the offset info for a local date-time and transition.
 *
 * @param dt  the date-time, not null
 * @param trans  the transition, not null
 * @return the offset info, not null
 */
private Object findOffsetInfo(LocalDateTime dt, ZoneOffsetTransition trans) {
  LocalDateTime localTransition = trans.getDateTimeBefore();
  if (trans.isGap()) {
    if (dt.isBefore(localTransition)) {
      return trans.getOffsetBefore();
    }
    if (dt.isBefore(trans.getDateTimeAfter())) {
      return trans;
    } else {
      return trans.getOffsetAfter();
    }
  } else {
    if (dt.isBefore(localTransition) == false) {
      return trans.getOffsetAfter();
    }
    if (dt.isBefore(trans.getDateTimeAfter())) {
      return trans.getOffsetBefore();
    } else {
      return trans;
    }
  }
}

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com