cdc.applic.factorization.events.ReduceEvent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cdc-applic-factorization Show documentation
Show all versions of cdc-applic-factorization Show documentation
Applicabilities Factorization.
package cdc.applic.factorization.events;
import java.util.Objects;
import cdc.applic.expressions.Expression;
public final class ReduceEvent {
private final Type type;
private final T object;
private final Expression applicability;
public enum Type {
CHANGE_OBJECT_APPLICABILITY,
REMOVE_OBJECT
}
private ReduceEvent(Type type,
T object,
Expression expression) {
this.type = type;
this.object = object;
this.applicability = expression;
}
public static ReduceEvent newChangeObjectApplicability(T object,
Expression applicability) {
return new ReduceEvent<>(Type.CHANGE_OBJECT_APPLICABILITY, object, applicability);
}
public static ReduceEvent newRemoveObject(T object) {
return new ReduceEvent<>(Type.REMOVE_OBJECT, object, null);
}
public Type getType() {
return type;
}
public T getObject() {
return object;
}
public Expression getApplicability() {
return applicability;
}
@Override
public int hashCode() {
return Objects.hash(type,
object,
applicability);
}
@Override
public boolean equals(Object object) {
if (this == object) {
return true;
}
if (!(object instanceof ReduceEvent)) {
return false;
}
final ReduceEvent> other = (ReduceEvent>) object;
return this.type == other.type
&& Objects.equals(this.object, other.object)
&& Objects.equals(this.applicability, other.applicability);
}
@Override
public String toString() {
return getType().name() + " " + object + " " + applicability;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy