Example usage for java.io PrintStream format

List of usage examples for java.io PrintStream format

Introduction

In this page you can find the example usage for java.io PrintStream format.

Prototype

public PrintStream format(Locale l, String format, Object... args) 

Source Link

Document

Writes a formatted string to this output stream using the specified format string and arguments.

Usage

From source file:sf.net.experimaestro.manager.plans.Operator.java

/**
 * Print a node//from  w w w .ja  v a2  s.  c  o  m
 *
 * @param out       The output stream
 * @param planNodes The values already processed (case of shared ancestors)
 */
public boolean printDOT(PrintStream out, HashSet<Operator> planNodes, Map<Operator, MutableInt> counts) {
    if (planNodes.contains(this))
        return false;
    planNodes.add(this);
    printDOTNode(out, counts);
    int streamIndex = 0;
    for (Operator parent : getParents()) {
        parent.printDOT(out, planNodes, counts);
        ArrayList<Map.Entry<StreamReference, Integer>> list = new ArrayList<>();
        out.format("p%s -> p%s", System.identityHashCode(parent), System.identityHashCode(this));

        // Build the list of context mappings
        for (Map.Entry<StreamReference, Integer> x : contextMappings.entrySet()) {
            if (x.getKey().inputIndex == streamIndex) {
                list.add(x);
            }
        }

        String labelValue = Integer.toString(streamIndex);
        if (!list.isEmpty()) {
            labelValue += ";" + Output.toString(", ", list,
                    x -> String.format("%d/%d", x.getKey().contextIndex, x.getValue()));
        }

        Map<String, String> attributes = new HashMap<>();
        attributes.put("label", labelValue);

        out.print("[");
        Output.print(out, ", ", attributes.entrySet(),
                o -> String.format("%s=\"%s\"", o.getKey(), o.getValue()));
        out.println("];");
        streamIndex++;
    }

    return true;
}

From source file:sf.net.experimaestro.manager.plans.OrderBy.java

@Override
public boolean printDOT(PrintStream out, HashSet<Operator> planNodes, Map<Operator, MutableInt> counts) {
    if (super.printDOT(out, planNodes, counts)) {
        for (Operator operator : order.items())
            out.format("p%s -> p%s [style=\"dashed\", color=\"#ddddff\"];%n", System.identityHashCode(operator),
                    System.identityHashCode(this));
    }// w w  w.  j  a v a 2s.co m
    return false;
}