|
Copyright 2008 Motorola Inc. and Nokia Corporation. All Rights Reserved. Specification License |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.microedition.broadcast.esg.QueryComposer
public class QueryComposer
QueryComposer
allows database queries to be composed.
There are two types of queries that can be composed:
Compound queries:Query q1, q2, q3; q1 = QueryComposer.equivalent(CommonMetadataSet.SERVICE_NAME, "CNN"); q2 = QueryComposer.currentProgram(); q3 = QueryComposer.equivalent(CommonMetadataSet.PROGRAM_CONTENT_GENRE, StringAttribute.UNKNOWN_VALUE);
The resulting queries can be used inQuery cq; cq = QueryComposer.and(q2, QueryComposer.or(q1, QueryComposer.equivalent(CommonMetadataSet.PROGRAM_CONTENT_GENRE, "News")));
ServiceGuide
to query for matching programs, for example.
On some implementations, the performance on complex compound queries
can be slow.
Query rules are defined in
.
ServiceGuide
ServiceGuide
Method Summary | |
---|---|
static Query |
after(DateAttribute attribute,
java.util.Date value)
Generate a query to test if the attribute has a time value that's after the given value. |
static Query |
and(Query a,
Query b)
Generate a compound query that's the result of taking the logical "and" of the two given queries. |
static Query |
before(DateAttribute attribute,
java.util.Date value)
Generate a query to test if the attribute has a time value that's before the given value. |
static Query |
contains(StringAttribute attribute,
java.lang.String value)
Generate a query to test if the value of a string attribute contains a given substring. |
static Query |
currentProgram()
Generate a query to find the current broadcast programs. |
static Query |
equivalent(Attribute attribute,
java.lang.Object value)
Generate an equivalence query based on any types of attribute. |
static Query |
equivalent(NumericAttribute attribute,
double value)
Generate an equivalence query for numeric attributes. |
static Query |
greaterThan(NumericAttribute attribute,
double value)
Generate a query to test if the attribute has a value greater than the given value. |
static Query |
isTrue(BooleanAttribute attribute)
Generate a query to test if the given attribute has a boolean value that's true. |
static Query |
lessThan(NumericAttribute attribute,
double value)
Generate a query to test if the attribute has a value less than the given value. |
static Query |
not(Query a)
Generate a query that's the logical complement of the given query. |
static Query |
or(Query a,
Query b)
Generate a compound query that's the result of taking the logical "or" of the two given queries. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Query after(DateAttribute attribute, java.util.Date value)
attribute
- The attribute to test against.value
- The matching value to test.
null
.
java.lang.NullPointerException
- if any of the given arguments is null.public static Query and(Query a, Query b)
a
- The first queryb
- The second query
null
.
java.lang.NullPointerException
- if any of the given arguments is null.public static Query before(DateAttribute attribute, java.util.Date value)
attribute
- The attribute to test against.value
- The matching value to test.
null
.
java.lang.NullPointerException
- if any of the given arguments is null.public static Query contains(StringAttribute attribute, java.lang.String value)
attribute
- The attribute to test against.value
- The substring to be tested.
null
.
java.lang.IllegalArgumentException
- if the given String is empty.
java.lang.NullPointerException
- if any of the given arguments is null.public static Query currentProgram()
Date now = new Date(); Query q1 = QueryComposer.before(CommonMetadataSet.PROGRAM_START_TIME, now); Query q1e = QueryComposer.equivalent(CommonMetadataSet.PROGRAM_START_TIME, now); Query q2 = QueryComposer.after(CommonMetadataSet.PROGRAM_END_TIME, now); Query Q = QueryComposer.and(QueryComposer.or(q1, q1e), q2);Note that each time when
currentProgram
is called, a snapshot
of the current time (i.e. new Date()) is used to form the resulted query.
public static Query equivalent(Attribute attribute, java.lang.Object value)
attribute
- The attribute to test against.value
- The matching value to test.
null
.
java.lang.NullPointerException
- if any of the given arguments is null.
java.lang.IllegalArgumentException
- if attribute
is BooleanAttribute
and value
is not instance of Boolean
attribute
is DateAttribute
and value
is not instance of Date
attribute
is NumericAttribute
and value
is not instance of Integer
,
Long
, Float
, Double
or an instance of some other class supported by the implementation
that is used to present numeric data
attribute
is StringAttribute
and value
is not instance of String
public static Query equivalent(NumericAttribute attribute, double value)
Testing equivalence for double
values is precision-dependent. Two values that are closely matching
may not result in an equivalence due to precision errors.
Applications are advised to use a combination of
greaterThan
and lessThan
for more
controlled behavior.
attribute
- The numeric attribute to test against.value
- The matching numeric value to test.
null
.
java.lang.NullPointerException
- if any of the given NumericAttribute
is null.public static Query greaterThan(NumericAttribute attribute, double value)
attribute
- The attribute to test against.value
- The matching value to test.
null
.
java.lang.NullPointerException
- if any of the given NumericAttribute
is null.public static Query isTrue(BooleanAttribute attribute)
attribute
- The attribute to test against.
null
.
java.lang.NullPointerException
- if the given argument is null.public static Query lessThan(NumericAttribute attribute, double value)
attribute
- The attribute to test against.value
- The matching value to test.
null
.
java.lang.NullPointerException
- if any of the given NumericAttribute
is null.public static Query not(Query a)
a
- The given query
null
.
java.lang.NullPointerException
- if the given argument is null.public static Query or(Query a, Query b)
a
- The first queryb
- The second query
null
.
java.lang.NullPointerException
- if any of the given arguments is null.
|
Copyright 2008 Motorola Inc. and Nokia Corporation. All Rights Reserved. Specification License |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |