public void toGraph(Object context, Graph g) { if (context instanceof AADD) { // Node level cache g.addNodeLabel("#" + _nLocalID, "x" + _nGlobalID /* + " : #" + _nLocalID*/); if (DD.USE_COLOR) { if (DD.USE_FESTIVE) g.addNodeColor("#" + _nLocalID, "green"); // green, lightblue else g.addNodeColor("#" + _nLocalID, "lightblue"); // green, lightblue } g.addNodeShape("#" + _nLocalID, "ellipse"); g.addNodeStyle("#" + _nLocalID, "filled"); ADDNode n1 = ((AADD) context).getNode(_nHigh); if (n1 != null) { g.addUniLink( "#" + _nLocalID, "#" + _nHigh, "black", "solid", "<" + _df.format(_dHighOffset) + " + " + _df.format(_dHighMult) + " * >"); n1.toGraph(((AADD) context), g); g.addUniLink( "#" + _nLocalID, "#" + _nLow, "black", "dashed", "<" + _df.format(_dLowOffset) + " + " + _df.format(_dLowMult) + " * >"); if (_nHigh != _nLow) { ADDNode n2 = ((AADD) context).getNode(_nLow); if (n2 != null) n2.toGraph(((AADD) context), g); } } } else { System.out.println("[ ERROR GENERATING GRAPH: " + context.getClass() + " ] "); } }
public String toString(Object context, int depth) { StringBuffer sb = new StringBuffer(); sb.append("[ #" + _nLocalID + " v" + _nGlobalID + " "); // Internal bounds // sb.append("<" + ADD._df.format(_dMinLower) + "..." + // ADD._df.format(_dMaxLower) + " ; " + // ADD._df.format(_dMinUpper) + "..." + // ADD._df.format(_dMaxUpper) + "> "); if (context instanceof AADD) { // Node level cache ADDNode n1 = ((AADD) context).getNode(_nHigh); if (n1 != null) { sb.append( "\n" + indent(depth) + "<" + AADD._df.format(_dHighOffset) + "," + AADD._df.format(_dHighMult) + ">"); if (_nHigh == _nLow) { sb.append( "\n" + indent(depth) + "<" + AADD._df.format(_dLowOffset) + "," + AADD._df.format(_dLowMult) + "> LIN:"); sb.append(" [ " + n1.toString(((AADD) context), depth + 1) + "] "); } else { sb.append(" h:[ " + n1.toString(((AADD) context), depth + 1) + "] "); } } else { sb.append("h:[null] "); } if (_nHigh != _nLow) { ADDNode n2 = ((AADD) context).getNode(_nLow); if (n2 != null) { sb.append( "\n" + indent(depth) + "<" + AADD._df.format(_dLowOffset) + "," + AADD._df.format(_dLowMult) + ">" + " l:[ " + n2.toString(((AADD) context), depth + 1) + "] "); } else { sb.append("l:[null] "); } sb.append("] "); } } return sb.toString(); }