use of com.github.javaparser.printer.configuration.DefaultConfigurationOption in project drools by kiegroup.
the class ConstraintPrintVisitor method printArguments.
public void printArguments(final NodeList<Expression> args, final Void arg) {
printer.print("(");
if (!isNullOrEmpty(args)) {
boolean columnAlignParameters = (args.size() > 1) && configuration.get(new DefaultConfigurationOption(DefaultPrinterConfiguration.ConfigOption.COLUMN_ALIGN_PARAMETERS)).map(ConfigurationOption::asBoolean).orElse(false);
if (columnAlignParameters) {
printer.indentWithAlignTo(printer.getCursor().column);
}
for (final Iterator<Expression> i = args.iterator(); i.hasNext(); ) {
final Expression e = i.next();
e.accept(this, arg);
if (i.hasNext()) {
printer.print(",");
if (columnAlignParameters) {
printer.println();
} else {
printer.print(" ");
}
}
}
if (columnAlignParameters) {
printer.unindent();
}
}
printer.print(")");
}
use of com.github.javaparser.printer.configuration.DefaultConfigurationOption in project drools by kiegroup.
the class JavaParserCompiler method createPrettyPrinter.
private static DefaultPrettyPrinter createPrettyPrinter() {
DefaultPrinterConfiguration config = new DefaultPrinterConfiguration();
config.addOption(new DefaultConfigurationOption(DefaultPrinterConfiguration.ConfigOption.COLUMN_ALIGN_PARAMETERS, true));
config.addOption(new DefaultConfigurationOption(DefaultPrinterConfiguration.ConfigOption.COLUMN_ALIGN_FIRST_METHOD_CHAIN, true));
return new DefaultPrettyPrinter(config);
}
use of com.github.javaparser.printer.configuration.DefaultConfigurationOption in project drools by kiegroup.
the class AbstractDTAnalysisTest method debugAnalysis.
protected static void debugAnalysis(DTAnalysis analysis) {
if (!LOG.isDebugEnabled()) {
return;
}
StringBuilder sbGaps = new StringBuilder("\nGaps:\n");
for (Hyperrectangle gap : analysis.getGaps()) {
sbGaps.append(gap.toString());
sbGaps.append("\n");
}
LOG.debug(sbGaps.toString());
DefaultPrinterConfiguration printConfig = new DefaultPrinterConfiguration();
printConfig.addOption(new DefaultConfigurationOption(DefaultPrinterConfiguration.ConfigOption.COLUMN_ALIGN_PARAMETERS, true));
printConfig.addOption(new DefaultConfigurationOption(DefaultPrinterConfiguration.ConfigOption.COLUMN_ALIGN_FIRST_METHOD_CHAIN, true));
Expression printGaps = DTAnalysisMeta.printGaps(analysis);
LOG.debug("\n" + printGaps.toString(printConfig));
StringBuilder sbOverlaps = new StringBuilder("\nOverlaps:\n");
for (Overlap overlap : analysis.getOverlaps()) {
sbOverlaps.append(overlap.toString());
sbOverlaps.append("\n");
}
LOG.debug(sbOverlaps.toString());
Expression printOverlaps = DTAnalysisMeta.printOverlaps(analysis);
LOG.debug("\n" + printOverlaps.toString(printConfig));
}
Aggregations