com.sun.labs.minion.retrieval.parser
Class Transformer

java.lang.Object
  extended by com.sun.labs.minion.retrieval.parser.Transformer
Direct Known Subclasses:
LuceneTransformer, StrictTransformer, WebTransformer

public abstract class Transformer
extends java.lang.Object

This class transforms the output of JavaCC into a tree of query elements that the query evaluator can understand. It's more than meets the eye.


Constructor Summary
Transformer()
           
 
Method Summary
static boolean isDoubleQuoted(java.lang.String str)
          Determines if a string is double quoted, that is, it begins and ends with a " character.
static boolean isQuoted(java.lang.String str)
          Determines if a string is a quoted string.
static boolean isSingleQuoted(java.lang.String str)
          Determines if a string is single quoted, that is, it begins and ends with a ' character.
abstract  QueryElement transformTree(SimpleNode root)
          Transforms an abstract syntax tree provided by JJTree+JavaCC into a tree of QueryElements that can be used by the query evaluator.
abstract  QueryElement transformTree(SimpleNode root, int defaultOperator)
          Transforms an abstract syntax tree provided by JJTree+JavaCC into a tree of QueryElements that can be used by the query evaluator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Transformer

public Transformer()
Method Detail

transformTree

public abstract QueryElement transformTree(SimpleNode root)
                                    throws java.text.ParseException
Transforms an abstract syntax tree provided by JJTree+JavaCC into a tree of QueryElements that can be used by the query evaluator.

Parameters:
root - the root node of the tree returned from the Parser
Returns:
the root node of a tree describing a query
Throws:
java.text.ParseException

transformTree

public abstract QueryElement transformTree(SimpleNode root,
                                           int defaultOperator)
                                    throws java.text.ParseException
Transforms an abstract syntax tree provided by JJTree+JavaCC into a tree of QueryElements that can be used by the query evaluator.

Parameters:
root - the root node of the tree returned from the Parser
defaultOperator - specified the default operator to use when no other operator is provided between terms in the query. Valid values are defined in the Searcher interface
Returns:
the root node of a tree describing a query
Throws:
java.text.ParseException

isQuoted

public static boolean isQuoted(java.lang.String str)
Determines if a string is a quoted string. If it starts and ends with ' or starts and ends with " then it is a quoted string.

Parameters:
str - the string to check
Returns:
true if the string is quoted

isDoubleQuoted

public static boolean isDoubleQuoted(java.lang.String str)
Determines if a string is double quoted, that is, it begins and ends with a " character.

Parameters:
str - the string to check
Returns:
true if the string is double quoted

isSingleQuoted

public static boolean isSingleQuoted(java.lang.String str)
Determines if a string is single quoted, that is, it begins and ends with a ' character.

Parameters:
str - the string to check
Returns:
true if the string is single quoted