ar.com.ktulu.dict.strategies
Class PrefixStrategy

java.lang.Object
  |
  +--ar.com.ktulu.dict.strategies.Strategy
        |
        +--ar.com.ktulu.dict.strategies.PrefixStrategy

public class PrefixStrategy
extends Strategy

Matches words using the work searched for as a prefix of the words in the database.

Author:
Luis Parravicini

Constructor Summary
PrefixStrategy()
           
 
Method Summary
 java.lang.String asSQL(java.lang.String word)
          Support for SQL.
 java.util.ArrayList getMatches(java.lang.String word, Key[] keys)
          Returns an array of results for headwords matching word.
 
Methods inherited from class ar.com.ktulu.dict.strategies.Strategy
getInfo, getMatches, getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrefixStrategy

public PrefixStrategy()
Method Detail

getMatches

public java.util.ArrayList getMatches(java.lang.String word,
                                      Key[] keys)
Description copied from class: Strategy
Returns an array of results for headwords matching 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.

Specified by:
getMatches in class Strategy
See Also:
Key

asSQL

public java.lang.String asSQL(java.lang.String word)
Description copied from class: Strategy
Support for SQL. If this strategy has support for SQL it should return a SQL expression to compare 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.
If it returns null, then if getMatches(String, String, Statement) gets called it will throw UnsupportedException.

Specified by:
asSQL in class Strategy