com.iphrase.runtime.query.constraint
Class Numeric.Range
java.lang.Object
|
+--com.iphrase.runtime.query.Feature
|
+--com.iphrase.runtime.query.constraint.Constraint
|
+--com.iphrase.runtime.query.constraint.Numeric.Range
- Enclosing class:
- Numeric
- public static class Numeric.Range
- extends Constraint
Represent range-comparison Numeric constraints.
Method Summary |
java.lang.String |
getConstraintSubType()
Determine subType representation of the non-range inequality constraints |
java.lang.Object |
getValue()
Get the value associated with this constraint. |
boolean |
matches(Constraint c)
Determine whether this Constraint matches another. |
static Constraint |
newInstance(java.lang.String state)
Attempt to create a new Numeric.Range constraint from a OneStep serialization String . |
java.lang.String |
toString()
Serialize this constraint using the OneStep serialization format. |
Methods inherited from class com.iphrase.runtime.query.constraint.Constraint |
clearExplicit, clearHidden, clearNew, clearNotSerialized, clearPrePruned, clearRequired, clearState, equals, getConstraintLabel, getDisplayPrefix, getIsMentions, getState, getType, isExplicit, isHidden, isMentions, isNew, isNotSerialized, isPrePruned, isRangeConstraintType, isRequired, newInstance, newInstance, setExplicit, setHidden, setHidden, setNew, setNotSerialized, setPrePruned, setRequired, setState |
Methods inherited from class com.iphrase.runtime.query.Feature |
getId |
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Numeric.Range
public Numeric.Range(Numeric min,
Numeric max)
throws ArgumentError
- Construct a Numeric range constraint from two Numeric constraints.
Range comparisons come in four flavors, where n represents the feature
values that must satisify the inequality:
- x < n < y
- x <=n < y
- x < n <=y
- x <=n <=y
Here are the rules:
- Both Numeric arguments must constrain the same feature.
- If min (left side) is one of Numeric.{Lt,Lte} then max (right side)
must be one of Numeric.{Gt,Gte}.
- If min (left side) is one of Numeric.{Gt,Gte} then max (right side)
must be one of Numeric.{Lt,Lte}.
All other combinations will cause an ArgumentError exception to be thrown.
- Parameters:
min
- value for left side of the inequalitymax
- value for right side of the inequality- Throws:
ArgumentError
- for invalid min/max values
getValue
public java.lang.Object getValue()
- Get the value associated with this constraint.
Overrides
Constraint.getValue()
- Overrides:
getValue
in class Constraint
- Returns:
- Object value associated with this constraint
matches
public boolean matches(Constraint c)
- Determine whether this Constraint matches another.
- Overrides:
matches
in class Constraint
- Parameters:
c
- Constraint
to be matched against this- Returns:
true
if the two constraints are of the same type
and have identical fields except for their flags and label,
else false
.
toString
public java.lang.String toString()
- Serialize this constraint using the OneStep serialization format.
Overrides
Object.toString()
- Overrides:
toString
in class java.lang.Object
- Returns:
- OneStep serialization
String
of this constraint
getConstraintSubType
public java.lang.String getConstraintSubType()
- Determine subType representation of the non-range inequality constraints
- Overrides:
getConstraintSubType
in class Constraint
- Returns:
- subType - op, the values to return is: ""
newInstance
public static Constraint newInstance(java.lang.String state)
throws ArgumentError
- Attempt to create a new Numeric.Range constraint from a OneStep serialization
String
.
- Parameters:
state
- OneStep serialization String
- Returns:
- deserialized
Constraint
instance - Throws:
ArgumentError
-