package seedu.address.logic.parser;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

import seedu.address.commons.exceptions.IllegalValueException;
import seedu.address.commons.util.SubstringRange;

/**
 * Signals that a string input could not be parsed.
 */
public class ParseException extends IllegalValueException {

    private final List<SubstringRange> ranges = new ArrayList<>();

    /**
     * @param message should contain relevant information on why the input is invalid.
     * @param ranges substring range(s) of the invalid input.
     */
    public ParseException(String message, Collection<SubstringRange> ranges) {
        super(message);
        this.ranges.addAll(ranges);
    }

    public ParseException(String message, SubstringRange... ranges) {
        this(message, Arrays.asList(ranges));
    }

    /**
     * @param message should contain relevant information on why the input is invalid.
     * @param cause the exception which caused this exception to be thrown.
     * @param ranges substring range(s) of the invalid input.
     */
    public ParseException(String message, Throwable cause, Collection<SubstringRange> ranges) {
        super(message, cause);
        this.ranges.addAll(ranges);
    }

    public ParseException(String message, Throwable cause, SubstringRange... ranges) {
        this(message, cause, Arrays.asList(ranges));
    }

    public List<SubstringRange> getRanges() {
        return Collections.unmodifiableList(ranges);
    }

    public ParseException indentRanges(int x) {
        List<SubstringRange> newRanges = ranges.stream()
                                                .map(range -> range.indent(x))
                                                .collect(Collectors.toList());
        return new ParseException(getMessage(), this, newRanges);
    }

}

@@ -168,44 +168,8 @@
 ist;
-%0Aimport java.util.stream.Collectors;
 %0A%0Aim
@@ -1571,342 +1571,6 @@
  %7D%0A%0A
-    public ParseException indentRanges(int x) %7B%0A        List%3CSubstringRange%3E newRanges = ranges.stream()%0A                                                .map(range -%3E range.indent(x))%0A                                                .collect(Collectors.toList());%0A        return new ParseException(getMessage(), this, newRanges);%0A    %7D%0A%0A
 %7D%0A

remove unused methods