Example usage for org.apache.commons.lang3.mutable Mutable toString

List of usage examples for org.apache.commons.lang3.mutable Mutable toString

Introduction

In this page you can find the example usage for org.apache.commons.lang3.mutable Mutable toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:edu.uci.ics.hyracks.algebricks.core.algebra.prettyprint.PlanPlotter.java

public static void printVisualizationGraph(AbstractLogicalOperator op, int indent, StringBuilder out,
        String current_supernode_name, int randomInt) {
    if (!op.getInputs().isEmpty()) {
        //String stringToVisualize = op.toStringForVisualizationGraph();
        String stringToVisualize = op.getOperatorTag().name();
        int firstOccurenceOf_ = stringToVisualize.indexOf("_");
        String supernode_current = stringToVisualize.substring(firstOccurenceOf_ + 1,
                stringToVisualize.length());
        if (current_supernode_name.isEmpty()) {
            current_supernode_name = supernode_current;
            appendln(out, new String("subgraph cluster_" + supernode_current + " {"));
            pad(out, indent);//from  w  w w.  java 2s  .  c  o m
            appendln(out, new String("node [style=filled, color = lightgray];"));
            pad(out, indent);
            appendln(out, new String("color=blue;"));
            pad(out, indent);
            String op_id = op.toString().substring(op.toString().indexOf("@") + 1, op.toString().length());
            appendln(out, new String("label = \"" + supernode_current + "ID" + op_id + "\";"));
            pad(out, indent);
        }

        for (Mutable<ILogicalOperator> i : op.getInputs()) {
            String op_id = i.toString().substring(i.toString().indexOf("@") + 1, i.toString().length());
            String logOpStr = ((AbstractLogicalOperator) i.getValue()).getOperatorTag().name() + "ID" + op_id;
            firstOccurenceOf_ = logOpStr.indexOf("_");
            String supernode_child = logOpStr.substring(firstOccurenceOf_ + 1, logOpStr.length());
            if (!supernode_current.equals(supernode_child)) {
                appendln(out, new String("node [style=filled, color = lightgray];"));
                pad(out, indent);
                appendln(out, new String("color=blue"));
                pad(out, indent);
                appendln(out, new String("label = \"" + supernode_child + "\";"));
                pad(out, indent);
            }

            op_id = op.toString().substring(op.toString().indexOf("@") + 1, op.toString().length());
            appendln(out, stringToVisualize + "ID" + op_id + "[style = filled]");
            AbstractLogicalOperator child = (AbstractLogicalOperator) i.getValue();

            pad(out, indent);
            String op_id1 = op.toString().substring(op.toString().indexOf("@") + 1, op.toString().length());
            append(out, op.getOperatorTag().name() + "ID" + op_id1 + " -> ");
            String opc_id = child.toString().substring(child.toString().indexOf("@") + 1,
                    child.toString().length());
            appendln(out, child.getOperatorTag().name() + "ID" + opc_id);

            printVisualizationGraph(child, indent, out, supernode_current,
                    (randomGenerator.nextInt(100) + 10000));

        }
    }

}