All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fun.mike.flapjack.pipeline.lab.ParsePipelineError Maven / Gradle / Ivy

package fun.mike.flapjack.pipeline.lab;

import java.util.List;

import fun.mike.flapjack.alpha.ParseResult;
import fun.mike.flapjack.alpha.Problem;
import fun.mike.record.alpha.Record;

public class ParsePipelineError implements PipelineError {
    private final int number;
    private final String line;
    private final Record record;
    private final List problems;

    public ParsePipelineError(int number, String line, Record record, List problems) {
        this.number = number;
        this.line = line;
        this.record = record;
        this.problems = problems;
    }

    public static ParsePipelineError of(int number, String line, Record record, List problems) {
        return new ParsePipelineError(number, line, record, problems);
    }

    public static ParsePipelineError fromResult(int number, String line, ParseResult error) {
        return new ParsePipelineError(number, line, error.getValue(), error.getProblems());
    }

    @Override
    public int getNumber() {
        return number;
    }

    @Override
    public String getLine() {
        return line;
    }

    @Override
    public void accept(PipelineErrorVisitor visitor) {
        visitor.visit(this);
    }

    public Record getRecord() {
        return record;
    }

    public List getProblems() {
        return problems;
    }

    @Override
    public String toString() {
        return "ParsePipelineError{" +
                "number=" + number +
                ", line='" + line + '\'' +
                ", record=" + record +
                ", problems=" + problems +
                '}';
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy