Skip to content
ConstrainedSubsumedTabularAlgorithm.java 819 B
Newer Older
package edg.slicing;

import edg.graph.EDG;

/**
 * Constraind tabular algorithm with subsumption.
 * It uses stack ordering to disallow insertion into pathEdge and workList if a subsuming
 * stack is included in them already.
 */
public class ConstrainedSubsumedTabularAlgorithm extends ConstrainedTabularAlgorithm {
    public ConstrainedSubsumedTabularAlgorithm(EDG edg) {
        super(edg);
    }

    @Override
    protected void propagate(Work work) {
        if (!pathEdge.contains(work)) {
            if (work.current().stack().isEdgeConstraintsEmpty() || pathEdge.stream().noneMatch(work::isSubsumedBy)) {
                workList.removeIf(w -> w.isSubsumedBy(work));