/** * Connects the two SparkTrans in the graph. Does not allow multiple connections * between the same pair of SparkTrans. * @param parent * @param child */ public void connect(SparkTran parent, SparkTran child) { if (getChildren(parent).contains(child)) { throw new IllegalStateException("Connection already exists"); } rootTrans.remove(child); leafTrans.remove(parent); if (transGraph.get(parent) == null) { transGraph.put(parent, new LinkedList<SparkTran>()); } if (invertedTransGraph.get(child) == null) { invertedTransGraph.put(child, new LinkedList<SparkTran>()); } transGraph.get(parent).add(child); invertedTransGraph.get(child).add(parent); }