com.notuvy.cmd
Class PrefixSynonymMap
java.lang.Object
com.notuvy.cmd.PrefixSynonymMap
public class PrefixSynonymMap
- extends Object
Create unique synonyms for a given set of commands.
A full command is broken into all its prefixes (i.e. "load" becomes
"loa", "lo", "l". All of these which do not conflict with any
others are kept as synonyms.
User: murali
Date: Jan 3, 2008
Time: 8:00:21 AM
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
P_MULTIPLE
protected static final Pattern P_MULTIPLE
PrefixSynonymMap
public PrefixSynonymMap(Set<String> pOriginals)
- Note that the full set of commands must be given on creation. We cannot
allow iterative addition because the full set must be known to accurately
compute the unique prefixes.
- Parameters:
pOriginals
- The full set of strings to process.
allPrefixes
protected static Collection<String> allPrefixes(String pInput)
- Determine the full set of prefixes that can be extracted from the given word.
- Parameters:
pInput
- Input command.
- Returns:
- The full collection of prefix strings.
selectAll
protected static Collection<String> selectAll(Pattern pPattern,
Collection<String> pStrings)
getMap
protected Map<String,String> getMap()
lookup
public String lookup(String pKey)
Copyright © 2013. All Rights Reserved.