com.notuvy.cmd
Class PrefixSynonymMap

java.lang.Object
  extended by 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


Field Summary
protected static Pattern P_MULTIPLE
           
 
Constructor Summary
PrefixSynonymMap(Set<String> pOriginals)
          Note that the full set of commands must be given on creation.
 
Method Summary
protected static Collection<String> allPrefixes(String pInput)
          Determine the full set of prefixes that can be extracted from the given word.
protected  Map<String,String> getMap()
           
 String lookup(String pKey)
           
protected static Collection<String> selectAll(Pattern pPattern, Collection<String> pStrings)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

P_MULTIPLE

protected static final Pattern P_MULTIPLE
Constructor Detail

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.
Method Detail

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.