| java.lang.Object isql.ETabExpander
ETabExpander | public class ETabExpander implements ITabExpander(Code) | | This expander class expands a given word, based on a given data model.
This would typically be used by a Document, but could be used
from anywhere where Tab expansion is required.
This implementation uses a TabModel object which can be customized by
caller.
For convenience, a constructir with a String[] argument has been
created.
Following are examples of usage:
// MyTabModel implements TabModel with your custom data structure.
ETabExpander et = ETabExpander(new MyTabModel());
String exp = et.getNextExpansion(pattern);
// or
// myArray would be populated from a file or database
String myArray[] = new String[] {"abc","def", ...};
ETabExpander et = ETabExpander(myArray);
String exp = et.getNextExpansion(pattern);
// or
ETabExpander et = ETabExpander();
et.setModel(ETabExpander.createTabModel(myArray));
String exp = et.getNextExpansion(pattern);
author: rahul kumar, 2001 $Author: rahul_kumar $ author: $Id: ETabExpander.java,v 1.1 2003/12/24 15:15:03 rahul_kumar Exp $ |
ETabExpander | public ETabExpander()(Code) | | |
createTabModel | public static TabModel createTabModel(String[] sarr)(Code) | | conveneience method for createing a TabModel based on a String
array. May be used to initialize the Expander if constructed
without parameters, or just for updating model.
|
expand | public String expand(String patt, int index)(Code) | | expands the given pattern, returning the match at count
position. USer would start with 0, and continue till null is
returned.
|
getExpansions | public String[] getExpansions()(Code) | | returns all expansions for the previously searched pattern
|
getExpansions | public String[] getExpansions(String patt)(Code) | | returns expansions for the given string. Has no impact on
existing searches.
|
getModel | public TabModel getModel()(Code) | | returns the installed model, which may be updated by caller.
|
getNextExpansion | public String getNextExpansion(String patt)(Code) | | returns expansions for a string. Caller would just send in a
string and keep calling this until a null is returned.
Caller would either call getNextExpansion or expand, whatever
suits his needs better.
|
setTabTable | public void setTabTable(String[] tabs)(Code) | | sets the cache - required at start of program.
This is for backward compatib with earlier programs that used this, a
new developer would use setModel if he used the null constructor.
|
|
|