org.egothor.core.query
Class Query

java.lang.Object
  extended by org.egothor.core.query.Query
Direct Known Subclasses:
QAnd, QGroup, QNot, QOr, QPhrase, QProx, QTerm

public abstract class Query
extends java.lang.Object

The Query class represents an inner form of a query or its subpart (AND, OR, NOT, etc.), while the binary form is represented by Runner. If you wish to define a new type of query you should extend this class.

Author:
Leo Galambos

Field Summary
static int MODEL_BOOLEAN
          Description of the Field
static int MODEL_FUZZY_M
          Description of the Field
static int MODEL_VECTOR
          Description of the Field
 
Constructor Summary
  Query()
          Constructor for the Query object
protected Query(boolean req, boolean proh)
          Constructor for the Query object
 
Method Summary
 void addTerms(java.util.HashSet<Token> to)
          Add the given HashSet of terms to this Query.
 Query applyCWI(CWI cwi)
          Return a new Query object with the given CWI applied.
 Runner attach(Rider r)
          This method creates a binary form of this query.
 org.w3c.dom.Node explain(org.w3c.dom.Document doc)
          Print out this query in an XML format.
 boolean getExcluded()
          Gets the excluded attribute of the Query object
 int getModel()
          Gets the model attribute of the Query object
abstract  java.lang.String getNodeName()
          Return the name of this query in an XML format produced by explain(org.w3c.dom.Document).
 boolean getProhibited()
          Gets the prohibited attribute of the Query object
 boolean getRequired()
          Gets the required attribute of the Query object
 boolean getUnknown()
          Gets the unknown attribute of the Query object
 boolean isRequiredOrProhibited()
          Test whether this query (without subparts) used prohibited or required flags.
 void setExcluded(boolean excluded)
          Sets the excluded attribute of the Query object
 void setModel(int model)
          Sets the model attribute of the Query object
 void setProhibited()
          Require the entire query to not be present in a document for it to be classified as a hit.
 void setRequired()
          Require the entire query to be present in a document for it to be classified as a hit.
 void setUnknown(boolean unknown)
          Sets the unknown attribute of the Query object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODEL_VECTOR

public static final int MODEL_VECTOR
Description of the Field

See Also:
Constant Field Values

MODEL_FUZZY_M

public static final int MODEL_FUZZY_M
Description of the Field

See Also:
Constant Field Values

MODEL_BOOLEAN

public static final int MODEL_BOOLEAN
Description of the Field

See Also:
Constant Field Values
Constructor Detail

Query

public Query()
Constructor for the Query object


Query

protected Query(boolean req,
                boolean proh)
Constructor for the Query object

Parameters:
req - set to true if the entire query is required for a hit
proh - set to true if the entire query should not be in a hit
Method Detail

setExcluded

public void setExcluded(boolean excluded)
Sets the excluded attribute of the Query object

Parameters:
excluded - The new excluded value

setModel

public void setModel(int model)
Sets the model attribute of the Query object

Parameters:
model - The new model value

setProhibited

public void setProhibited()
Require the entire query to not be present in a document for it to be classified as a hit.


setRequired

public void setRequired()
Require the entire query to be present in a document for it to be classified as a hit.


setUnknown

public void setUnknown(boolean unknown)
Sets the unknown attribute of the Query object

Parameters:
unknown - The new unknown value

getExcluded

public boolean getExcluded()
Gets the excluded attribute of the Query object

Returns:
The excluded value

getModel

public int getModel()
Gets the model attribute of the Query object

Returns:
The model value

getNodeName

public abstract java.lang.String getNodeName()
Return the name of this query in an XML format produced by explain(org.w3c.dom.Document).

Returns:
the name

getProhibited

public boolean getProhibited()
Gets the prohibited attribute of the Query object

Returns:
The prohibited value

getRequired

public boolean getRequired()
Gets the required attribute of the Query object

Returns:
The required value

isRequiredOrProhibited

public boolean isRequiredOrProhibited()
Test whether this query (without subparts) used prohibited or required flags.

Returns:
the value

getUnknown

public boolean getUnknown()
Gets the unknown attribute of the Query object

Returns:
The unknown value

explain

public org.w3c.dom.Node explain(org.w3c.dom.Document doc)
                         throws org.w3c.dom.DOMException
Print out this query in an XML format.

Parameters:
doc - Description of the Parameter
Returns:
Description of the Return Value
Throws:
org.w3c.dom.DOMException - Description of the Exception

attach

public Runner attach(Rider r)
This method creates a binary form of this query. That binary form is attached to the given Rider that gives access to an index.

Parameters:
r - the Rider
Returns:
a Runner (this implemenation returns null

addTerms

public void addTerms(java.util.HashSet<Token> to)
Add the given HashSet of terms to this Query.

Parameters:
to - a HashSet containing the terms to be added

applyCWI

public Query applyCWI(CWI cwi)
Return a new Query object with the given CWI applied.

Parameters:
cwi - the CWI
Returns:
a Query. When the CWI is null, it simply returns this object.