com.android.tools.lint.checks
Class TypoLookup

java.lang.Object
  extended by com.android.tools.lint.checks.TypoLookup

public class TypoLookup
extends java.lang.Object

Database of common typos / misspellings.


Method Summary
static TypoLookup get(com.android.tools.lint.client.api.LintClient client, java.lang.String locale, java.lang.String region)
          Returns an instance of the Typo database for the given locale
 java.util.List<java.lang.String> getTypos(byte[] utf8Text, int begin, int end)
          Look up whether this word is a typo, and if so, return the typo itself and one or more likely meanings
 java.util.List<java.lang.String> getTypos(java.lang.CharSequence text, int begin, int end)
          Look up whether this word is a typo, and if so, return the typo itself and one or more likely meanings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

get

@Nullable
public static TypoLookup get(@NonNull
                                      com.android.tools.lint.client.api.LintClient client,
                                      @NonNull
                                      java.lang.String locale,
                                      @Nullable
                                      java.lang.String region)
Returns an instance of the Typo database for the given locale

Parameters:
client - the client to associate with this database - used only for logging. The database object may be shared among repeated invocations, and in that case client used will be the one originally passed in. In other words, this parameter may be ignored if the client created is not new.
locale - the locale to look up a typo database for (should be a language code (ISO 639-1, two lowercase character names)
region - the region to look up a typo database for (should be a two letter ISO 3166-1 alpha-2 country code in upper case) language code
Returns:
a (possibly shared) instance of the typo database, or null if its data can't be found

getTypos

@Nullable
public java.util.List<java.lang.String> getTypos(@NonNull
                                                          java.lang.CharSequence text,
                                                          int begin,
                                                          int end)
Look up whether this word is a typo, and if so, return the typo itself and one or more likely meanings

Parameters:
text - the string containing the word
begin - the index of the first character in the word
end - the index of the first character after the word. Note that the search may extend beyond this index, if for example the word matches a multi-word typo in the dictionary
Returns:
a list of the typo itself followed by the replacement strings if the word represents a typo, and null otherwise

getTypos

@Nullable
public java.util.List<java.lang.String> getTypos(@NonNull
                                                          byte[] utf8Text,
                                                          int begin,
                                                          int end)
Look up whether this word is a typo, and if so, return the typo itself and one or more likely meanings

Parameters:
utf8Text - the string containing the word, encoded as UTF-8
begin - the index of the first character in the word
end - the index of the first character after the word. Note that the search may extend beyond this index, if for example the word matches a multi-word typo in the dictionary
Returns:
a list of the typo itself followed by the replacement strings if the word represents a typo, and null otherwise