Contents
Class SuggestionResult
java.lang.Object
com.hypixel.hytale.server.core.command.system.suggestion.SuggestionResult
A result from finding all the autocomplete suggestions of an argument
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an unbounded result.SuggestionResult(int maxSuggestions) Creates a result capped atmaxSuggestions. -
Method Summary
Modifier and TypeMethodDescriptionbooleanisFull()Whether the cap has been reached.booleanvoidMarks that more matches existed than were added to this result, i.e. the suggestion list was capped.Suggest any random object.<DataType> SuggestionResultSuggest an object and provide a toString function to turn it into a StringsuggestContinuation(String suggestion)
-
Constructor Details
-
SuggestionResult
public SuggestionResult()Creates an unbounded result. Used by the local server console, where JLine needs the complete candidate set to filter correctly as the operator narrows what they have typed. -
SuggestionResult
public SuggestionResult(int maxSuggestions) Creates a result capped atmaxSuggestions. Once the cap is reached, further suggestions are dropped andisTruncated()returnstrue. Used by the networked client path to bound the suggestion packet.
-
-
Method Details
-
suggest
-
suggestContinuation
-
suggest
@Nonnull public <DataType> SuggestionResult suggest(@Nonnull Function<DataType, String> toStringFunction, @Nonnull DataType suggestion) Suggest an object and provide a toString function to turn it into a String- Type Parameters:
DataType- The Type of the suggestion Object- Parameters:
toStringFunction- The function to be executed on the object to turn it into a Stringsuggestion- The object to suggest- Returns:
- this, for chaining
-
suggest
Suggest any random object. TheObject.toString()method will be called to convert it to a String- Parameters:
objectToString- The object to convert to a String and suggest- Returns:
- this, for chaining
-
getSuggestions
-
getContinuations
-
markTruncated
public void markTruncated()Marks that more matches existed than were added to this result, i.e. the suggestion list was capped. Lets callers tell the client the result is not the complete set for the query. -
isTruncated
public boolean isTruncated() -
isFull
public boolean isFull()Whether the cap has been reached. Suggesters can check this to stop producing candidates early.
-