public class ForgeCommandNotFoundHandler extends Object implements org.jboss.aesh.console.settings.CommandNotFoundHandler
| Constructor and Description |
|---|
ForgeCommandNotFoundHandler(org.jboss.aesh.console.command.registry.CommandRegistry commandRegistry) |
| Modifier and Type | Method and Description |
|---|---|
static int |
getLevenshteinDistance(CharSequence s,
CharSequence t)
Find the Levenshtein distance between two Strings.
|
void |
handleCommandNotFound(String line,
org.jboss.aesh.terminal.Shell shell) |
public ForgeCommandNotFoundHandler(org.jboss.aesh.console.command.registry.CommandRegistry commandRegistry)
public void handleCommandNotFound(String line, org.jboss.aesh.terminal.Shell shell)
handleCommandNotFound in interface org.jboss.aesh.console.settings.CommandNotFoundHandlerpublic static int getLevenshteinDistance(CharSequence s, CharSequence t)
Find the Levenshtein distance between two Strings.
This is the number of changes needed to change one String into another, where each change is a single character modification (deletion, insertion or substitution).
The previous implementation of the Levenshtein distance algorithm was from http://www.merriampark.com/ld.htm
Chas Emerick has written an implementation in Java, which avoids an OutOfMemoryError which can occur when my Java
implementation is used with very large strings.
This implementation of the Levenshtein distance algorithm is from http://www.merriampark.com/ldjava.htm
StringUtils.getLevenshteinDistance(null, *) = IllegalArgumentException
StringUtils.getLevenshteinDistance(*, null) = IllegalArgumentException
StringUtils.getLevenshteinDistance("","") = 0
StringUtils.getLevenshteinDistance("","a") = 1
StringUtils.getLevenshteinDistance("aaapppp", "") = 7
StringUtils.getLevenshteinDistance("frog", "fog") = 1
StringUtils.getLevenshteinDistance("fly", "ant") = 3
StringUtils.getLevenshteinDistance("elephant", "hippo") = 7
StringUtils.getLevenshteinDistance("hippo", "elephant") = 7
StringUtils.getLevenshteinDistance("hippo", "zzzzzzzz") = 8
StringUtils.getLevenshteinDistance("hello", "hallo") = 1
s - the first String, must not be nullt - the second String, must not be nullIllegalArgumentException - if either String input nullCopyright © 2014 JBoss by Red Hat. All rights reserved.