<commit_before>/*     ____ ____  ____ ____  ______                                     *\
**    / __// __ \/ __// __ \/ ____/    SOcos COmpiles Scala             **
**  __\_ \/ /_/ / /__/ /_/ /\_ \       (c) 2002, LAMP/EPFL              **
** /_____/\____/\___/\____/____/                                        **
\*                                                                      */

// $Id$

package ch.epfl.lamp.util;

import java.io.Writer;
import java.io.StringWriter;
import java.io.IOException;

/**
 * This class provides methods for printing code. It has support for
 * indentation and spacing.
 */
public class CodePrinter {

    //########################################################################
    // Public Constants

    /** The default indentation string */
    public static final String STEP = "    ";

    /** The line separator */
    public static final String LINE = System.getProperty("line.separator");

    //########################################################################
    // Private Fields

    /** The underlying writer */
    private final Writer writer;

    /** The indentation string */
    private String step;

    /** The indentation level */
    private int level;

    /** Do we need to align? */
    private boolean align;

    /** Do we need to print a white space? */
    private boolean space;

    /** Is there already a empty line? */
    private boolean line;

    //########################################################################
    // Public Constructors

    /** Creates a new instance. */
    public CodePrinter() {
        this(new StringWriter());
    }

    /** Creates a new instance. */
    public CodePrinter(String step) {
        this(new StringWriter(), step);
    }

    /** Creates a new instance. */
    public CodePrinter(Writer writer) {
        this(writer, STEP);
    }

    /** Creates a new instance. */
    public CodePrinter(Writer writer, String step) {
        this.writer = writer;
        this.step = step;
        this.level = 0;
        this.align = false;
        this.space = false;
        this.line = false;
    }

    //########################################################################
    // Public Methods - Getting & Setting

    /** Returns the underlying writer. */<commit_msg>- Fixed initiali value of align<commit_after>/*     ____ ____  ____ ____  ______                                     *\
**    / __// __ \/ __// __ \/ ____/    SOcos COmpiles Scala             **
**  __\_ \/ /_/ / /__/ /_/ /\_ \       (c) 2002, LAMP/EPFL              **
** /_____/\____/\___/\____/____/                                        **
\*                                                                      */

// $Id$

package ch.epfl.lamp.util;

import java.io.Writer;
import java.io.StringWriter;
import java.io.IOException;

/**
 * This class provides methods for printing code. It has support for
 * indentation and spacing.
 */
public class CodePrinter {

    //########################################################################
    // Public Constants

    /** The default indentation string */
    public static final String STEP = "    ";

    /** The line separator */
    public static final String LINE = System.getProperty("line.separator");

    //########################################################################
    // Private Fields

    /** The underlying writer */
    private final Writer writer;

    /** The indentation string */
    private String step;

    /** The indentation level */
    private int level;

    /** Do we need to align? */
    private boolean align;

    /** Do we need to print a white space? */
    private boolean space;

    /** Is there already a empty line? */
    private boolean line;

    //########################################################################
    // Public Constructors

    /** Creates a new instance. */
    public CodePrinter() {
        this(new StringWriter());
    }

    /** Creates a new instance. */
    public CodePrinter(String step) {
        this(new StringWriter(), step);
    }

    /** Creates a new instance. */
    public CodePrinter(Writer writer) {
        this(writer, STEP);
    }

    /** Creates a new instance. */
    public CodePrinter(Writer writer, String step) {
        this.writer = writer;
        this.step = step;
        this.level = 0;
        this.align = true;
        this.space = false;
        this.line = false;
    }

    //########################################################################
    // Public Methods - Getting & Setting

    /** Returns the underlying writer. */
{'fraction_non_alphanumeric': 0.2307027027027027, 'fraction_numerical': 0.002162162162162162, 'mean_word_length': 1.9039548022598871, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5515095', 'n_tokens_mistral': 1178, 'n_tokens_neox': 1093, 'n_words': 325}