当前位置: 首页>>代码示例>>Java>>正文


Java Jdk7Methods.Long_compare方法代码示例

本文整理汇总了Java中java.time.jdk8.Jdk7Methods.Long_compare方法的典型用法代码示例。如果您正苦于以下问题:Java Jdk7Methods.Long_compare方法的具体用法?Java Jdk7Methods.Long_compare怎么用?Java Jdk7Methods.Long_compare使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.time.jdk8.Jdk7Methods的用法示例。


在下文中一共展示了Jdk7Methods.Long_compare方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: compareTo

import java.time.jdk8.Jdk7Methods; //导入方法依赖的package包/类
/**
 * Compares this duration to the specified {@code Duration}.
 * <p>
 * The comparison is based on the total length of the durations. It is "consistent with equals", as defined
 * by {@link Comparable}.
 * 
 * @param otherDuration the other duration to compare to, not null
 * @return the comparator value, negative if less, positive if greater
 */
@Override
public int compareTo(Duration otherDuration) {

  int cmp = Jdk7Methods.Long_compare(this.seconds, otherDuration.seconds);
  if (cmp != 0) {
    return cmp;
  }
  return this.nanos - otherDuration.nanos;
}
 
开发者ID:kiegroup,项目名称:optashift-employee-rostering,代码行数:19,代码来源:Duration.java

示例2: compare

import java.time.jdk8.Jdk7Methods; //导入方法依赖的package包/类
@Override
public int compare(ChronoZonedDateTime<?> datetime1, ChronoZonedDateTime<?> datetime2) {

  int cmp = Jdk7Methods.Long_compare(datetime1.toEpochSecond(), datetime2.toEpochSecond());
  if (cmp == 0) {
    cmp = Jdk7Methods.Long_compare(datetime1.getTime().toNanoOfDay(), datetime2.getTime().toNanoOfDay());
  }
  return cmp;
}
 
开发者ID:kiegroup,项目名称:optashift-employee-rostering,代码行数:10,代码来源:ChronoZonedDateTime.java

示例3: compare

import java.time.jdk8.Jdk7Methods; //导入方法依赖的package包/类
@Override
public int compare(ChronoLocalDateTime<?> datetime1, ChronoLocalDateTime<?> datetime2) {

  int cmp = Jdk7Methods.Long_compare(datetime1.getDate().toEpochDay(), datetime2.getDate().toEpochDay());
  if (cmp == 0) {
    cmp = Jdk7Methods.Long_compare(datetime1.getTime().toNanoOfDay(), datetime2.getTime().toNanoOfDay());
  }
  return cmp;
}
 
开发者ID:kiegroup,项目名称:optashift-employee-rostering,代码行数:10,代码来源:ChronoLocalDateTime.java

示例4: compareTo

import java.time.jdk8.Jdk7Methods; //导入方法依赖的package包/类
/**
 * Compares this {@code OffsetDateTime} to another date-time.
 * <p>
 * The comparison is based on the instant then on the local date-time. It is "consistent with equals", as
 * defined by {@link Comparable}.
 * <p>
 * For example, the following is the comparator order:
 * <ol>
 * <li>{@code 2008-12-03T10:30+01:00}</li>
 * <li>{@code 2008-12-03T11:00+01:00}</li>
 * <li>{@code 2008-12-03T12:00+02:00}</li>
 * <li>{@code 2008-12-03T11:30+01:00}</li>
 * <li>{@code 2008-12-03T12:00+01:00}</li>
 * <li>{@code 2008-12-03T12:30+01:00}</li>
 * </ol>
 * Values #2 and #3 represent the same instant on the time-line. When two values represent the same instant,
 * the local date-time is compared to distinguish them. This step is needed to make the ordering consistent
 * with {@code equals()}.
 * 
 * @param other the other date-time to compare to, not null
 * @return the comparator value, negative if less, positive if greater
 */
@Override
public int compareTo(OffsetDateTime other) {

  if (getOffset().equals(other.getOffset())) {
    return getDateTime().compareTo(other.getDateTime());
  }
  int cmp = Jdk7Methods.Long_compare(toEpochSecond(), other.toEpochSecond());
  if (cmp == 0) {
    cmp = getTime().getNano() - other.getTime().getNano();
    if (cmp == 0) {
      cmp = getDateTime().compareTo(other.getDateTime());
    }
  }
  return cmp;
}
 
开发者ID:kiegroup,项目名称:optashift-employee-rostering,代码行数:38,代码来源:OffsetDateTime.java

示例5: compare

import java.time.jdk8.Jdk7Methods; //导入方法依赖的package包/类
@Override
public int compare(DateTimeAccessor dateTime1, DateTimeAccessor dateTime2) {

  return Jdk7Methods.Long_compare(dateTime1.getLong(this), dateTime2.getLong(this));
}
 
开发者ID:kiegroup,项目名称:optashift-employee-rostering,代码行数:6,代码来源:WeekDefinition.java

示例6: compare

import java.time.jdk8.Jdk7Methods; //导入方法依赖的package包/类
@Override
public int compare(ChronoLocalDate<?> date1, ChronoLocalDate<?> date2) {

  return Jdk7Methods.Long_compare(date1.toEpochDay(), date2.toEpochDay());
}
 
开发者ID:kiegroup,项目名称:optashift-employee-rostering,代码行数:6,代码来源:ChronoLocalDate.java

示例7: compareTo

import java.time.jdk8.Jdk7Methods; //导入方法依赖的package包/类
/**
 * Compares this instant to the specified instant.
 * <p>
 * The comparison is based on the time-line position of the instants. It is "consistent with equals", as
 * defined by {@link Comparable}.
 * 
 * @param otherInstant the other instant to compare to, not null
 * @return the comparator value, negative if less, positive if greater
 * @throws NullPointerException if otherInstant is null
 */
@Override
public int compareTo(Instant otherInstant) {

  int cmp = Jdk7Methods.Long_compare(this.seconds, otherInstant.seconds);
  if (cmp != 0) {
    return cmp;
  }
  return this.nanos - otherInstant.nanos;
}
 
开发者ID:kiegroup,项目名称:optashift-employee-rostering,代码行数:20,代码来源:Instant.java


注:本文中的java.time.jdk8.Jdk7Methods.Long_compare方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。