From 6377548c75f05f0b8599dcfb8d61a56240692334 Mon Sep 17 00:00:00 2001 From: bd-912 Date: Wed, 17 Apr 2024 21:42:42 -0600 Subject: Add all of the tests I forgot to add --- vaporize/library/CFGNode.java | 48 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 vaporize/library/CFGNode.java (limited to 'vaporize/library/CFGNode.java') diff --git a/vaporize/library/CFGNode.java b/vaporize/library/CFGNode.java new file mode 100644 index 0000000..ca60856 --- /dev/null +++ b/vaporize/library/CFGNode.java @@ -0,0 +1,48 @@ +package vaporize.library; + +import cs132.vapor.ast.*; +import java.util.ArrayList; + +class CFGNode { + + private Node instruction; + private ArrayList sources; + private ArrayList dests; + private int line; + + protected CFGNode(Node instruction) { + this.instruction = instruction; + this.sources = new ArrayList<>(); + this.dests = new ArrayList<>(); + this.line = this.instruction.sourcePos.line; + } + + public String toString() { + return this.instruction.toString(); + } + + public int hashCode() { + return this.line; + } + + protected void addSource(CFGNode node) { + this.sources.add(node); + } + + protected void addDest(CFGNode node) { + this.dests.add(node); + } + + protected Node getInstruction() { + return this.instruction; + } + + protected ArrayList getSources() { + return this.sources; + } + + protected ArrayList getDests() { + return this.dests; + } + +} -- cgit v1.2.3