Reformated A3 for Handin and bug fix

This commit is contained in:
Mann Patel
2025-10-28 22:22:05 -06:00
parent 8639c132a5
commit 0676f50e83
22 changed files with 551 additions and 13 deletions

Binary file not shown.

View File

@@ -0,0 +1,42 @@
package CFGGraph;
import org.jgrapht.graph.DefaultEdge;
public class CFGEdge extends DefaultEdge {
//path defines if its a True or False or Null (when either T or F resulkt on the same node)
private boolean path;
private CFGNode from;
private CFGNode to;
private String label;
public CFGEdge() {
this(null, null);
}
public CFGEdge(CFGNode from, CFGNode to) {
this.from = from;
this.to = to;
this.label = "";
}
public void setLabel(String label) {
this.label = label;
}
public String getLabel() {
return this.label;
}
public CFGNode getFrom() {
return this.from;
}
public CFGNode getTo() {
return this.to;
}
@Override
public String toString() {
return label;
}
public void setPath(boolean path) { this.path = path; }
}

Binary file not shown.

View File

@@ -0,0 +1,41 @@
package CFGGraph;
import java.util.ArrayList;
import japa.parser.ast.stmt.Statement;
public class CFGNode {
static int id_counter = 1;
private final int ID;
private String label;
private ArrayList<Statement> statements;
public CFGNode(String label) {
this.label = label;
this.ID = id_counter++;
this.statements = new ArrayList<>();
}
public int getID() {
return this.ID;
}
public String getLabel() {
return this.label;
}
public ArrayList<Statement> getStatements() {
return this.statements;
}
public void addStatement(Statement s) {
statements.add(s);
}
@Override
public String toString() {
return label;
}
}