|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectsrc.server.QueryRule
Describes a query rule, based on regexp. Queries can be checked against the query rule to see if they match. The rule also specifies what keys the result should have. An example: "What is todays lunch at Nymble?" could be turned into a map with keys "regexp" and "place" containing "lunch" and "Nymble" with a rule named "lunch"with the following pattern: "lunch( at| in)? ([^ ?]+)" and the following keys 0=>"place".
| Constructor Summary | |
QueryRule(java.lang.String regexpPattern,
java.lang.String[] keys)
Constructor for QueryRule. |
|
| Method Summary | |
java.util.HashMap |
getResult(java.lang.String query)
Gets a query formatted according to the rule's settings. |
boolean |
matches(java.lang.String query)
Checks if a query matches the rule's pattern. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public QueryRule(java.lang.String regexpPattern,
java.lang.String[] keys)
regexpPattern - The regexp pattern which descibes what queries
that should match the rule.keys - The keys that should be used in the resulting map.| Method Detail |
public boolean matches(java.lang.String query)
query - The query to check.
public java.util.HashMap getResult(java.lang.String query)
query - The query to format.
public java.lang.String toString()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||