本文整理了Java中com.yahoo.component.Version.equals()
方法的一些代码示例,展示了Version.equals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version.equals()
方法的具体详情如下:
包路径:com.yahoo.component.Version
类名称:Version
方法名:equals
[英]Compares this Version
to another.
A version is considered to be equal to another version if the major, minor and micro components are equal and the qualifier component is equal (using String.equals
).
[中]将这个Version
与另一个进行比较。
如果主要、次要和微观成分相等,且限定成分相等(使用[$1$]),则一个版本被视为等同于另一个版本。
代码示例来源:origin: com.yahoo.vespa/controller-api
public boolean upgrading() {
return !current.equals(wanted);
}
}
代码示例来源:origin: com.yahoo.vespa/documentapi
@Override
public boolean equals(Object obj) {
if (!(obj instanceof CacheKey)) {
return false;
}
CacheKey rhs = (CacheKey)obj;
if (!version.equals(rhs.version)) {
return false;
}
if (type != rhs.type) {
return false;
}
return true;
}
}
代码示例来源:origin: com.yahoo.vespa/component
/** Returns whether this equals the empty version */
public boolean isEmpty() { return this.equals(emptyVersion); }
代码示例来源:origin: com.yahoo.vespa/config-model
@Override
public boolean equals(Object object) {
if (!(object instanceof ConfigModelId)) return false;
ConfigModelId other = (ConfigModelId)object;
return this.name.equals(other.name) && this.version.equals(other.version);
}
代码示例来源:origin: com.yahoo.vespa/component
/** Returns whether this version number (ignoring qualifier) is strictly higher than the given version */
public boolean isAfter(Version other) {
return ! this.isBefore(other) && ! this.equals(other);
}
代码示例来源:origin: com.yahoo.vespa/config-model
private void checkVersion(Element spec) {
String version = spec.getAttribute("version");
if ( ! Version.fromString(version).equals(new Version(1))) {
throw new RuntimeException("Expected container version to be 1.0, but got " + version);
}
}
代码示例来源:origin: com.yahoo.vespa/config-provisioning
@Override
public boolean equals(Object o) {
if (o == this) return true;
if ( ! (o instanceof ClusterSpec)) return false;
ClusterSpec other = (ClusterSpec)o;
if ( ! other.type.equals(this.type)) return false;
if ( ! other.id.equals(this.id)) return false;
if ( ! other.groupId.equals(this.groupId)) return false;
if ( ! other.vespaVersion.equals(this.vespaVersion)) return false;
return true;
}
代码示例来源:origin: com.yahoo.vespa/controller-api
private ApplicationVersion(Optional<SourceRevision> source, OptionalLong buildNumber, Optional<String> authorEmail,
Optional<Version> compileVersion, Optional<Instant> buildTime) {
Objects.requireNonNull(source, "source cannot be null");
Objects.requireNonNull(buildNumber, "buildNumber cannot be null");
Objects.requireNonNull(authorEmail, "author cannot be null");
if (source.isPresent() != buildNumber.isPresent()) {
throw new IllegalArgumentException("both buildNumber and source must be set together");
}
if (compileVersion.isPresent() != buildTime.isPresent()) {
throw new IllegalArgumentException("both compileVersion and buildTime must be set together");
}
if (buildNumber.isPresent() && buildNumber.getAsLong() <= 0) {
throw new IllegalArgumentException("buildNumber must be > 0");
}
if (authorEmail.isPresent() && ! authorEmail.get().matches("[^@]+@[^@]+")) {
throw new IllegalArgumentException("Invalid author email '" + authorEmail.get() + "'.");
}
if (compileVersion.isPresent() && compileVersion.get().equals(Version.emptyVersion)) {
throw new IllegalArgumentException("The empty version is not a legal compile version.");
}
this.source = source;
this.buildNumber = buildNumber;
this.authorEmail = authorEmail;
this.compileVersion = compileVersion;
this.buildTime = buildTime;
}
代码示例来源:origin: com.yahoo.vespa/node-repository
@Override
public boolean matches(Node node) {
if (!version.isEmpty() && !node.status().osVersion().filter(v -> v.equals(version)).isPresent()) {
return false;
}
return nextMatches(node);
}
代码示例来源:origin: com.yahoo.vespa/node-repository
/** Set the target OS version for nodes of given type */
public void setTarget(NodeType nodeType, Version newTarget, boolean force) {
if (!nodeType.isDockerHost()) {
throw new IllegalArgumentException("Setting target OS version for " + nodeType + " nodes is unsupported");
}
if (newTarget.isEmpty()) {
throw new IllegalArgumentException("Invalid target version: " + newTarget.toFullString());
}
try (Lock lock = db.lockOsVersions()) {
Map<NodeType, Version> osVersions = db.readOsVersions();
Optional<Version> oldTarget = Optional.ofNullable(osVersions.get(nodeType));
if (oldTarget.filter(v -> v.equals(newTarget)).isPresent()) {
return; // Old target matches new target, nothing to do
}
if (!force && oldTarget.filter(v -> v.isAfter(newTarget)).isPresent()) {
throw new IllegalArgumentException("Cannot set target OS version to " + newTarget +
" without setting 'force', as it's lower than the current version: "
+ oldTarget.get());
}
osVersions.put(nodeType, newTarget);
db.writeOsVersions(osVersions);
createCache(); // Throw away current cache
log.info("Set OS target version for " + nodeType + " nodes to " + newTarget.toFullString());
}
}
代码示例来源:origin: com.yahoo.vespa/node-repository
node.state() == Node.State.active &&
node.allocation()
.map(allocation -> allocation.membership().cluster().vespaVersion().equals(targetVersion.get()))
.orElse(false))) {
List<HostSpec> hostSpecs = provisioner.prepare(
代码示例来源:origin: com.yahoo.vespa/node-repository
currentVersion.get().equals(wantedVersion);
metric.set("wantToChangeVespaVersion", converged ? 0 : 1, context);
} else {
内容来源于网络,如有侵权,请联系作者删除!