class DefaultPrettyPrinter implements Printer {

    private PrinterConfiguration configuration;

    // visitor factory
    Function<PrinterConfiguration, VoidVisitor<Void>> visitorFactory;

    // static methods
    private static Function<PrinterConfiguration, VoidVisitor<Void>> createDefaultVisitor() {
        return (config) -> new DefaultPrettyPrinterVisitor(config, new SourcePrinter(config));
    }

    private static PrinterConfiguration createDefaultConfiguration() {
        return new DefaultPrinterConfiguration();
    }

    // Constructors
    /**
     * Build a new DefaultPrettyPrinter with a default configuration and a default factory
     */
    public DefaultPrettyPrinter() {
        this(createDefaultConfiguration());
    }

    /**
     * Build a new DefaultPrettyPrinter with a configuration and a default factory
     * @param configuration
     */
    public DefaultPrettyPrinter(PrinterConfiguration configuration) {
        this(createDefaultVisitor(), configuration);
    }

    /**
     * Build a new DefaultPrettyPrinter with a configuration and a factory to create a visitor to browse the nodes of the AST
     * @param visitorFactory
     * @param configuration Configuration to apply
     */
    public DefaultPrettyPrinter(Function<PrinterConfiguration, VoidVisitor<Void>> visitorFactory, PrinterConfiguration configuration) {
        this.configuration = configuration;
        this.visitorFactory = visitorFactory;
    }

    // Methods
    /*
     * Returns the Printer configuration
     */
    public PrinterConfiguration getConfiguration() {
        return configuration;
    }

    /*
     * set or update the PrettyPrinter configuration
     */
    public Printer setConfiguration(PrinterConfiguration configuration) {
        this.configuration = configuration;
        return this;
    }

    @Override
    public String print(Node node) {<FILL_FUNCTION_BODY>}
}

        // lazy initialization of visitor which can have a state (like a buffer)
        VoidVisitor<Void> visitor = visitorFactory.apply(configuration);
        node.accept(visitor, null);
        return visitor.toString();
    
<no_super_class>