org.eclipse.equinox.p2.metadata.Version.getSegmentCount()方法的使用及代码示例

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

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

Version.getSegmentCount介绍

[英]Returns the number of elements in the raw vector representation of this version.
[中]返回此版本的原始向量表示形式中的元素数。

代码示例

代码示例来源:origin: org.eclipse.equinox.p2/updatesite

private static int getIntSegment(Version v, int segment) {
  int segCount = v.getSegmentCount();
  if (segCount <= segment)
    return 0;
  Object seg = v.getSegment(segment);
  return seg instanceof Integer ? ((Integer) seg).intValue() : 0;
}

代码示例来源:origin: org.eclipse.equinox.p2/updatesite

private static String getQualifier(Version v) {
  int segCount = v.getSegmentCount();
  if (segCount == 0)
    return null;
  Object seg = v.getSegment(segCount - 1);
  return seg instanceof String ? (String) seg : null;
}

代码示例来源:origin: org.eclipse.tycho/org.eclipse.tycho.p2.resolver.impl

private static VersionRange getVersionRangeFromReference(Version version) {
  VersionRange range;
  if (version.getSegmentCount() > 3 && "qualifier".equals(version.getSegment(3))) {
    range = getRangeOfEquivalentVersions(version);
  } else if (Version.emptyVersion.equals(version)) {
    range = VersionRange.emptyRange;
  } else {
    range = getStrictRange(version);
  }
  return range;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.equinox.p2.publisher.eclipse

StringBuffer sv = new StringBuffer(version.getSegmentCount() > 0 ? version.getSegment(0).toString() : "0"); //$NON-NLS-1$
sv.append('.');
sv.append(version.getSegmentCount() > 1 ? version.getSegment(1).toString() : "0"); //$NON-NLS-1$
sv.append('.');
sv.append(version.getSegmentCount() > 2 ? version.getSegment(2).toString() : "0"); //$NON-NLS-1$
infoPListEditor.setKey(InfoPListEditor.BUNDLE_VERSION_KEY, version.toString());
infoPListEditor.setKey(InfoPListEditor.BUNDLE_SHORT_VERSION_KEY, sv.toString());

代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.equinox.p2.publisher.eclipse

StringBuffer sv = new StringBuffer(version.getSegmentCount() > 0 ? version.getSegment(0).toString() : "0"); //$NON-NLS-1$
sv.append('.');
sv.append(version.getSegmentCount() > 1 ? version.getSegment(1).toString() : "0"); //$NON-NLS-1$
sv.append('.');
sv.append(version.getSegmentCount() > 2 ? version.getSegment(2).toString() : "0"); //$NON-NLS-1$
infoPListEditor.setKey(InfoPListEditor.BUNDLE_VERSION_KEY, version.toString());
infoPListEditor.setKey(InfoPListEditor.BUNDLE_SHORT_VERSION_KEY, sv.toString());

代码示例来源:origin: org.eclipse.osgi/org.eclipse.equinox.p2.publisher.eclipse

sv.append(version.getSegmentCount() > 1 ? version.getSegment(1).toString() : "0"); //$NON-NLS-1$
sv.append('.');
sv.append(version.getSegmentCount() > 2 ? version.getSegment(2).toString() : "0"); //$NON-NLS-1$
replacePlistValue(buffer, BUNDLE_VERSION_KEY, version.toString());
replacePlistValue(buffer, BUNDLE_SHORT_VERSION_KEY, sv.toString());

相关文章