
com.github.dakusui.floorplan.Connector Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of floorplan Show documentation
Show all versions of floorplan Show documentation
A library to model a heterogeneous and distributed software
system for testing
package com.github.dakusui.floorplan;
import com.github.dakusui.floorplan.component.Attribute;
import com.github.dakusui.floorplan.component.Ref;
import static com.github.dakusui.floorplan.utils.Checks.requireArgument;
import static java.util.Objects.requireNonNull;
public class Connector {
private Attribute fromAttr;
private Ref from;
private Connector(Ref from, Attribute fromAttr) {
requireArgument(fromAttr, attr -> from.spec() == attr.spec());
this.fromAttr = requireNonNull(fromAttr);
this.from = requireNonNull(from);
}
@Override
public int hashCode() {
return this.from.hashCode();
}
@Override
public boolean equals(Object anotherObject) {
if (anotherObject instanceof Connector) {
Connector another = Connector.class.cast(anotherObject);
return another.from.equals(this.from) && another.fromAttr.equals(this.fromAttr);
}
return false;
}
public static Connector connector(Ref from, Attribute fromAttr) {
return new Connector(from, fromAttr);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy