org.geotools.util.Version.getComponent()方法的使用及代码示例

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

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

Version.getComponent介绍

[英]Returns the specified components of this version string. For a version of the major.minor.revision form, index 0 stands for the major version number, 1 stands for the minor version number and 2 stands for the revision number.

The return value is an Integer if the component is parsable as an integer, or a String otherwise. If there is no component at the specified index, then this method returns null.
[中]返回此版本字符串的指定组件。一个版本的少校。少数的修订表,索引0代表主要版本号,1代表次要版本号,2代表修订号。
如果组件可以作为整数或字符串进行分析,则返回值为整数。如果指定的索引中没有组件,则此方法返回null。

代码示例

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

/**
 * Returns the major version number. This method returns an {@link Integer} if possible, or a
 * {@link String} otherwise.
 *
 * @return The major version number.
 */
public Comparable<?> getMajor() {
  return getComponent(0);
}

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

/**
 * Returns the revision number. This method returns an {@link Integer} if possible, or a {@link
 * String} otherwise. If there is no revision number, then this method returns {@code null}.
 *
 * @return The revision number, or {@code null} if none.
 */
public Comparable<?> getRevision() {
  return getComponent(2);
}

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

/**
 * Returns the minor version number. This method returns an {@link Integer} if possible, or a
 * {@link String} otherwise. If there is no minor version number, then this method returns
 * {@code null}.
 *
 * @return The minor version number, or {@code null} if none.
 */
public Comparable<?> getMinor() {
  return getComponent(1);
}

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

/** Returns a hash code value for this version. */
  @Override
  public int hashCode() {
    if (hashCode == 0) {
      int code = (int) serialVersionUID;
      int index = 0;
      Comparable<?> component;
      while ((component = getComponent(index)) != null) {
        code = code * 37 + component.hashCode();
        index++;
      }
      hashCode = code;
    }
    return hashCode;
  }
}

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

final Comparable<?> v1 = this.getComponent(i);
final Comparable<?> v2 = other.getComponent(i);
if (v1 == null) {
  return (v2 == null) ? 0 : -1;

代码示例来源:origin: org.geotools/gt-metadata

/**
 * Returns the minor version number. This method returns an {@link Integer} if possible,
 * or a {@link String} otherwise. If there is no minor version number, then this method
 * returns {@code null}.
 *
 * @return The minor version number, or {@code null} if none.
 */
public Comparable<?> getMinor() {
  return getComponent(1);
}

代码示例来源:origin: org.geotools/gt2-metadata

/**
 * Returns the minor version number. This method returns an {@link Integer} if possible,
 * or a {@link String} otherwise. If there is no minor version number, then this method
 * returns {@code null}.
 */
public Comparable getMinor() {
  return getComponent(1);
}

代码示例来源:origin: org.geotools/gt-metadata

/**
 * Returns the major version number. This method returns an {@link Integer} if possible,
 * or a {@link String} otherwise.
 *
 * @return The major version number.
 */
public Comparable<?> getMajor() {
  return getComponent(0);
}

代码示例来源:origin: org.geotools/gt2-metadata

/**
 * Returns the major version number. This method returns an {@link Integer} if possible,
 * or a {@link String} otherwise.
 */
public Comparable getMajor() {
  return getComponent(0);
}

代码示例来源:origin: org.geotools/gt-metadata

/**
 * Returns the revision number. This method returns an {@link Integer} if possible,
 * or a {@link String} otherwise. If there is no revision number, then this method
 * returns {@code null}.
 *
 * @return The revision number, or {@code null} if none.
 */
public Comparable<?> getRevision() {
  return getComponent(2);
}

代码示例来源:origin: org.geotools/gt2-metadata

/**
 * Returns the revision number. This method returns an {@link Integer} if possible,
 * or a {@link String} otherwise. If there is no revision number, then this method
 * returns {@code null}.
 */
public Comparable getRevision() {
  return getComponent(2);
}

代码示例来源:origin: org.geotools/gt2-metadata

/**
   * Returns a hash code value for this version.
   */
  public int hashCode() {
    if (hashCode == 0) {
      int code = (int)serialVersionUID;
      int index = 0;
      Comparable component;
      while ((component = getComponent(index)) != null) {
        code = code * 37 + component.hashCode();
        index++;
      }
      hashCode = code;
    }
    return hashCode;
  }
}

代码示例来源:origin: org.geotools/gt-metadata

/**
   * Returns a hash code value for this version.
   */
  @Override
  public int hashCode() {
    if (hashCode == 0) {
      int code = (int) serialVersionUID;
      int index = 0;
      Comparable<?> component;
      while ((component = getComponent(index)) != null) {
        code = code * 37 + component.hashCode();
        index++;
      }
      hashCode = code;
    }
    return hashCode;
  }
}

代码示例来源:origin: org.geotools/gt2-metadata

final Comparable v1 =  this.getComponent(i);
final Comparable v2 = other.getComponent(i);
if (v1 == null) {
  return (v2 == null) ? 0 : -1;

代码示例来源:origin: org.geotools/gt-metadata

final Comparable<?> v1 =  this.getComponent(i);
final Comparable<?> v2 = other.getComponent(i);
if (v1 == null) {
  return (v2 == null) ? 0 : -1;

相关文章