org.apache.oodt.cas.filemgr.structs
Class BooleanQueryCriteria

java.lang.Object
  extended by org.apache.oodt.cas.filemgr.structs.QueryCriteria
      extended by org.apache.oodt.cas.filemgr.structs.BooleanQueryCriteria
All Implemented Interfaces:
Cloneable

public class BooleanQueryCriteria
extends QueryCriteria

Version:
$Revision: 13181 $

A Boolean Query Citeria that allows combination of a number of terms into a query with a boolean operator (AND, OR, NOT). The NOT operator can only be applied to one term.

Author:
woollard, bfoster

Field Summary
static int AND
          Constants
static int NOT
           
static int OR
           
 
Constructor Summary
BooleanQueryCriteria()
          Default constructor.
BooleanQueryCriteria(List<QueryCriteria> terms, int op)
          Boolean query constructor.
 
Method Summary
 void addTerm(QueryCriteria t)
          Method to add a term to the boolean query.
 String getElementName()
          Method is not used in this class...
 int getOperator()
          Accessor method for the boolean operator.
 List<QueryCriteria> getTerms()
          Accessor method for the list of terms in the query.
 void setElementName(String elementName)
          Method is not used in this class...
 void setOperator(int op)
          Mutator method for the boolean operator.
 String toString()
          Method to convert the query to a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

AND

public static final int AND
Constants

See Also:
Constant Field Values

OR

public static final int OR
See Also:
Constant Field Values

NOT

public static final int NOT
See Also:
Constant Field Values
Constructor Detail

BooleanQueryCriteria

public BooleanQueryCriteria()
Default constructor. Uses the AND operator.


BooleanQueryCriteria

public BooleanQueryCriteria(List<QueryCriteria> terms,
                            int op)
                     throws QueryFormulationException
Boolean query constructor. This query is a boolean combination of term, range, and other boolean queries. The supported operators are AND, OR and NOT. Note that the NOT operator can only be used with one (1) term. This method throws the QueryFormulationException if more than one term is used with NOT.

Parameters:
terms - The criteria onto which to apply the boolean operator
op - The boolean operator to be applied
Throws:
QueryFormulationException
Method Detail

addTerm

public void addTerm(QueryCriteria t)
             throws QueryFormulationException
Method to add a term to the boolean query. Note that a NOT operator can only be applied to one term. Method throws the QueryFormulationException if this rule is violated.

Parameters:
t - Term to be added to the query
Throws:
QueryFormulationException

getTerms

public List<QueryCriteria> getTerms()
Accessor method for the list of terms in the query.

Returns:
The list of terms

setOperator

public void setOperator(int op)
                 throws QueryFormulationException
Mutator method for the boolean operator. Note that this method throws the QueryFormulationException if the operator is set to NOT and multiple terms are already defined.

Parameters:
op - Boolean operator
Throws:
QueryFormulationException

getOperator

public int getOperator()
Accessor method for the boolean operator.

Returns:
the boolean operator

getElementName

public String getElementName()
Method is not used in this class...

Specified by:
getElementName in class QueryCriteria
Returns:
The ElementName in the form of a String.

setElementName

public void setElementName(String elementName)
Method is not used in this class...

Specified by:
setElementName in class QueryCriteria

toString

public String toString()
Method to convert the query to a string.

Specified by:
toString in class QueryCriteria
Returns:
string equivement of the query


Copyright © 1999-2011 Apache OODT. All Rights Reserved.