|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.endeca.navigation.analytics.FilterCompare
public class FilterCompare
A FilterCompare is a type of Filter that
performs a value comparison. The FilterCompare object
is then set in a Statement object with the
Statement.setHavingFilter(com.endeca.navigation.analytics.Filter) or Statement.setWhereFilter(com.endeca.navigation.analytics.Filter)
methods.
A typical use of this class is to compare the value of an Endeca property or dimension to a specified literal value. This can be considered as a programmatic equivalent of the SQL HAVING and WHERE clauses. For example, this text-based syntax snippet:
RETURN Reps AS
WHERE Region = 'West'
can be expressed programmatically as:
Statement reps = new Statement();
reps.setName("Reps");
reps.setWhereFilter(new FilterCompare("Region", FilterCompare.EQ, "West"));
A FilterCompare can also be used to determine if
the value of an Endeca property or dimension is null or non-null.
| Nested Class Summary | |
|---|---|
static class |
FilterCompare.FilterCompareOp
Enumeration of Endeca comparison operators. |
| Field Summary | |
|---|---|
static FilterCompare.FilterCompareOp |
DVAL
DVAL operator. |
static FilterCompare.FilterCompareOp |
EQ
EQUAL TO operator. |
static FilterCompare.FilterCompareOp |
GT
GREATER THAN operator. |
static FilterCompare.FilterCompareOp |
GTE
GREATER THAN OR EQUAL TO operator. |
static FilterCompare.FilterCompareOp |
IS_NOT_NULL
NON-NULL operator. |
static FilterCompare.FilterCompareOp |
IS_NULL
NULL operator. |
static FilterCompare.FilterCompareOp |
LT
LESS THAN operator. |
static FilterCompare.FilterCompareOp |
LTE
LESS THAN OR EQUAL TO operator. |
static FilterCompare.FilterCompareOp |
NEQ
NOT EQUAL TO operator. |
| Constructor Summary | |
|---|---|
FilterCompare(String fieldName,
FilterCompare.FilterCompareOp function,
String value)
Creates a new FilterCompare object. |
|
| Method Summary | |
|---|---|
String |
getFieldName()
Gets the fieldName for this FilterCompare. |
FilterCompare.FilterCompareOp |
getFunction()
Gets the comparison function for this FilterCompare. |
String |
getValue()
Gets the comparison value for this FilterCompare. |
void |
setFieldName(String fieldName)
Sets the name of the Endeca property or dimension for this FilterCompare. |
void |
setFunction(FilterCompare.FilterCompareOp function)
Sets the comparison function for this FilterCompare. |
void |
setValue(String value)
Sets the comparison value for this FilterCompare. |
String |
toString()
Returns the string form of this this FilterCompare. |
String |
toWire()
Returns the wire form of this FilterCompare. |
void |
validateSyntax()
Validates the syntax of this FilterCompare. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final FilterCompare.FilterCompareOp EQ
fieldName is
equal to the value of the value parameter.
public static final FilterCompare.FilterCompareOp NEQ
fieldName is
not equal to the value of the value parameter.
public static final FilterCompare.FilterCompareOp LT
fieldName is
less than the value of the value parameter.
public static final FilterCompare.FilterCompareOp LTE
fieldName is
less than or equal to the value of the value parameter.
public static final FilterCompare.FilterCompareOp GT
fieldName is
greater than the value of the value parameter.
public static final FilterCompare.FilterCompareOp GTE
fieldName is
greater than or equal to the value of the value parameter.
public static final FilterCompare.FilterCompareOp IS_NULL
fieldName is null. The
value parameter is ignored.
public static final FilterCompare.FilterCompareOp IS_NOT_NULL
fieldName is non-null. The
value parameter is ignored.
public static final FilterCompare.FilterCompareOp DVAL
value parameter.
| Constructor Detail |
|---|
public FilterCompare(String fieldName,
FilterCompare.FilterCompareOp function,
String value)
FilterCompare object.
The FilterCompare compares the value
for the Endeca property or dimension fieldName to the value
specified by value using the function specified
by function.
The filter evaluates to true for a given record if the specified
comparison function evaluates to true when applied to the value for
fieldName from the record (lhs) and the specified
value (rhs). For example, if fieldName is "Price"
and the record has a Price of 1.00, and the function is
FilterCompare.LT and value
is 2.00, then the filter would evaluate to true.
fieldName - the name of an Endeca property or dimension. The value
of fieldName will be compared to the literal value
of the value parameter. Note that this value is ignored
for the FilterCompare.DVAL function.function - a comparison function of type FilterCompare.FilterCompareOp.
See the setFunction method for a list of the
comparison function names.value - a literal value to be compared to the value of fieldName.
For the FilterCompare.DVAL function, this value specifies the
ID of a dimension value.
Note that this value is ignored for the FilterCompare.IS_NULL
and FilterCompare.IS_NOT_NULL functions.| Method Detail |
|---|
public String getFieldName()
fieldName for this FilterCompare.
fieldName setting for this FilterCompare.public void setFieldName(String fieldName)
FilterCompare.
The value of this field will either be tested for a null value or will be
compared to the value parameter.
Note that this value is ignored for the FilterCompare.DVAL operator.
fieldName - the name of an Endeca property or dimension.public FilterCompare.FilterCompareOp getFunction()
FilterCompare.
FilterCompare.FilterCompareOp)
for this FilterCompare.
See the setFunction method for a list of the
comparison function names.public void setFunction(FilterCompare.FilterCompareOp function)
FilterCompare.
Comparison functions specify the type of comparison to be performed
on the fieldName or between the fieldName
and the value parameters.
Note that the FilterCompare.DVAL operator is used
to filter records that are tagged with a dimension value with an ID specified by the
value parameter.
function - a comparison function (of type FilterCompare.FilterCompareOp)
that specifies the type of comparison to be made.
The comparison functions are: FilterCompare.EQ,
FilterCompare.NEQ, FilterCompare.LT,
FilterCompare.LTE, FilterCompare.GT,
FilterCompare.GTE, FilterCompare.IS_NULL,
FilterCompare.IS_NOT_NULL, and FilterCompare.DVAL.public String getValue()
FilterCompare.
public void setValue(String value)
FilterCompare.
This value will be compared to the value of the fieldName,
using the specified comparison function. For the FilterCompare.DVAL operator,
value specifies the ID of the dimension value that will
be used to filter records.
Note that this value is ignored for the FilterCompare.IS_NULL
and FilterCompare.IS_NOT_NULL functions.
value - A literal value to be compared.public String toString()
FilterCompare. These are of the format:
("fieldName" "compare-function" 'compare-value')Note that compare-value is not returned for the
FilterCompare.IS_NULL
and FilterCompare.IS_NOT_NULL functions.
For the FilterCompare.DVAL function, the format is:
(DVAL("value")
For example:
("SalesTotal" "FilterCompare.GT" '10000')
is returned if the property name is "SalesTotal" and a GREATER THAN
comparison is being made to the value of 10000.
toString in interface QueryNodetoString in class ObjectFilterCompare in the specified format.public String toWire()
FilterCompare. This method is not
intended for public use because the wire format is subject to change.
toWire in interface QueryNodeFilterCompare.
public void validateSyntax()
throws SyntaxException
FilterCompare.
A FilterCompare is valid if the function
is non-null and the
fieldName and value are non-null and non-empty.
validateSyntax in interface QueryNodeSyntaxException - if the syntax requirements are not satisfied.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||