|
Mobile Sensor API Version 1.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.microedition.sensor.LimitCondition
public final class LimitCondition
LimitCondition
is a Condition
intended for
numeric data to set various kind of conditions.
The operator has an important role in defining the
LimitCondition
.
The meaning of the LimitCondition
can change totally by
changing the operator, for example, from OP_LESS_THAN
to
OP_GREATER_THAN
.
One of the following operators must be used:
Examples of setting LimitCondition
objects, where temperature
and pitch are Channel
objects.
temperature.addCondition(listener, new LimitCondition(50,Condition.GREATER_THAN));
Temperatures over 50 degrees are being notified.
The unit of the degree can be discovered by obtaining the
ChannelInfo
object and using the ChannelInfo.getUnit()
method.
pitch.addCondition(listener, new LimitCondition(-45, Condition.LESS_THAN)); pitch.addCondition(listener, new LimitCondition(45, Condition.GREATER_THAN));
The ConditionListener
of pitch
will be notified when value is < -45 or > 45.
If the Channel
, where this Condition
is to be set, uses scaling, the limit values should be given in the
scaled format. See method ChannelInfo.getScale()
for
more details.
LimitCondition
MUST be immutable.
Field Summary |
---|
Fields inherited from interface javax.microedition.sensor.Condition |
---|
OP_EQUALS, OP_GREATER_THAN, OP_GREATER_THAN_OR_EQUALS, OP_LESS_THAN, OP_LESS_THAN_OR_EQUALS |
Constructor Summary | |
---|---|
LimitCondition(double limit,
java.lang.String operator)
The constructor for creating a new LimitCondition
object instance. |
Method Summary | |
---|---|
double |
getLimit()
Returns the limit set in the constructor. |
java.lang.String |
getOperator()
Returns the comparison operator of the LimitCondition
set in the constructor. |
boolean |
isMet(double value)
Method tests if the value parameter meets the condition. |
boolean |
isMet(java.lang.Object value)
Method tests if the value given as a parameter meets the condition. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LimitCondition(double limit, java.lang.String operator)
The constructor for creating a new LimitCondition
object instance.
limit
- the limit value to be setoperator
- the operator defining the type of the condition
java.lang.NullPointerException
- if the operator is null
java.lang.IllegalArgumentException
- if the operator is none of the
operators listed in the class Condition
Method Detail |
---|
public final double getLimit()
Returns the limit set in the constructor.
public final java.lang.String getOperator()
Returns the comparison operator of the LimitCondition
set in the constructor.
public boolean isMet(double value)
Method tests if the value parameter meets the condition.
isMet
in interface Condition
value
- measured data value that is checked
true
if Condition
is met,
false
otherwisepublic boolean isMet(java.lang.Object value)
Method tests if the value given as a parameter meets the condition.
isMet
in interface Condition
value
- the measured data value as Object
that is checked
false
always, for Objects
ObjectCondition
should be used
|
Mobile Sensor API Version 1.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |