|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.nite.search.Engine
public class Engine
Engine is the main component of NXT (NITE XML Toolkit) Search.
The most important methode is search(net.sourceforge.nite.search.SearchableCorpus, java.lang.String)
which could be interrupt()
. The result, a List of
Lists, could be flatten (cf. flattenListOfResults(java.util.List)
)
or converted into XML (cf. resultToXML(java.util.List)
).
For debugging the methodes showParseTree(java.lang.String, java.lang.String)
and showDNF(java.lang.String)
may be useful.
Constructor Summary | |
---|---|
Engine()
Creates a new search engine. |
Method Summary | |
---|---|
void |
addProgressListner(ProgressListener listener)
|
static void |
flattenListOfResults(java.util.List results)
Converts the result of search(...) into a flat list of lists. |
void |
interrupt()
Stops a running search task started by search(...). |
boolean |
isInterrupted()
Return true if interrupt() is executed after search(...). |
void |
removeProgressListner(ProgressListener listener)
|
static java.lang.String |
resultToXML(java.util.List result)
Returns a result converted to XML. |
static java.lang.String |
resultToXML(java.util.List result,
long max)
Returns a result converted to XML. |
java.util.List |
search(SearchableCorpus corpus,
java.lang.String query)
Finds all sets of elements refering to variables satisfing the query. |
java.util.List |
search(SearchableCorpus corpus,
java.lang.String query,
long max)
Finds maximum n sets of elements refering to variables satisfing the query. |
java.lang.String |
showDNF(java.lang.String query)
Shows the disjunctive normal form of the query. |
java.lang.String |
showParseTree(java.lang.String query,
java.lang.String prefix)
Sows the parsing tree of the query. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Engine()
Method Detail |
---|
public void interrupt()
interrupt
in interface Interruptable
public boolean isInterrupted()
interrupt()
is executed after search(...).
interrupt()
is executed after search(...).public java.util.List search(SearchableCorpus corpus, java.lang.String query) throws java.lang.Throwable
Parser
generated by
JavaCC.
Afterward all possible sets of elements refering to variables are generated
and tested against the query.net.sourceforge.nite.nomread.NOMElement
s. The complex query
"($a)($b):... :: ($c): ..." may return something like
corpus
- the corpus in which will be searchedquery
- the query string
java.lang.Throwable
- lexical or syntax error of parsing the query or running
out of memorypublic java.util.List search(SearchableCorpus corpus, java.lang.String query, long max) throws java.lang.Throwable
Parser
generated by
JavaCC.
Afterward possible sets of elements refering to variables are generated
and tested against the query until maximum n sets are found.net.sourceforge.nite.nomread.NOMElement
s. The complex query
"($a)($b):... :: ($c): ..." may return something like
corpus
- the corpus in which will be searchedquery
- the query stringmax
- the limit of returning results or if -1 unlimited
java.lang.Throwable
- lexical or syntax error of parsing the query or running
out of memorypublic void addProgressListner(ProgressListener listener)
addProgressListner
in interface Progressable
public void removeProgressListner(ProgressListener listener)
removeProgressListner
in interface Progressable
public java.lang.String showDNF(java.lang.String query) throws java.lang.Throwable
query
- the query string
java.lang.Throwable
- lexical or syntax error of parsing the querypublic java.lang.String showParseTree(java.lang.String query, java.lang.String prefix) throws java.lang.Throwable
Parser
generated by
JJTree and JavaCC.
The result of parsing is a tree which could be shown by this methode.
query
- the query stringprefix
- every line of return will start with this prefix
java.lang.Throwable
- lexical or syntax error of parsing the querypublic static void flattenListOfResults(java.util.List results)
result
- the result of search(...)public static java.lang.String resultToXML(java.util.List result)
result
- the result of search(...)
public static java.lang.String resultToXML(java.util.List result, long max)
result
- the result of search(...)max
- maximum of matches to convert
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |