src.server
Class QueryParser

java.lang.Object
  extended bysrc.server.QueryParser

public class QueryParser
extends java.lang.Object

Handles all parsing of queries. Takes a query in swedish and tries to match the query to a specific operation.

Version:
2005-apr-27

Method Summary
 void addModuleQueryRule(ModuleQueryRule rule)
          Adds a new ServerQueryRule to the parser's list.
 void addModuleSettingRule(ModuleQueryRule rule)
          Adds a new ModuleQueryRule to the parser's settings list.
 void addServerQueryRule(ServerQueryRule rule)
          Adds a new ServerQueryRule to the parser's list.
static QueryParser getInstance()
           
 Package parseQuery(java.lang.String query, RecipientTag recipient)
          Parses a query into an unambigious query which is returned in the form of a package.
 void removeModuleQueryRule(ModuleQueryRule rule)
          Removes an existing ModuleQueryRule from the parser's list.
 void removeModuleSettingRule(ModuleQueryRule rule)
          Removes an existing ModuleQueryRule from the parser's settings list.
 void removeServerQueryRule(ServerQueryRule rule)
          Removes an existing ServerQueryRule from the parser's list.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static QueryParser getInstance()

parseQuery

public Package parseQuery(java.lang.String query,
                          RecipientTag recipient)
Parses a query into an unambigious query which is returned in the form of a package. Please note that if an error occurs then an ErrorPackage will be returned, otherwise a QueryPackage will be returned.

Parameters:
query - The query to parse.
recipient - The recipient tag to put on the resulting package.
Returns:
An package of a type depending on if an error occured or not.

addServerQueryRule

public void addServerQueryRule(ServerQueryRule rule)
Adds a new ServerQueryRule to the parser's list.

Parameters:
rule - The rule to add.

removeServerQueryRule

public void removeServerQueryRule(ServerQueryRule rule)
Removes an existing ServerQueryRule from the parser's list.

Parameters:
rule - The rule to remove.

addModuleQueryRule

public void addModuleQueryRule(ModuleQueryRule rule)
Adds a new ServerQueryRule to the parser's list.

Parameters:
rule - The rule to add.

removeModuleQueryRule

public void removeModuleQueryRule(ModuleQueryRule rule)
Removes an existing ModuleQueryRule from the parser's list.

Parameters:
rule - The rule to remove.

addModuleSettingRule

public void addModuleSettingRule(ModuleQueryRule rule)
Adds a new ModuleQueryRule to the parser's settings list. The rules in the settings list overrides the server's default setting rule.

Parameters:
rule - The rule to add.

removeModuleSettingRule

public void removeModuleSettingRule(ModuleQueryRule rule)
Removes an existing ModuleQueryRule from the parser's settings list.

Parameters:
rule - The rule to remove.