|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--ar.com.ktulu.dict.strategies.Strategy
Abstract base class for all strategies. Every strategy used by the server must extend from this class. If you want to create a new strategy all you have to do is:
super(String name,
String info) with the appropiate information. The strategy name must
be unique among all other strategies, as the server uses it as a key in a
hashtable.getMatches(String word, Key[] keys).asSQL(String) so your strategy can be used
with dictionaries stored in a database.
getMatches(String, Key[]),
asSQL(String)| Constructor Summary | |
protected |
Strategy(java.lang.String name,
java.lang.String info)
name is the name of the strategy, info
is a short description of this strategy. |
| Method Summary | |
protected abstract java.lang.String |
asSQL(java.lang.String word)
Support for SQL. |
java.lang.String |
getInfo()
Returns a short description of this strategy. |
abstract java.util.ArrayList |
getMatches(java.lang.String word,
Key[] keys)
Returns an array of results for headwords matching word. |
java.sql.ResultSet |
getMatches(java.lang.String word,
java.lang.String dict,
java.sql.Statement st)
Like getMatches(String, Key[]) but for dictionaries
stored in databases. |
java.lang.String |
getName()
Returns the name of this strategy. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
protected Strategy(java.lang.String name,
java.lang.String info)
name is the name of the strategy, info
is a short description of this strategy. All this info is used
by the server to respond to a "SHOW STRAT/STRATEGIES".
| Method Detail |
public java.lang.String getName()
public java.lang.String getInfo()
public abstract java.util.ArrayList getMatches(java.lang.String word,
Key[] keys)
throws DatabaseException
word.
If there are no matches it must return null. And every element of
the vector returned has to be an instance of ar.com.ktulu.dict.Key.
DatabaseExceptionKeyprotected abstract java.lang.String asSQL(java.lang.String word)
word against any
other word in the dictionary; e.g.: for the strategy "prefix" it
may return "UPPER(WORD) LIKE UPPER(word)||'%'", being
the first word the column name of the table in the database and the
second word the word to be searched.null, then if
getMatches(String, String, Statement) gets called it
will throw UnsupportedException.
public java.sql.ResultSet getMatches(java.lang.String word,
java.lang.String dict,
java.sql.Statement st)
throws DatabaseException,
java.lang.UnsupportedOperationException
getMatches(String, Key[]) but for dictionaries
stored in databases. All subclases have to do for this method
to work is to implement asSQL(String).
DatabaseException
java.lang.UnsupportedOperationExceptiongetMatches(String, Key[]),
asSQL(String)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||