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

net.lenni0451.commandlib.ParseResult Maven / Gradle / Ivy

The newest version!
package net.lenni0451.commandlib;

import net.lenni0451.commandlib.exceptions.ChainExecutionException;

import java.util.Collections;
import java.util.List;

/**
 * Storage for all parsed argument chains.
 *
 * @param  The type of the executor
 */
public class ParseResult {

    private final List> parsedChains;
    private final List> failedChains;

    public ParseResult(final List> parsedChains, final List> failedChains) {
        this.parsedChains = parsedChains;
        this.failedChains = failedChains;
    }

    public List> getParsedChains() {
        return Collections.unmodifiableList(this.parsedChains);
    }

    public List> getFailedChains() {
        return Collections.unmodifiableList(this.failedChains);
    }


    public static class ParsedChain {
        private final ArgumentChain argumentChain;
        private final List matchedArguments;

        public ParsedChain(final ArgumentChain argumentChain, final List matchedArguments) {
            this.argumentChain = argumentChain;
            this.matchedArguments = matchedArguments;
        }

        public ArgumentChain getArgumentChain() {
            return this.argumentChain;
        }

        public List getMatchedArguments() {
            return this.matchedArguments;
        }
    }

    public static class FailedChain {
        private final ArgumentChain argumentChain;
        private final ChainExecutionException executionException;

        public FailedChain(final ArgumentChain argumentChain, final ChainExecutionException executionException) {
            this.argumentChain = argumentChain;
            this.executionException = executionException;
        }

        public ArgumentChain getArgumentChain() {
            return this.argumentChain;
        }

        public ChainExecutionException getExecutionException() {
            return this.executionException;
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy