src/main/java/seedu/address/ui/autocompleter/Autocompleter.java
public String autocomplete() {
        switch (state) {
        case COMMAND:
            clearResultsWindow();
            if (isImportOrFindCommand()) {
                return textInCommandBox;
            }
            return (possibleAutocompleteResults.isEmpty()) ? textInCommandBox : possibleAutocompleteResults.get(0);

        case EMPTY:
            raise(new NewResultAvailableEvent(PROMPT_USER_TO_USE_HELP_MESSAGE, false));
            return EMPTY_STRING;

        case COMMAND_NEXT_PREFIX:
            clearResultsWindow();
            if (possibleAutocompleteResults.isEmpty()) {
                return textInCommandBox;
            }
            return textInCommandBox.trim() + SPACE + possibleAutocompleteResults.get(0);

        case COMMAND_CYCLE_PREFIX:
            clearResultsWindow();
            return textInCommandBox.substring(0, textInCommandBox.length() - 2)
                    + possibleAutocompleteResults.get(cycleIndex());

        case COMMAND_COMPLETE_PREFIX:
            clearResultsWindow();
            return textInCommandBox + PREFIX_INDICATOR;

        case INDEX:
            clearResultsWindow();
            String[] temp = textInCommandBox.split(" ");
            return temp[0] + " " + cycleCountingIndex();

        case MULTIPLE_COMMAND:
            displayMultipleResults(possibleAutocompleteResults);
            return possibleAutocompleteResults.get(cycleIndex());

        case NO_RESULT: //fall through to default

        default:
            clearResultsWindow();
            return textInCommandBox;
        }
    }
/**
     * Returns a string that will replace the current text in the {@code CommandBox}
     * depending on the current state of the autocompleter. A {@code NewResultAvailableEvent}
     * will is also raised to update the text inside the {@code ResultDisplay}
     *
     * @return {@code String} that will replace text in teh {@code CommandBox}
     */
Returns a string that will replace the current text in the  CommandBox
depending on the current state of the autocompleter. A  NewResultAvailableEvent
will is also raised to update the text inside the  ResultDisplay

@return  String that will replace text in teh  CommandBox
Returns a string that will replace the current text in the CommandBox depending on the current state of the autocompleter . A NewResultAvailableEvent will is also raised to update the text inside the ResultDisplay @return String that will replace text in teh CommandBox
public String autocomplete() {
        switch (state) {
        case COMMAND:
            clearResultsWindow();
            if (isImportOrFindCommand()) {
                return textInCommandBox;
            }
            return (possibleAutocompleteResults.isEmpty()) ? textInCommandBox : possibleAutocompleteResults.get(0);
        case EMPTY:
            raise(new NewResultAvailableEvent(PROMPT_USER_TO_USE_HELP_MESSAGE, false));
            return EMPTY_STRING;
        case COMMAND_NEXT_PREFIX:
            clearResultsWindow();
            if (possibleAutocompleteResults.isEmpty()) {
                return textInCommandBox;
            }
            return textInCommandBox.trim() + SPACE + possibleAutocompleteResults.get(0);
        case COMMAND_CYCLE_PREFIX:
            clearResultsWindow();
            return textInCommandBox.substring(0, textInCommandBox.length() - 2)
                    + possibleAutocompleteResults.get(cycleIndex());
        case COMMAND_COMPLETE_PREFIX:
            clearResultsWindow();
            return textInCommandBox + PREFIX_INDICATOR;
        case INDEX:
            clearResultsWindow();
            String[] temp = textInCommandBox.split(" ");
            return temp[0] + " " + cycleCountingIndex();
        case MULTIPLE_COMMAND:
            displayMultipleResults(possibleAutocompleteResults);
            return possibleAutocompleteResults.get(cycleIndex());
        case NO_RESULT: 
        default:
            clearResultsWindow();
            return textInCommandBox;
        }
    }
public String autocomplete ( ) { switch ( state ) { case COMMAND : clearResultsWindow ( ) ; if ( isImportOrFindCommand ( ) ) { return textInCommandBox ; } return ( possibleAutocompleteResults . isEmpty ( ) ) ? textInCommandBox : possibleAutocompleteResults . get ( 0 ) ; case EMPTY : raise ( new NewResultAvailableEvent ( PROMPT_USER_TO_USE_HELP_MESSAGE , false ) ) ; return EMPTY_STRING ; case COMMAND_NEXT_PREFIX : clearResultsWindow ( ) ; if ( possibleAutocompleteResults . isEmpty ( ) ) { return textInCommandBox ; } return textInCommandBox . trim ( ) + SPACE + possibleAutocompleteResults . get ( 0 ) ; case COMMAND_CYCLE_PREFIX : clearResultsWindow ( ) ; return textInCommandBox . substring ( 0 , textInCommandBox . length ( ) - 2 ) + possibleAutocompleteResults . get ( cycleIndex ( ) ) ; case COMMAND_COMPLETE_PREFIX : clearResultsWindow ( ) ; return textInCommandBox + PREFIX_INDICATOR ; case INDEX : clearResultsWindow ( ) ; String [ ] temp = textInCommandBox . split ( " " ) ; return temp [ 0 ] + " " + cycleCountingIndex ( ) ; case MULTIPLE_COMMAND : displayMultipleResults ( possibleAutocompleteResults ) ; return possibleAutocompleteResults . get ( cycleIndex ( ) ) ; case NO_RESULT : default : clearResultsWindow ( ) ; return textInCommandBox ; } }
Returns a string that will replace the current text in the {@code CommandBox}
 depending on the current state of the autocompleter.
Returns a string that will replace the current text in the { @code CommandBox } depending on the current state of the autocompleter .
//fall through to default