Word Game Builder 2.0.1f2
Reference Manual
|
A specialized data structure for storing letters and words. More...
Public Member Functions | |
void | CollapseSet () |
Compress the set into compressed form to save memory. Also clears the runtime set. More... | |
bool | Contains (string word) |
Returns true if the word set contains a word. More... | |
int | Contains (string prefix, int maxWordLength, int maxIterations, IList< string > stringList) |
Returns the amount of words that starts with the specified prefix. More... | |
void | Decompress () |
Expands the set from compressed form. More... | |
IEnumerator | Decompress (System.Action< float > progressCallback, int iterationsPerFrame=100) |
Expands the set from compressed form. Yields when progress is updated and can be used in a coroutine. More... | |
AsyncTask | DecompressAsync () |
Expands the set from compressed form asynchronously. More... | |
AsyncTask | DecompressAsync (System.Action callback) |
Expands the set from compressed form asynchronously. More... | |
AsyncTask | DecompressAsync (System.Action callback, System.Action< float > progressCallback, int iterationsPerFrame=100) |
Expands the set from compressed form asynchronously. More... | |
WordResult | FindWord (string word, bool ordered) |
Finds the word in the set. More... | |
WordResult | FindWord (string word, bool ordered, int maxWordLength, int maxIterations) |
Finds the word in the set. More... | |
AsyncTask | FindWordAsync (string word, bool ordered, System.Action< WordResult > callback) |
Finds the word in the set, asynchronously. More... | |
AsyncTask | FindWordAsync (string word, bool ordered, int maxWordLength, int maxIterations, System.Action< WordResult > callback) |
Finds the word in the set, asynchronously. More... | |
WordResult | FindWords (string prefix, int maxWordLength, int maxIterations) |
Returns all words that begin with a prefix, up to maxIterations. Returns Wordresult.empty if no words are found. More... | |
AsyncTask | FindWordsAsync (string prefix, int maxWordLength, int maxIterations, System.Action< WordResult > callback) |
Asynchronously returns all words that begin with a prefix, up to maxIterations. More... | |
bool | Insert (string word) |
Inserts a word into the set. More... | |
void | InsertRange (IEnumerable< string > words) |
Inserts an enumerable of words into the set. More... | |
void | Optimize () |
Optimizes a word set for fast searches. This may take a while and should be done offline - not at runtime. More... | |
bool | Remove (string word) |
Removes a word from the set. More... | |
Public Attributes | |
const int | k_MaxPrefixLength |
The maximum length of a prefix in the word set's internal representation. More... | |
Properties | |
bool | isExpanded [get] |
Whether or not the word set is expanded in memory. More... | |
int | wordCount [get] |
Gets the amount of words in the word set. More... | |
A specialized data structure for storing letters and words.
The WordSet is a highly optimized structure for fast word searches. It is loaded in a compressed form, and must be decompressed before lookup operations will work.
|
inline |
Compress the set into compressed form to save memory. Also clears the runtime set.
The word set cannot be used in compressed form.
|
inline |
Returns true if the word set contains a word.
Search operations in the word set use the underlying dictionary strings, unlike the WordChecker class (which uses letter tiles).
word | The word to search for. |
true
if the word was found, otherwise false
.
|
inline |
Returns the amount of words that starts with the specified prefix.
Accepts a pre-allocated list (should be empty) to use for calculations.
prefix | The prefix to search for. |
maxWordLength | The maximum allowed word length. |
maxIterations | The maximum amount of iterations to perform. |
stringList | A scratch list for prefix calculations. |
|
inline |
Expands the set from compressed form.
If Language.decompressOnLoad is disabled, this must be called explicitly.
|
inline |
Expands the set from compressed form. Yields when progress is updated and can be used in a coroutine.
progressCallback | The method to call each time the task's progress is updated. This method must take a float as the only argument. |
iterationsPerFrame | The maximum amount of iterations to process per frame. Defaults to 100. |
If Language.decompressOnLoad is disabled, this must be called explicitly.
|
inline |
Expands the set from compressed form asynchronously.
If Language.decompressOnLoad is disabled, this must be called explicitly.
|
inline |
Expands the set from compressed form asynchronously.
callback | The method to call upon completion. |
If Language.decompressOnLoad is disabled, this must be called explicitly.
|
inline |
Expands the set from compressed form asynchronously.
callback | The method to call upon completion. |
progressCallback | The method to call each time the task's progress is updated. This method must take a float as the only argument. |
iterationsPerFrame | The amount of iterations per progress frame. |
If Language.decompressOnLoad is disabled, this must be called explicitly.
|
inline |
Finds the word in the set.
word | The string input for the lookup operation. |
ordered | If true, performs a check on the string, in order. If false, performs a permutation check on every combination of the string. |
Search operations in the word set use the underlying dictionary strings, unlike the WordChecker class, which uses letter tiles.
|
inline |
Finds the word in the set.
word | The string input for the lookup operation. |
ordered | If true, performs a check on the string, in order. If false, performs a permutation check on every combination of the string. |
maxWordLength | The maximum length of a word input. If the input is longer than this value, it will be truncated. |
maxIterations | The maximum amount of iterations for any permutation checks. |
Search operations in the word set use the underlying dictionary strings, unlike the WordChecker class, which uses letter tiles.
|
inline |
Finds the word in the set, asynchronously.
word | The string input for the lookup operation. |
ordered | If true, performs a check on the string, in order. If false, performs a permutation check on every combination of the string. |
callback | The method to call upon completion. This method must take a WordResult as the only argument. |
Search operations in the word set use the underlying dictionary strings, unlike the WordChecker class, which uses letter tiles.
|
inline |
Finds the word in the set, asynchronously.
word | The string input for the lookup operation. |
ordered | If true, performs a check on the string, in order. If false, performs a permutation check on every combination of the string. |
maxWordLength | The maximum length of a word input. If the input is longer than this value, it will be truncated. |
maxIterations | The maximum amount of iterations for any permutation checks. |
callback | The method to call upon completion. This method must take a WordResult as the only argument. |
Search operations in the word set use the underlying dictionary strings, unlike the WordChecker class, which uses letter tiles.
|
inline |
Returns all words that begin with a prefix, up to maxIterations. Returns Wordresult.empty if no words are found.
prefix | The prefix to search. |
maxWordLength | The maximum allowed word length. |
maxIterations | The maximum amount of iterations allowed. |
|
inline |
Asynchronously returns all words that begin with a prefix, up to maxIterations.
prefix | The prefix to search. |
maxWordLength | The maximum allowed word length. |
maxIterations | The maximum amount of iterations allowed. |
callback | The method to call upon completion. This method must take a WordResult as the only argument. |
|
inline |
Inserts a word into the set.
word | The word to insert into the set. |
true
if the operation was successful; otherwise false
.
|
inline |
Inserts an enumerable of words into the set.
words | The words to insert. |
|
inline |
Optimizes a word set for fast searches. This may take a while and should be done offline - not at runtime.
|
inline |
Removes a word from the set.
word | The word to remove. |
true
if the operation was successful; otherwise false
.const int k_MaxPrefixLength |
The maximum length of a prefix in the word set's internal representation.
This value is implementation-specific and cannot be changed.
|
get |
Whether or not the word set is expanded in memory.
|
get |
Gets the amount of words in the word set.