Enum Class CLI
- All Implemented Interfaces:
Serializable,Comparable<CLI>,Constable
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CLIUsed by Main to begin program logicprivate StringHelper method to ensure user is entering a proper numerical value for the madlibifiable skipper variablegetReplacementWords(List<String> posList) Prompt user to enter words one at a time based on the parts of speech of the words removed during madlib blankingprivate PathgetSourceTxtFile(String filepath) Parsing logic to obtain a valid filepath for the text to be madlibifiedvoidMain controller logic that facilitates the madlib creation process in steps by requesting filenames, calling helper methods, and confirming successful text processingprivate booleanHelper method that determines if CLI should prompt the user for parts of speech or end the program.static CLIReturns the enum constant of this class with the specified name.static CLI[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
INSTANCE
-
-
Field Details
-
SCANNER
-
DIGITS
Parsing logic to ensure user is inputting valid numbers when prompted
-
-
Constructor Details
-
CLI
private CLI()
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getInstance
Used by Main to begin program logic -
initiateMadlibCreation
public void initiateMadlibCreation() throws NullPointerException, utility.exceptions.TextNotProcessedException, IOException, utility.exceptions.NullPOSListExceptionMain controller logic that facilitates the madlib creation process in steps by requesting filenames, calling helper methods, and confirming successful text processing- Throws:
NullPointerExceptionutility.exceptions.TextNotProcessedExceptionIOExceptionutility.exceptions.NullPOSListException
-
getSourceTxtFile
-
getMadlibifiableSkipper
Helper method to ensure user is entering a proper numerical value for the madlibifiable skipper variable -
queryFillInMadlib
private boolean queryFillInMadlib()Helper method that determines if CLI should prompt the user for parts of speech or end the program. If user decides to enter parts of speech, the CLI will call getReplacementWords. Otherwise, it ends the program. -
getReplacementWords
private Queue<String> getReplacementWords(List<String> posList) throws utility.exceptions.NullPOSListException Prompt user to enter words one at a time based on the parts of speech of the words removed during madlib blanking- Parameters:
posList- CLI iterates over the parts of speech in order so that the user can enter replacement words in order of when they appear in the text- Returns:
- Returns the list of words in a queue for cleaner replacement when filling in the madlib; no indexing required, and constant time removal better handles errors involved in case the list empties before madlib filling is complete.
- Throws:
utility.exceptions.NullPOSListException
-