Search in sources :

Example 1 with Element

use of com.dat3m.dartagnan.solver.caat.predicates.sets.Element in project Dat3M by hernanponcedeleon.

the class CartesianGraph method get.

@Override
public Edge get(Edge edge) {
    Element a = first.getById(edge.getFirst());
    Element b = second.getById(edge.getSecond());
    return (a != null && b != null) ? derive(a, b) : null;
}
Also used : Element(com.dat3m.dartagnan.solver.caat.predicates.sets.Element)

Example 2 with Element

use of com.dat3m.dartagnan.solver.caat.predicates.sets.Element in project Dat3M by hernanponcedeleon.

the class CartesianGraph method forwardPropagate.

@Override
@SuppressWarnings("unchecked")
public Collection<Edge> forwardPropagate(CAATPredicate changedSource, Collection<? extends Derivable> added) {
    List<Edge> addedEdges = new ArrayList<>();
    Collection<Element> addedElems = (Collection<Element>) added;
    if (changedSource == first) {
        for (Element a : addedElems) {
            for (Element b : second.elements()) {
                addedEdges.add(derive(a, b));
            }
        }
    } else if (changedSource == second) {
        for (Element b : addedElems) {
            for (Element a : first.elements()) {
                addedEdges.add(derive(a, b));
            }
        }
    }
    return addedEdges;
}
Also used : Element(com.dat3m.dartagnan.solver.caat.predicates.sets.Element) ArrayList(java.util.ArrayList) Collection(java.util.Collection) Edge(com.dat3m.dartagnan.solver.caat.predicates.relationGraphs.Edge)

Example 3 with Element

use of com.dat3m.dartagnan.solver.caat.predicates.sets.Element in project Dat3M by hernanponcedeleon.

the class IntersectionSet method forwardPropagate.

@Override
@SuppressWarnings("unchecked")
public Collection<Element> forwardPropagate(CAATPredicate changedSource, Collection<? extends Derivable> added) {
    if (changedSource == first || changedSource == second) {
        SetPredicate other = (changedSource == first) ? second : first;
        Collection<Element> addedElems = (Collection<Element>) added;
        List<Element> newlyAdded = new ArrayList<>();
        for (Element e1 : addedElems) {
            Element e2 = other.get(e1);
            if (e2 != null) {
                Element e = derive(e1, e2);
                simpleSet.add(e);
                newlyAdded.add(e);
            }
        }
        return newlyAdded;
    } else {
        return Collections.emptyList();
    }
}
Also used : SetPredicate(com.dat3m.dartagnan.solver.caat.predicates.sets.SetPredicate) Element(com.dat3m.dartagnan.solver.caat.predicates.sets.Element)

Example 4 with Element

use of com.dat3m.dartagnan.solver.caat.predicates.sets.Element in project Dat3M by hernanponcedeleon.

the class UnionSet method forwardPropagate.

@Override
@SuppressWarnings("unchecked")
public Collection<Element> forwardPropagate(CAATPredicate changedSource, Collection<? extends Derivable> added) {
    if (changedSource == first || changedSource == second) {
        ArrayList<Element> newlyAdded = new ArrayList<>();
        Collection<Element> addedElems = (Collection<Element>) added;
        for (Element e : addedElems) {
            Element elem = derive(e);
            if (simpleSet.add(elem)) {
                newlyAdded.add(elem);
            }
        }
        return newlyAdded;
    } else {
        return Collections.emptyList();
    }
}
Also used : Element(com.dat3m.dartagnan.solver.caat.predicates.sets.Element)

Aggregations

Element (com.dat3m.dartagnan.solver.caat.predicates.sets.Element)4 Edge (com.dat3m.dartagnan.solver.caat.predicates.relationGraphs.Edge)1 SetPredicate (com.dat3m.dartagnan.solver.caat.predicates.sets.SetPredicate)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1