// 
// Decompiled by Procyon v0.6.0
// 

package com.google.gson;

import java.util.Objects;

public class FormattingStyle
{
    private final String newline;
    private final String indent;
    private final boolean spaceAfterSeparators;
    public static final FormattingStyle COMPACT;
    public static final FormattingStyle PRETTY;
    
    private FormattingStyle(final String newline, final String indent, final boolean spaceAfterSeparators) {
        Objects.requireNonNull(newline, "newline == null");
        Objects.requireNonNull(indent, "indent == null");
        if (!newline.matches("[\r\n]*")) {
            throw new IllegalArgumentException("Only combinations of \\n and \\r are allowed in newline.");
        }
        if (!indent.matches("[ \t]*")) {
            throw new IllegalArgumentException("Only combinations of spaces and tabs are allowed in indent.");
        }
        this.newline = newline;
        this.indent = indent;
        this.spaceAfterSeparators = spaceAfterSeparators;
    }
    
    public FormattingStyle withNewline(final String newline) {
        return new FormattingStyle(newline, this.indent, this.spaceAfterSeparators);
    }
    
    public FormattingStyle withIndent(final String indent) {
        return new FormattingStyle(this.newline, indent, this.spaceAfterSeparators);
    }
    
    public FormattingStyle withSpaceAfterSeparators(final boolean spaceAfterSeparators) {
        return new FormattingStyle(this.newline, this.indent, spaceAfterSeparators);
    }
    
    public String getNewline() {
        return this.newline;
    }
    
    public String getIndent() {
        return this.indent;
    }
    
    public boolean usesSpaceAfterSeparators() {
        return this.spaceAfterSeparators;
    }
    
    static {
        COMPACT = new FormattingStyle("", "", false);
        PRETTY = new FormattingStyle("\n", "  ", true);
    }
}
