com.sun.labs.minion.query
Class Relation

java.lang.Object
  extended by com.sun.labs.minion.query.Element
      extended by com.sun.labs.minion.query.Relation
Direct Known Subclasses:
StringRelation

public class Relation
extends Element

A class for a simple relational query, like price < 10. Such queries can be run on any field that has the SAVED attribute. While this class can be used for simple relations on string fields, StringRelation provides the full set of relational operators that can be applied to string fields.

Note that this API cannot currently check whether the field provided for the relation is a saved field. This will be checked when the query is evaluated and a warning provided then.


Nested Class Summary
static class Relation.Operator
          The saved field operators.
 
Field Summary
protected  java.lang.String field
           
protected  Relation.Operator operator
           
protected  java.lang.String value
           
 
Fields inherited from class com.sun.labs.minion.query.Element
fields, strict
 
Constructor Summary
protected Relation()
           
  Relation(java.lang.String field, Relation.Operator operator, java.lang.String value)
           
 
Method Summary
 java.lang.String getField()
           
 Relation.Operator getOperator()
           
 QueryElement getQueryElement()
          Transduces this query element into a "real" query element, one that can be evaluated by the search engine.
 java.lang.String getValue()
           
 java.lang.String toString()
           
 
Methods inherited from class com.sun.labs.minion.query.Element
addField, getFields, getStrict, setFields, setStrict
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

field

protected java.lang.String field

operator

protected Relation.Operator operator

value

protected java.lang.String value
Constructor Detail

Relation

protected Relation()

Relation

public Relation(java.lang.String field,
                Relation.Operator operator,
                java.lang.String value)
Method Detail

getField

public java.lang.String getField()

getOperator

public Relation.Operator getOperator()

getValue

public java.lang.String getValue()

getQueryElement

public QueryElement getQueryElement()
Description copied from class: Element
Transduces this query element into a "real" query element, one that can be evaluated by the search engine.

Specified by:
getQueryElement in class Element
Returns:
an evaluatable query element.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object