/** * Appends this instance's {@link ExecutionTask}s and {@link Channel}s to the given {@link StringBuilder}. * * @param sb to which the representation should be appended * @param indent will be used to indent every line of the textual representation */ public void getPlanAsString(StringBuilder sb, String indent) { Set<ExecutionTask> seenTasks = new HashSet<>(); for (ExecutionTask startTask : this.startTasks) { for (Channel inputChannel : startTask.getInputChannels()) { sb.append(indent) .append("In ") .append(this.prettyPrint(inputChannel)) .append(" => ") .append(this.prettyPrint(startTask)).append('\n'); } this.toExtensiveStringAux(startTask, seenTasks, sb, indent); } }
private void toExtensiveStringAux(ExecutionTask task, Set<ExecutionTask> seenTasks, StringBuilder sb, String indent) { if (!seenTasks.add(task)) { return; } for (Channel channel : task.getOutputChannels()) { for (ExecutionTask consumer : channel.getConsumers()) { if (consumer.getStage() == this) { sb.append(indent) .append(" ") .append(this.prettyPrint(task)) .append(" => ") .append(this.prettyPrint(channel)) .append(" => ") .append(this.prettyPrint(consumer)).append('\n'); this.toExtensiveStringAux(consumer, seenTasks, sb, indent); } else { sb.append(indent) .append("Out ") .append(this.prettyPrint(task)) .append(" => ") .append(this.prettyPrint(channel)).append('\n'); } } } }
jsonThatOp.put(consumer.getOperator().getName(), (consumer.getInputSlotFor(channel)==null) ? 0 : consumer.getInputSlotFor(channel).getIndex()); jsonThatOp.put("via", prettyPrint(channel)); perOutputThatList.add(jsonThatOp); if (consumer.getStage() == this)