本文整理了Java中org.ovirt.engine.core.compat.Version
类的一些代码示例,展示了Version
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version
类的具体详情如下:
包路径:org.ovirt.engine.core.compat.Version
类名称:Version
[英]Version in .Net style: a.b.c.d when a: major version, b: minor version , c: major revision, d: minor revision
[中]版本输入。网络风格:a.b.c.d当a:主要版本,b:次要版本,c:主要版本,d:次要版本
代码示例来源:origin: oVirt/ovirt-engine
public OS(String name, Version version, String fullVersion) {
Objects.requireNonNull(name);
Objects.requireNonNull(version);
this.name = name.trim();
this.version = new Version(version.getMajor(), version.getMinor(), version.getBuild(), version.getRevision());
this.fullVersion = fullVersion;
}
代码示例来源:origin: oVirt/ovirt-engine
private static Object cloneVersion(Version instance) {
return new Version(instance.toString());
}
代码示例来源:origin: oVirt/ovirt-engine
@Override
public Version getCompatibilityVersion() {
return Version.getLast();
}
}
代码示例来源:origin: oVirt/ovirt-engine
public static boolean greaterOrEqual(org.ovirt.engine.core.compat.Version a, org.ovirt.engine.core.compat.Version b) {
return a.getMajor() != b.getMajor() ? a.getMajor() >= b.getMajor() : a.getMinor() >= b.getMinor();
}
代码示例来源:origin: oVirt/ovirt-engine
public OS() {
name = "";
version = new Version();
fullVersion = "";
}
代码示例来源:origin: oVirt/ovirt-engine
public Version getPartialVersion() {
Version initial = getGuestAgentVersion();
return initial == null ? null : new Version(initial.getMajor(), initial.getMinor());
}
代码示例来源:origin: oVirt/ovirt-engine
/**
* a key can have several values per version. a null version represents the default while other are specific one:
* key.value = someval // the default value. the path returned is "value" key.value.3.1 = otherval // the 3.1
* version val. the path returned is "value.3.1"
*
* @return the string representation of the value path. for key.value.3.1 = otherval "value.3.1" should be returned.
*/
private String versionedValuePath(Version version) {
return version == null ? "value" : "value." + version.toString();
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void shouldHandleAlNumFullVersion() {
final OS validOs = OS.fromPackageVersionString("Centos - 7.3.2Server - release");
assertThat(validOs.isValid()).isTrue();
assertThat(validOs.getVersion().getMajor()).isEqualTo(7);
assertThat(validOs.getVersion().getMinor()).isEqualTo(3);
assertThat(validOs.getVersion().getBuild()).isEqualTo(2);
}
代码示例来源:origin: oVirt/ovirt-engine
@Override
public String toString() {
return this.getValue();
}
代码示例来源:origin: oVirt/ovirt-engine
Version vdsVersion = new Version(array[i]);
if (version.equals(vdsVersion) && version.compareTo(maxVersion) > 0) {
maxVersion = version;
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void compare() {
assertTrue(Version.v4_2.compareTo(Version.v4_3) < 0);
assertTrue(Version.v4_3.compareTo(Version.v4_2) > 0);
assertEquals(0, Version.v4_3.compareTo(new Version("4.3")));
}
代码示例来源:origin: oVirt/ovirt-engine
/**
* Return total maximum possible memory size for the given VM, including hotplugged memory.
*
* <p>Note: backend only</p>
*
* @param osId id of operating system
* @param compatibilityVersion version of config value to query
* @return the total possible memory size with hotplug
*/
public static int maxMemorySizeWithHotplugInMb(int osId, Version compatibilityVersion) {
final ConfigValues configValue = getMaxMemConfigValueByOsId(osId);
return Config.<Integer>getValue(
configValue,
compatibilityVersion != null ? compatibilityVersion.getValue() : Version.getLast().getValue()
);
}
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void biggerThanOrEquals() {
assertFalse(Version.v4_2.greaterOrEquals(Version.v4_3));
assertTrue(Version.v4_3.greaterOrEquals(Version.v4_2));
assertTrue(Version.v4_3.greaterOrEquals(new Version("4.3")));
}
@Test
代码示例来源:origin: oVirt/ovirt-engine
@Test
public void shouldHandleAlNumMajorVersion() {
final OS validOs = OS.fromPackageVersionString("Centos - 7Server - release");
assertThat(validOs.isValid()).isTrue();
assertThat(validOs.getVersion().getMajor()).isEqualTo(7);
}
代码示例来源:origin: oVirt/ovirt-engine
/**
* @return true if this instance version is less or equals to candidate
*/
public boolean lessOrEquals(Version candidate) {
return this.compareTo(candidate) <= 0;
}
代码示例来源:origin: oVirt/ovirt-engine
/**
* @param oldVersion old compatibility version
* @param newVersion new compatibility version
* @return whether or not update of random/urandom rng device is required;
* false if some of the arguments is null
*/
public static boolean urandomRandomUpdateRequired(Version oldVersion, Version newVersion) {
if (Objects.equals(oldVersion, newVersion)) {
return false;
}
if (oldVersion == null || newVersion == null) {
return false;
}
return (newVersion.greaterOrEquals(VmRngDevice.Source.FIRST_URANDOM_VERSION)
&& oldVersion.less(VmRngDevice.Source.FIRST_URANDOM_VERSION))
|| (oldVersion.greaterOrEquals(VmRngDevice.Source.FIRST_URANDOM_VERSION)
&& newVersion.less(VmRngDevice.Source.FIRST_URANDOM_VERSION));
}
}
代码示例来源:origin: oVirt/ovirt-engine
private boolean isRestoreMemoryVolumeSupported() {
Version oldVmEffectiveVersion = getVm().getCompatibilityVersion(); // before edit
Version newVmCustomCompatibilityVersion = getModel().getCustomCompatibilityVersion() == null ?
null : getModel().getCustomCompatibilityVersion().getSelectedItem();
Version newClusterVersion = getModel().getSelectedCluster() == null ?
null : getModel().getSelectedCluster().getCompatibilityVersion();
Version newVmEffectiveVersion = CompatibilityVersionUtils.getEffective(newVmCustomCompatibilityVersion,
newClusterVersion, Version.getLast());
return oldVmEffectiveVersion.equals(newVmEffectiveVersion);
}
代码示例来源:origin: oVirt/ovirt-engine
public boolean isOlderThan(final OS os) {
return getVersion().less(os.getVersion());
}
代码示例来源:origin: oVirt/ovirt-engine
private Version calculateNewVersionWhichShouldBeSelected(List<Version> versions) {
ListModel<Version> version = getVersion();
Version selectedVersion = version.getSelectedItem();
if (!getIsEdit() && (selectedVersion == null || !versions.contains(selectedVersion) ||
selectedVersion.compareTo(selectedDataCenter.getCompatibilityVersion()) > 0)) {
if (ApplicationModeHelper.getUiMode().equals(ApplicationMode.GlusterOnly)) {
return versions.stream().max(Comparator.naturalOrder()).orElse(null);
} else {
return selectedDataCenter.getCompatibilityVersion();
}
} else if (getIsEdit()) {
return Linq.firstOrNull(versions, x -> x.equals(getEntity().getCompatibilityVersion()));
} else {
return selectedVersion;
}
}
}), ApplicationModeHelper.getUiMode().equals(ApplicationMode.GlusterOnly) ? null : selectedDataCenter.getId());
代码示例来源:origin: oVirt/ovirt-engine
public List<String> getSupportedClusterLevels() {
Set<Version> versions = getConfigurationValueDefault(ConfigValues.SupportedClusterLevels);
if (versions == null) {
return Collections.emptyList();
}
return versions.stream()
.map(version -> String.format("%s.%s", version.getMajor(), version.getMinor()))
.collect(toList());
}
内容来源于网络,如有侵权,请联系作者删除!