Skip to content

Commit

Permalink
Remove self loops
Browse files Browse the repository at this point in the history
  • Loading branch information
hadrienk committed Aug 29, 2024
1 parent 1d96775 commit 34fa7ce
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 158 deletions.
78 changes: 0 additions & 78 deletions vtl-prov/src/main/java/fr/insee/vtl/prov/ProvenanceListener.java

This file was deleted.

32 changes: 2 additions & 30 deletions vtl-prov/src/main/java/fr/insee/vtl/prov/ProvenanceUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,9 @@

public class ProvenanceUtils {

public static ProvenanceListener getProvenance(String script) {
CodePointCharStream stream = CharStreams.fromString(script);
VtlLexer lexer = new VtlLexer(stream);
VtlParser parser = new VtlParser(new CommonTokenStream(lexer));

ProvenanceListener provenanceListener = new ProvenanceListener();
ParseTreeWalker.DEFAULT.walk(provenanceListener, parser.start());

return provenanceListener;
}

public static void printTree(ProvenanceListener.Node node, String prefix, boolean isLast) {
if (node == null) {
return;
}

// Print the current node with appropriate formatting
System.out.println(prefix + (isLast ? "└── " : "├── ") + node.name + "\t[ " + node.expression + " ]");

// Get the list of parent nodes
Collection<ProvenanceListener.Node> parents = node.parents.values();
int count = parents.size();
int index = 0;

// Recursively print each parent node
for (ProvenanceListener.Node parent : parents) {
printTree(parent, prefix + (isLast ? " " : "│ "), ++index == count);
}
}

public static List<Object> toBusinessModel(ProvenanceListener listener) {
// TODO: @nico te graph needs to be refactored. I'll try to fix it before monday.

ArrayList<Object> model = new ArrayList<>();
LinkedHashMap<String, ProvenanceListener.Node> variables = listener.variables;
variables.values().forEach(node -> {
Expand Down

This file was deleted.

0 comments on commit 34fa7ce

Please sign in to comment.