org.fosstrak.llrp.commander.util
Class LLRPRangeConstraint
java.lang.Object
org.fosstrak.llrp.commander.util.LLRPRangeConstraint
public class LLRPRangeConstraint
- extends java.lang.Object
This class represents an LLRP range constraint. It specifies that a certain numeric field value
must lie within some ranges.
- Author:
- Ulrich Etter, ETHZ
Constructor Summary |
LLRPRangeConstraint(java.lang.String messageOrParameterName,
java.lang.String fieldName,
Range[] ranges,
java.lang.String preconditionedEnumerationName,
java.lang.String preconditionedEnumerationValue)
Creates a new range constraint. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LLRPRangeConstraint
public LLRPRangeConstraint(java.lang.String messageOrParameterName,
java.lang.String fieldName,
Range[] ranges,
java.lang.String preconditionedEnumerationName,
java.lang.String preconditionedEnumerationValue)
- Creates a new range constraint.
Example:
To create a constraint that specifies that the field DurationPeriod
of the
parameter RFSurveySpecStopTrigger
must be greater than 0 if the enumeration
StopTriggerType
has value Duration
, use the following code:
new LLRPRangeConstraint(
"RFSurveySpecStopTrigger",
"DurationPeriod",
new Range[] {
new Range(1, Integer.MAX_VALUE)
},
"StopTriggerType",
"Duration");
- Parameters:
messageOrParameterName
- the name of the message/parameter this constraint is defined forfieldName
- the name of the field this constraint is defined forranges
- an array of ranges; for a value to satisfy a constraint it must lie in
one of this rangespreconditionedEnumerationName
- the name of the enumeration on which this constraint
is dependent; use null
if this constraint does not depend on any enumerationpreconditionedEnumerationValue
- the value of the enumeration on which this constraint
is dependent; use null
if this constraint does not depend on any enumeration
isSatisfied
public boolean isSatisfied(int fieldValue)
- Checks whether this constraint is satisfied by the given field value.
- Parameters:
fieldValue
- the field value to validate
- Returns:
true
if the constraint is satisfied, and false
otherwise
getErrorMessage
public java.lang.String getErrorMessage()
- Returns:
- the error message associated with this constraint
getMessageOrParameterName
public java.lang.String getMessageOrParameterName()
getFieldName
public java.lang.String getFieldName()
getPreconditionedEnumerationName
public java.lang.String getPreconditionedEnumerationName()
getPreconditionedEnumerationValue
public java.lang.String getPreconditionedEnumerationValue()
getDefaultValue
public int getDefaultValue()
- Returns:
- a default value for the field this constraint is specified for
Copyright © 2009. All Rights Reserved.