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;
}
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;
}
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();
}
}
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();
}
}
Aggregations