package net.knarcraft.paidsigns.utility; import java.util.ArrayList; import java.util.List; /** * A tokenizer for being able to support quotes in commands */ public final class Tokenizer { private Tokenizer() { } /** * Tokenizes a string * * @param input
A string
* @returnA list of tokens
*/ public static ListA string
* @param allowEmptyQuotesWhether to treat "" as a token
* @returnA list of tokens
*/ public static ListThe string builder containing the current token.
* @param characterThe character found in the input.
* @param inputLengthThe length of the given input
* @param indexThe index of the read character.
* @param tokensThe list of processed tokens.
*/ private static void tokenizeNormalCharacter(StringBuilder currentToken, char character, int inputLength, int index, ListWhether this space is inside a pair of quotes.
* @param currentTokenThe string builder containing the current token.
* @param tokensThe list of processed tokens.
* @returnTrue if the token is finished.
*/ private static boolean tokenizeSpace(boolean startedQuote, StringBuilder currentToken, ListThe string builder to check.
* @returnTrue if the string builder is non empty.
*/ private static boolean isNotEmpty(StringBuilder builder) { return !builder.toString().trim().equals(""); } }