All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.rwth.swc.coffee4j.engine.constraint.ConstraintList Maven / Gradle / Ivy

package de.rwth.swc.coffee4j.engine.constraint;

import de.rwth.swc.coffee4j.engine.TupleList;
import de.rwth.swc.coffee4j.engine.util.Preconditions;

import java.util.Collection;
import java.util.List;
import java.util.Objects;

public class ConstraintList {
    private final Collection tupleLists;
    private List constraints;

    public ConstraintList(Collection tupleLists) {
        Preconditions.notNull(tupleLists);

        this.tupleLists = tupleLists;
        this.constraints = null;
    }

    public List getConstraints() {
        if(constraints == null) {
            constraints = new ConstraintConverter().convertAll(tupleLists);
        }

        return constraints;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ConstraintList that = (ConstraintList) o;
        return tupleLists.equals(that.tupleLists) &&
                Objects.equals(constraints, that.constraints);
    }

    @Override
    public int hashCode() {
        return Objects.hash(tupleLists, constraints);
    }

    @Override
    public String toString() {
        return "ConstraintList{" +
                '}';
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy