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; } public boolean equals(Node other) { return other.sourcePos == this.instruction.sourcePos; } 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; } }