public class Controller
extends java.lang.Object
Constructor and Description |
---|
Controller()
Base constructor
|
Modifier and Type | Method and Description |
---|---|
protected int |
BinaryCheckOneLeft(char searchValue,
int index)
Check values directly left for "unused" match.
|
protected int |
BinaryCheckOneRight(char searchValue,
int index)
Check values directly right for "unused" match.
|
protected int |
BinarySearch(char searchValue,
int firstIndex,
int lastIndex)
Binary search through array for given value.
|
protected void |
CreateArray()
Creates initial 2D array.
|
protected void |
GetArrayDimensions()
Sets dimensions of 2d-Array.
|
protected long |
GetTimeLapse(java.util.Date startDate)
Prints the difference between provided start time and current time.
|
protected long |
GetTimeLapse(java.util.Date startDate,
java.lang.String userDisplayString)
Prints the difference between provided start time and current time.
|
protected java.lang.String |
GetUserInput()
Acquire user input.
|
protected java.lang.String |
GetUserInput(java.lang.String promptString)
Prompt for and acquire user input.
|
protected void |
LinearSearch(char searchValue,
boolean printAll)
Linearly search through array for given value.
|
protected void |
PrintArraySearch(char searchValue,
int index)
Print out search values for sorted array.
|
protected void |
PrintArraySearch(char searchValue,
int index1,
int index2)
Print out search values for unsorted array.
|
protected void |
PrintHelp()
Print help text for user.
|
protected void |
PrintSortedArray()
Prints current sorted array values.
|
protected void |
PrintUnsortedArray()
Prints current unsorted array values.
|
protected void |
ReplaceName()
Replaces characters in user's name m times, where m is declared by user input.
|
protected void |
ReplaceNameChar()
Replaces a random character in the user's name.
|
protected void |
RunCore()
Core functionality of program.
|
protected void |
SearchNameSorted(boolean printAll)
Iterate through each char in name and search for value in array.
|
protected void |
SearchNameUnsorted(boolean printAll)
Iterate through each char in name and search for value in array.
|
protected void |
SortArray()
Sorts current array values alphabetically.
|
protected void RunCore()
protected void CreateArray()
protected void SortArray()
protected void SearchNameUnsorted(boolean printAll)
printAll
- Determines if method prints output or not.protected void SearchNameSorted(boolean printAll)
printAll
- Determines if method prints output or not.protected void LinearSearch(char searchValue, boolean printAll)
searchValue
- Char to search for.printAll
- Determines if method prints output or not.protected int BinarySearch(char searchValue, int firstIndex, int lastIndex)
searchValue
- Char to search for.firstIndex
- Lowest index for current recursive interation.lastIndex
- Highest index for current recursive interation.protected int BinaryCheckOneLeft(char searchValue, int index)
searchValue
- Char to search for.index
- Index that was "used".protected int BinaryCheckOneRight(char searchValue, int index)
searchValue
- Char to search for.index
- Index that was "used".protected void ReplaceName()
protected void ReplaceNameChar()
protected java.lang.String GetUserInput()
protected java.lang.String GetUserInput(java.lang.String promptString)
promptString
- String to show user.protected void PrintHelp()
protected void GetArrayDimensions()
protected void PrintUnsortedArray()
protected void PrintSortedArray()
protected void PrintArraySearch(char searchValue, int index1, int index2)
searchValue
- Char to search for.index1
- Row char was found in.index2
- Col char was found in.protected void PrintArraySearch(char searchValue, int index)
searchValue
- Char to search for.index
- Index char was found in.protected long GetTimeLapse(java.util.Date startDate)
startDate
- Start time.protected long GetTimeLapse(java.util.Date startDate, java.lang.String userDisplayString)
startDate
- Start time.userDisplayString
- Additional info to show user.