com.github.zafarkhaja.semver.Version.compareTo()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(181)

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

Version.compareTo介绍

[英]Compares this version to the other version. This method does not take into account the versions' build metadata. If you want to compare the versions' build metadata use the Version.compareWithBuildsTo method or the Version.BUILD_AWARE_ORDER comparator.
[中]将此版本与其他版本进行比较。此方法不考虑版本的生成元数据。如果要比较版本的构建元数据,请使用版本。比较BuildTo方法或版本。构建感知顺序比较器。

代码示例

代码示例来源:origin: Graylog2/graylog2-server

/**
   * {@inheritDoc}
   */
  @Override
  public int compareTo(@Nonnull Version that) {
    requireNonNull(that);
    return version.compareTo(that.getVersion());
  }
}

代码示例来源:origin: cSploit/android

/**
 * is version {@code a} newer than {@code b} ?
 */
private boolean isNewerThan(String a, String b) {
 return Version.valueOf(a).compareTo(Version.valueOf(b)) > 0;
}

代码示例来源:origin: pf4j/pf4j

@Override
public int compareVersions(String v1, String v2) {
  return Version.valueOf(v1).compareTo(Version.valueOf(v2));
}

代码示例来源:origin: com.github.zafarkhaja/java-semver

/**
 * Checks if this version is less than or equal to the other version.
 *
 * @param other the other version to compare to
 * @return {@code true} if this version is less than or equal
 *         to the other version or {@code false} otherwise
 * @see #compareTo(Version other)
 */
public boolean lessThanOrEqualTo(Version other) {
  return compareTo(other) <= 0;
}

代码示例来源:origin: org.kurento/kurento-module-creator

/**
 * Checks if this version is greater than or equal to the other version.
 *
 * @param other
 *          the other version to compare to
 * @return {@code true} if this version is greater than or equal to the other version or
 *         {@code false} otherwise
 * @see #compareTo(Version other)
 */
public boolean greaterThanOrEqualTo(Version other) {
 return compareTo(other) >= 0;
}

代码示例来源:origin: org.kurento/kurento-module-creator

/**
 * Checks if this version is greater than the other version.
 *
 * @param other
 *          the other version to compare to
 * @return {@code true} if this version is greater than the other version or {@code false}
 *         otherwise
 * @see #compareTo(Version other)
 */
public boolean greaterThan(Version other) {
 return compareTo(other) > 0;
}

代码示例来源:origin: org.kurento/kurento-module-creator

/**
 * Checks if this version is less than the other version.
 *
 * @param other
 *          the other version to compare to
 * @return {@code true} if this version is less than the other version or {@code false} otherwise
 * @see #compareTo(Version other)
 */
public boolean lessThan(Version other) {
 return compareTo(other) < 0;
}

代码示例来源:origin: zafarkhaja/jsemver

/**
 * Checks if this version is greater than or equal to the other version.
 *
 * @param other the other version to compare to
 * @return {@code true} if this version is greater than or equal
 *         to the other version or {@code false} otherwise
 * @see #compareTo(Version other)
 */
public boolean greaterThanOrEqualTo(Version other) {
  return compareTo(other) >= 0;
}

代码示例来源:origin: zafarkhaja/jsemver

/**
 * Checks if this version is less than or equal to the other version.
 *
 * @param other the other version to compare to
 * @return {@code true} if this version is less than or equal
 *         to the other version or {@code false} otherwise
 * @see #compareTo(Version other)
 */
public boolean lessThanOrEqualTo(Version other) {
  return compareTo(other) <= 0;
}

代码示例来源:origin: com.github.zafarkhaja/java-semver

/**
 * Checks if this version is less than the other version.
 *
 * @param other the other version to compare to
 * @return {@code true} if this version is less than the other version
 *         or {@code false} otherwise
 * @see #compareTo(Version other)
 */
public boolean lessThan(Version other) {
  return compareTo(other) < 0;
}

代码示例来源:origin: zafarkhaja/jsemver

/**
 * Checks if this version is greater than the other version.
 *
 * @param other the other version to compare to
 * @return {@code true} if this version is greater than the other version
 *         or {@code false} otherwise
 * @see #compareTo(Version other)
 */
public boolean greaterThan(Version other) {
  return compareTo(other) > 0;
}

代码示例来源:origin: zafarkhaja/jsemver

/**
 * Checks if this version is less than the other version.
 *
 * @param other the other version to compare to
 * @return {@code true} if this version is less than the other version
 *         or {@code false} otherwise
 * @see #compareTo(Version other)
 */
public boolean lessThan(Version other) {
  return compareTo(other) < 0;
}

代码示例来源:origin: com.github.zafarkhaja/java-semver

/**
 * Checks if this version is greater than the other version.
 *
 * @param other the other version to compare to
 * @return {@code true} if this version is greater than the other version
 *         or {@code false} otherwise
 * @see #compareTo(Version other)
 */
public boolean greaterThan(Version other) {
  return compareTo(other) > 0;
}

代码示例来源:origin: com.github.zafarkhaja/java-semver

/**
 * Checks if this version is greater than or equal to the other version.
 *
 * @param other the other version to compare to
 * @return {@code true} if this version is greater than or equal
 *         to the other version or {@code false} otherwise
 * @see #compareTo(Version other)
 */
public boolean greaterThanOrEqualTo(Version other) {
  return compareTo(other) >= 0;
}

代码示例来源:origin: org.zaproxy/zap

@Override
public int compareTo(Version other) {
  if (other == null) {
    return 1;
  }
  return impl.compareTo(other.impl);
}

代码示例来源:origin: org.kurento/kurento-module-creator

/**
 * Checks if this version is less than or equal to the other version.
 *
 * @param other
 *          the other version to compare to
 * @return {@code true} if this version is less than or equal to the other version or
 *         {@code false} otherwise
 * @see #compareTo(Version other)
 */
public boolean lessThanOrEqualTo(Version other) {
 return compareTo(other) <= 0;
}

代码示例来源:origin: gradle.plugin.com.s390x/gogradle

@Override
public boolean supportTestJsonOutput() {
  return goVersion.compareTo(GO_VERSION_SUPPORTING_JSON) >= 0;
}

代码示例来源:origin: org.graylog2/graylog2-server

/**
   * {@inheritDoc}
   */
  @Override
  public int compareTo(@Nonnull Version that) {
    requireNonNull(that);
    return version.compareTo(that.getVersion());
  }
}

代码示例来源:origin: gradle.plugin.com.s390x/gogradle

private Optional<GitMercurialCommit> findCommitBySemVersion(File repository, String semVersionExpression) {
  List<GitMercurialCommit> tags = getAccessor().getAllTags(repository);
  List<GitMercurialCommit> satisfiedTags = tags.stream()
      .filter(tag -> tag.satisfies(semVersionExpression))
      .collect(Collectors.toList());
  if (satisfiedTags.isEmpty()) {
    return Optional.empty();
  }
  satisfiedTags.sort((tag1, tag2) -> tag2.getSemVersion().compareTo(tag1.getSemVersion()));
  return Optional.of(satisfiedTags.get(0));
}

代码示例来源:origin: com.rexsl/rexsl

@Override
public int compareTo(final ProductVersion ver) {
  return Version.valueOf(this.normalize(this.origin))
    .compareTo(Version.valueOf(this.normalize(ver.origin)));
}

相关文章