Loading EDG/src/main/java/edg/slicing/ConstrainedSubsumedTabularAlgorithm.java +24 −1 Original line number Diff line number Diff line /* * EDG, a library to generate and slice Expression Dependence Graphs. * Copyright (c) 2021-2023. David Insa, Carlos Galindo, Sergio Pérez, Josep Silva, Salvador Tamarit. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ package edg.slicing; import edg.graph.EDG; Loading @@ -19,7 +37,7 @@ public class ConstrainedSubsumedTabularAlgorithm extends ConstrainedTabularAlgor protected final Map<Work, Set<Work>> subLookupMap = new HashMap<>(); public ConstrainedSubsumedTabularAlgorithm(EDG edg) { super(edg); super(edg, new PriorityQueue<>()); } @Override Loading Loading @@ -56,4 +74,9 @@ public class ConstrainedSubsumedTabularAlgorithm extends ConstrainedTabularAlgor protected Work cloneNclearCurrentStack(Work work) { return new Work(work.context(), new State(work.current().node(), null), work.lastEdgeType()); } @Override protected Work popWorkList() { return ((PriorityQueue<Work>) workList).remove(); } } EDG/src/main/java/edg/slicing/ConstrainedTabularAlgorithm.java +14 −3 Original line number Diff line number Diff line Loading @@ -52,14 +52,19 @@ public class ConstrainedTabularAlgorithm implements SlicingAlgorithm { protected final EDG edg; /** Works that haven't been processed yet, always a subset of {@link #pathEdge}. */ protected final PriorityQueue<Work> workList = new PriorityQueue<>(); protected final Collection<Work> workList; /** Works that have been reached throughout the traversal. */ protected final Set<Work> pathEdge = new HashSet<>(); protected final Map<State, Set<Work>> current2worksMap = new HashMap<>(); public ConstrainedTabularAlgorithm(EDG edg) { protected ConstrainedTabularAlgorithm(EDG edg, Collection<Work> workList) { assert !Config.summaries : "ConstrainedTabularAlgorithm requires no generation of summaries in the graph, apart from external ones."; this.edg = edg; this.workList = workList; } public ConstrainedTabularAlgorithm(EDG edg) { this(edg, new HashSet<>()); } @Override Loading @@ -83,9 +88,15 @@ public class ConstrainedTabularAlgorithm implements SlicingAlgorithm { } } protected Work popWorkList() { Work w = workList.iterator().next(); workList.remove(w); return w; } protected void workTheList() { while (!workList.isEmpty()) { Work w = workList.remove(); Work w = popWorkList(); if (isEnter(w.current.node)) { if (w.context == null) { traverseEdges(w, e -> true); Loading Loading
EDG/src/main/java/edg/slicing/ConstrainedSubsumedTabularAlgorithm.java +24 −1 Original line number Diff line number Diff line /* * EDG, a library to generate and slice Expression Dependence Graphs. * Copyright (c) 2021-2023. David Insa, Carlos Galindo, Sergio Pérez, Josep Silva, Salvador Tamarit. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ package edg.slicing; import edg.graph.EDG; Loading @@ -19,7 +37,7 @@ public class ConstrainedSubsumedTabularAlgorithm extends ConstrainedTabularAlgor protected final Map<Work, Set<Work>> subLookupMap = new HashMap<>(); public ConstrainedSubsumedTabularAlgorithm(EDG edg) { super(edg); super(edg, new PriorityQueue<>()); } @Override Loading Loading @@ -56,4 +74,9 @@ public class ConstrainedSubsumedTabularAlgorithm extends ConstrainedTabularAlgor protected Work cloneNclearCurrentStack(Work work) { return new Work(work.context(), new State(work.current().node(), null), work.lastEdgeType()); } @Override protected Work popWorkList() { return ((PriorityQueue<Work>) workList).remove(); } }
EDG/src/main/java/edg/slicing/ConstrainedTabularAlgorithm.java +14 −3 Original line number Diff line number Diff line Loading @@ -52,14 +52,19 @@ public class ConstrainedTabularAlgorithm implements SlicingAlgorithm { protected final EDG edg; /** Works that haven't been processed yet, always a subset of {@link #pathEdge}. */ protected final PriorityQueue<Work> workList = new PriorityQueue<>(); protected final Collection<Work> workList; /** Works that have been reached throughout the traversal. */ protected final Set<Work> pathEdge = new HashSet<>(); protected final Map<State, Set<Work>> current2worksMap = new HashMap<>(); public ConstrainedTabularAlgorithm(EDG edg) { protected ConstrainedTabularAlgorithm(EDG edg, Collection<Work> workList) { assert !Config.summaries : "ConstrainedTabularAlgorithm requires no generation of summaries in the graph, apart from external ones."; this.edg = edg; this.workList = workList; } public ConstrainedTabularAlgorithm(EDG edg) { this(edg, new HashSet<>()); } @Override Loading @@ -83,9 +88,15 @@ public class ConstrainedTabularAlgorithm implements SlicingAlgorithm { } } protected Work popWorkList() { Work w = workList.iterator().next(); workList.remove(w); return w; } protected void workTheList() { while (!workList.isEmpty()) { Work w = workList.remove(); Work w = popWorkList(); if (isEnter(w.current.node)) { if (w.context == null) { traverseEdges(w, e -> true); Loading