Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
org.bukkit.command.defaults.HelpCommand Class Reference
Inheritance diagram for org.bukkit.command.defaults.HelpCommand:
org.bukkit.command.defaults.VanillaCommand org.bukkit.command.Command

Public Member Functions

boolean execute (CommandSender sender, String currentAlias, String[] args)
 
List< String > tabComplete (CommandSender sender, String alias, String[] args)
 
- Public Member Functions inherited from org.bukkit.command.defaults.VanillaCommand
boolean matches (String input)
 
- Public Member Functions inherited from org.bukkit.command.Command
abstract boolean execute (CommandSender sender, String commandLabel, String[] args)
 
List< String > tabComplete (CommandSender sender, String[] args)
 
List< String > tabComplete (CommandSender sender, String alias, String[] args) throws IllegalArgumentException
 
String getName ()
 
String getPermission ()
 
void setPermission (String permission)
 
boolean testPermission (CommandSender target)
 
boolean testPermissionSilent (CommandSender target)
 
String getLabel ()
 
boolean setLabel (String name)
 
boolean register (CommandMap commandMap)
 
boolean unregister (CommandMap commandMap)
 
boolean isRegistered ()
 
List< String > getAliases ()
 
String getPermissionMessage ()
 
String getDescription ()
 
String getUsage ()
 
Command setAliases (List< String > aliases)
 
Command setDescription (String description)
 
Command setPermissionMessage (String permissionMessage)
 
Command setUsage (String usage)
 
String toString ()
 

Protected Member Functions

HelpTopic findPossibleMatches (String searchString)
 
- Protected Member Functions inherited from org.bukkit.command.defaults.VanillaCommand
 VanillaCommand (String name)
 
 VanillaCommand (String name, String description, String usageMessage, List< String > aliases)
 
int getInteger (CommandSender sender, String value, int min)
 
- Protected Member Functions inherited from org.bukkit.command.Command
 Command (String name)
 
 Command (String name, String description, String usageMessage, List< String > aliases)
 

Static Protected Member Functions

static int damerauLevenshteinDistance (String s1, String s2)
 

Additional Inherited Members

- Static Public Member Functions inherited from org.bukkit.command.defaults.VanillaCommand
static double getRelativeDouble (double original, CommandSender sender, String input)
 
static double getDouble (CommandSender sender, String input)
 
static double getDouble (CommandSender sender, String input, double min, double max)
 
- Static Public Member Functions inherited from org.bukkit.command.Command
static void broadcastCommandMessage (CommandSender source, String message)
 
static void broadcastCommandMessage (CommandSender source, String message, boolean sendToSource)
 
- Protected Attributes inherited from org.bukkit.command.Command
String description = ""
 
String usageMessage
 

Detailed Description

Definition at line 27 of file HelpCommand.java.

Member Function Documentation

static int org.bukkit.command.defaults.HelpCommand.damerauLevenshteinDistance ( String  s1,
String  s2 
)
staticprotected

Computes the Dameraur-Levenshtein Distance between two strings. Adapted from the algorithm at Wikipedia: Damerau–Levenshtein distance

Parameters
s1The first string being compared.
s2The second string being compared.
Returns
The number of substitutions, deletions, insertions, and transpositions required to get from s1 to s2.

Definition at line 175 of file HelpCommand.java.

175  {
176  if (s1 == null && s2 == null) {
177  return 0;
178  }
179  if (s1 != null && s2 == null) {
180  return s1.length();
181  }
182  if (s1 == null && s2 != null) {
183  return s2.length();
184  }
185 
186  int s1Len = s1.length();
187  int s2Len = s2.length();
188  int[][] H = new int[s1Len + 2][s2Len + 2];
189 
190  int INF = s1Len + s2Len;
191  H[0][0] = INF;
192  for (int i = 0; i <= s1Len; i++) {
193  H[i + 1][1] = i;
194  H[i + 1][0] = INF;
195  }
196  for (int j = 0; j <= s2Len; j++) {
197  H[1][j + 1] = j;
198  H[0][j + 1] = INF;
199  }
200 
201  Map<Character, Integer> sd = new HashMap<Character, Integer>();
202  for (char Letter : (s1 + s2).toCharArray()) {
203  if (!sd.containsKey(Letter)) {
204  sd.put(Letter, 0);
205  }
206  }
207 
208  for (int i = 1; i <= s1Len; i++) {
209  int DB = 0;
210  for (int j = 1; j <= s2Len; j++) {
211  int i1 = sd.get(s2.charAt(j - 1));
212  int j1 = DB;
213 
214  if (s1.charAt(i - 1) == s2.charAt(j - 1)) {
215  H[i + 1][j + 1] = H[i][j];
216  DB = j;
217  } else {
218  H[i + 1][j + 1] = Math.min(H[i][j], Math.min(H[i + 1][j], H[i][j + 1])) + 1;
219  }
220 
221  H[i + 1][j + 1] = Math.min(H[i + 1][j + 1], H[i1][j1] + (i - i1 - 1) + 1 + (j - j1 - 1));
222  }
223  sd.put(s1.charAt(i - 1), i);
224  }
225 
226  return H[s1Len + 1][s2Len + 1];
227  }

The documentation for this class was generated from the following file: