|
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.RangeCondition
public final class RangeCondition
RangeCondition
checks if the measured data value
is within the defined range.
RangeCondition
encapsulates information about the range,
i.e.,
the lower and the upper limit, and the operators for both ends.
Four types of ranges can be defined with the operators:
The construction of the corresponding RangeCondition
objects is displayed below:
new RangeCondition(lowerLimit, Condition.OP_GREATER_THAN, upperLimit, Condition.OP_LESS_THAN);
ConditionListener
will be notified when
lowerLimit < value < upperLimit
new RangeCondition(lowerLimit, Condition.OP_GREATER_THAN_OR_EQUALS, upperLimit, Condition.OP_LESS_THAN_OR_EQUALS);
ConditionListener
will be notified when
lowerLimit <= value <= upperLimit
new RangeCondition(lowerLimit, Condition.OP_GREATER_THAN_OR_EQUALS, upperLimit, Condition.OP_LESS_THAN);
ConditionListener
will be notified when
lowerLimit <= value < upperLimit
new RangeCondition(lowerLimit, Condition.OP_GREATER_THAN, upperLimit, Condition.OP_LESS_THAN_OR_EQUALS);
ConditionListener
will be notified when
lowerLimit < value <= upperLimit
If the Channel
, where this Condition
is to be set, uses scaling, the limit values should be given in
the scaled format, too. See method ChannelInfo.getScale()
for
more details.
RangeCondition
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 | |
---|---|
RangeCondition(double lowerLimit,
java.lang.String lowerOp,
double upperLimit,
java.lang.String upperOp)
The constructor of RangeCondition object. |
Method Summary | |
---|---|
double |
getLowerLimit()
Returns the lower limit of the monitored range, which is the same value as that set in the constructor. |
java.lang.String |
getLowerOp()
Returns the operator checking the lower limit, which is the same value as that set in the constructor. |
double |
getUpperLimit()
Returns the upper limit of the monitored range, which is the same value as that set in the constructor. |
java.lang.String |
getUpperOp()
Returns operator checking the upper limit, which is the same value as that set in the constructor. |
boolean |
isMet(double doubleValue)
The method tests if the doubleValue given as a parameter is within the given range. |
boolean |
isMet(java.lang.Object value)
The method tests if the value given as a parameter is within the given range. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RangeCondition(double lowerLimit, java.lang.String lowerOp, double upperLimit, java.lang.String upperOp)
The constructor of RangeCondition
object.
Valid values for lowerOp are:
Invalid combinationsx are:
lowerLimit
- the lower limit of the rangelowerOp
- the comparison operator used to check the
measured value against lower limit of the range.upperLimit
- the upper limit of the rangeupperOp
- the comparison operator used to check the
measured value against the upper limit of the range.
java.lang.IllegalArgumentException
- if either the
limits or operators are not valid, see above.Method Detail |
---|
public final double getLowerLimit()
Returns the lower limit of the monitored range, which is the same value as that set in the constructor.
public final java.lang.String getLowerOp()
Returns the operator checking the lower limit, which is the same value as that set in the constructor.
public final double getUpperLimit()
Returns the upper limit of the monitored range, which is the same value as that set in the constructor.
public final java.lang.String getUpperOp()
Returns operator checking the upper limit, which is the same value as that set in the constructor.
public boolean isMet(double doubleValue)
The method tests if the doubleValue given as a parameter is within the given range.
isMet
in interface Condition
doubleValue
- the measured data value, which is checked against
this RangeCondition
object
true
if the RangeCondition
is
met, false
otherwisepublic boolean isMet(java.lang.Object value)
The method tests if the value given as a parameter is within the given range.
isMet
in interface Condition
value
- the measured data value as Object
, which is checked against
the condition
false
always.
The ObjectCondition
is the Condition
to be used with the Object
data type.
|
Mobile Sensor API Version 1.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |