Package parsing
Class KeywordInterface
Object
KeywordInterface
public class KeywordInterface
extends Object
KeywordInterface
is the backend for CommandUI
, providing support for parsing user input to commands and functions.-
Field Summary
Fields Modifier and Type Field Description static Object
prev
The previous output ofuseKeywords(String)
-
Method Summary
Modifier and Type Method Description static GeneralFunction
parseStored(String input)
Parses input usinguseKeywords(String)
andstoredFunctions
static Object
safeKeywords(String input)
RunsuseKeywords(String)
assuming that the input is not an exit argument, removing the checked exceptionstatic GeneralFunction
substituteAll(GeneralFunction function)
Substitutes everything stored instoredFunctions
intofunction
in an unspecified orderstatic Object
useKeywords(String input)
Takes input as a string in the format"command arguments..."
-
Field Details
-
prev
public static Object prevThe previous output ofuseKeywords(String)
-
-
Method Details
-
useKeywords
Takes input as a string in the format"command arguments..."
- Parameters:
input
- a string that contains the command and arguments- Returns:
- the Object requested
- Throws:
UserExitException
- if the input prompts an exit from the program
-
safeKeywords
public static Object safeKeywords(String input)RunsuseKeywords(String)
assuming that the input is not an exit argument, removing the checked exception- Parameters:
input
- the input foruseKeywords(String)
- Returns:
- the output of
useKeywords(String)
- Throws:
IllegalArgumentException
- if the input passed throws anUserExitException
-
parseStored
Parses input usinguseKeywords(String)
andstoredFunctions
- Parameters:
input
- input string- Returns:
- a
GeneralFunction
-
substituteAll
Substitutes everything stored instoredFunctions
intofunction
in an unspecified order- Parameters:
function
- the function to be substituted into- Returns:
input
with all substitutions
-