Search in sources :

Example 1 with DefaultPrinterConfiguration

use of com.github.javaparser.printer.configuration.DefaultPrinterConfiguration in project drools by kiegroup.

the class PrintUtil method printNode.

public static String printNode(Node node) {
    PrinterConfiguration prettyPrinterConfiguration = new DefaultPrinterConfiguration();
    ConstraintPrintVisitor constraintPrintVisitor = new ConstraintPrintVisitor(prettyPrinterConfiguration);
    node.accept(constraintPrintVisitor, null);
    return constraintPrintVisitor.toString();
}
Also used : DefaultPrinterConfiguration(com.github.javaparser.printer.configuration.DefaultPrinterConfiguration) PrinterConfiguration(com.github.javaparser.printer.configuration.PrinterConfiguration) DefaultPrinterConfiguration(com.github.javaparser.printer.configuration.DefaultPrinterConfiguration)

Example 2 with DefaultPrinterConfiguration

use of com.github.javaparser.printer.configuration.DefaultPrinterConfiguration 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);
}
Also used : DefaultConfigurationOption(com.github.javaparser.printer.configuration.DefaultConfigurationOption) DefaultPrettyPrinter(com.github.javaparser.printer.DefaultPrettyPrinter) DefaultPrinterConfiguration(com.github.javaparser.printer.configuration.DefaultPrinterConfiguration)

Example 3 with DefaultPrinterConfiguration

use of com.github.javaparser.printer.configuration.DefaultPrinterConfiguration 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));
}
Also used : DefaultConfigurationOption(com.github.javaparser.printer.configuration.DefaultConfigurationOption) Expression(com.github.javaparser.ast.expr.Expression) Hyperrectangle(org.kie.dmn.validation.dtanalysis.model.Hyperrectangle) DefaultPrinterConfiguration(com.github.javaparser.printer.configuration.DefaultPrinterConfiguration) Overlap(org.kie.dmn.validation.dtanalysis.model.Overlap)

Aggregations

DefaultPrinterConfiguration (com.github.javaparser.printer.configuration.DefaultPrinterConfiguration)3 DefaultConfigurationOption (com.github.javaparser.printer.configuration.DefaultConfigurationOption)2 Expression (com.github.javaparser.ast.expr.Expression)1 DefaultPrettyPrinter (com.github.javaparser.printer.DefaultPrettyPrinter)1 PrinterConfiguration (com.github.javaparser.printer.configuration.PrinterConfiguration)1 Hyperrectangle (org.kie.dmn.validation.dtanalysis.model.Hyperrectangle)1 Overlap (org.kie.dmn.validation.dtanalysis.model.Overlap)1