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

com.skillw.pouvoir.util.read.Result Maven / Gradle / Ivy

The newest version!
package com.skillw.pouvoir.util.read;

import org.jetbrains.annotations.NotNull;

public class Result {
    public T result = null;
    public int start;
    public int end;
    public String all = null;
    private Parser root = null;

    public Result() {
    }

    public Result(Parser root) {
        this.root = root;
    }

    public Result(Parser root, String all) {
        this.root = root;
        this.all = all;
    }

    public boolean matched() {
        return this.result != null;
    }


    public Result setResult(T result) {
        this.result = result;
        return this;
    }

    public Result setRange(int start, int end) {
        this.start = start;
        this.end = end;
        return this;
    }

    @NotNull
    public Result parse() {
        if (this.root == null || this.all == null) {
            return new Result<>();
        }
        return this.root.parse(this.all.substring(this.end));
    }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy