org.apache.sis.util.Version.valueOf()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(109)

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

Version.valueOf介绍

[英]Returns an instance for the given integer values. The components array must contain at least 1 element, where:

  • The first element is the #getMajor() number.
  • The second element (if any) is the #getMinor() number.
  • The third element (if any) is the #getRevision() number.
  • Other elements (if any) will be appended to the #toString().
    [中]返回给定整数值的实例。components数组必须至少包含1个元素,其中:
    *第一个元素是#getMajor()数字。
    *第二个元素(如果有的话)是#getMinor()数字。
    *第三个元素(如果有)是#getRevision()编号。
    *其他元素(如果有)将附加到#toString()中。

代码示例

代码示例来源:origin: apache/sis

/**
   * Returns the value to be returned by {@link StoreProvider#probeContent(StorageConnector)}
   * for the given WKT keyword. This method changes the case to match the one used in the keywords map,
   * then verify if the keyword that we found is one of the known WKT keywords. Keywords with the "CRS"
   * suffix are WKT 2 while keywords with the "CS" suffix are WKT 1.
   */
  @Override
  protected ProbeResult forKeyword(final char[] keyword, final int length) {
    if (length >= MIN_LENGTH) {
      int pos = length;
      int version = 1;
      keyword[    0] &= ~0x20;         // Make upper-case (valid only for characters in the a-z range).
      keyword[--pos] &= ~0x20;
      if ((keyword[--pos] &= ~0x20) == 'R') {
        keyword[--pos] &= ~0x20;     // Make "CRS" suffix in upper case (otherwise, was "CS" suffix)
        version = 2;
      }
      while (--pos != 0) {
        if (keyword[pos] != '_') {
          keyword[pos] |= 0x20;    // Make lower-case.
        }
      }
      if (keywords.contains(String.valueOf(keyword, 0, length))) {
        return new ProbeResult(true, MIME_TYPE, Version.valueOf(version));
      }
    }
    return ProbeResult.UNSUPPORTED_STORAGE;
  }
}

代码示例来源:origin: org.apache.sis.storage/sis-storage

/**
   * Returns the value to be returned by {@link StoreProvider#probeContent(StorageConnector)}
   * for the given WKT keyword. This method changes the case to match the one used in the keywords map,
   * then verify if the keyword that we found is one of the known WKT keywords. Keywords with the "CRS"
   * suffix are WKT 2 while keywords with the "CS" suffix are WKT 1.
   */
  @Override
  protected ProbeResult forKeyword(final char[] keyword, final int length) {
    if (length >= MIN_LENGTH) {
      int pos = length;
      int version = 1;
      keyword[    0] &= ~0x20;         // Make upper-case (valid only for characters in the a-z range).
      keyword[--pos] &= ~0x20;
      if ((keyword[--pos] &= ~0x20) == 'R') {
        keyword[--pos] &= ~0x20;     // Make "CRS" suffix in upper case (otherwise, was "CS" suffix)
        version = 2;
      }
      while (--pos != 0) {
        if (keyword[pos] != '_') {
          keyword[pos] |= 0x20;    // Make lower-case.
        }
      }
      if (keywords.contains(String.valueOf(keyword, 0, length))) {
        return new ProbeResult(true, MIME_TYPE, Version.valueOf(version));
      }
    }
    return ProbeResult.UNSUPPORTED_STORAGE;
  }
}

代码示例来源:origin: apache/sis

/**
 * Tests the cached values of {@link Version#valueOf(int[])}.
 */
@Test
@DependsOnMethod("testValueOf")
public void testCachedValueOf() {
  for (int major=1; major<=2; major++) {
    final Version version = Version.valueOf(major);
    assertSame(version.toString(), version, Version.valueOf(major));
  }
}

代码示例来源:origin: apache/sis

return new ProbeResult(isSupported, MIME_TYPE, Version.valueOf(version));

代码示例来源:origin: org.apache.sis.storage/sis-netcdf

return new ProbeResult(isSupported, MIME_TYPE, Version.valueOf(version));

代码示例来源:origin: apache/sis

case WKT: {
  if (convention == null) {
    if (version == null || version.equals(Version.valueOf(2))) {
      convention = Convention.WKT2;
    } else {
      convention = Convention.WKT1;
      isVersionSupported = version.equals(Version.valueOf(1));

代码示例来源:origin: apache/sis

description = Resources.formatInternational(Resources.Keys.GeodeticDataBase_4,
    Constants.EPSG, version, metadata.getDatabaseProductName(),
    Version.valueOf(metadata.getDatabaseMajorVersion(),
            metadata.getDatabaseMinorVersion()));
break;

代码示例来源:origin: org.apache.sis.core/sis-referencing

description = Resources.formatInternational(Resources.Keys.GeodeticDataBase_4,
    Constants.EPSG, version, metadata.getDatabaseProductName(),
    Version.valueOf(metadata.getDatabaseMajorVersion(),
            metadata.getDatabaseMinorVersion()));
break;

代码示例来源:origin: apache/sis

/**
 * Tests the {@link Version#valueOf(int[])} method.
 */
@Test
public void testValueOf() {
  Version version = Version.valueOf(1);
  assertEquals("1", version.toString());
  assertEquals( 1,  version.getMajor());
  assertNull  (     version.getMinor());
  assertNull  (     version.getRevision());
  version = Version.valueOf(10);
  assertEquals("10", version.toString());
  assertEquals( 10,  version.getMajor());
  assertNull  (      version.getMinor());
  assertNull  (      version.getRevision());
  version = Version.valueOf(0, 4);
  assertEquals("0.4", version.toString());
  assertEquals( 0,    version.getMajor());
  assertEquals(   4,  version.getMinor());
  assertNull  (       version.getRevision());
  version = Version.valueOf(6, 11, 2);
  assertEquals("6.11.2", version.toString());
  assertEquals( 6,       version.getMajor());
  assertEquals(   11,    version.getMinor());
  assertEquals(      2,  version.getRevision());
}

相关文章