|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Range
An object representing the set of valid values that an object can have.
Field Summary | |
---|---|
static java.lang.Class |
IllegalValue
Special object to indicate an illegal value, |
Method Summary | |
---|---|
void |
intersect(Range r)
Intersects the set of valid values of this Range with those of another. |
boolean |
isEmpty()
Returns true if this range is empty - i.e., if there are no valid values. |
boolean |
isValid(java.lang.Object obj,
StringHolder errMsg)
Returns true if the specified object is valid for this Range, and false otherwise. |
java.lang.Object |
makeValid(java.lang.Object obj)
Projects an object to lie within the range allowed by this Range, if possible. |
Methods inherited from interface maspack.util.Scannable |
---|
isWritable, scan, write |
Methods inherited from interface maspack.util.Clonable |
---|
clone |
Field Detail |
---|
static final java.lang.Class IllegalValue
Method Detail |
---|
boolean isValid(java.lang.Object obj, StringHolder errMsg)
errMsg
is not null
, then errMsg.value
should
be set to a message describing why the object is not valid.
obj
- Object to be testeserrMsg
- Optional handle for storing error message
java.lang.Object makeValid(java.lang.Object obj)
obj
is already within the range, then
obj
should be returned unchanged. Otherwise, if it can be
projected to the range, then a new (projected) object should be
returned. Otherwise, if it cannot be projected, IllegalValue
should be returned.
In particular, projectToRange(obj) != obj
should
be a valid indication that the obj
is not within range.
obj
- object to be projected
null
.boolean isEmpty()
void intersect(Range r)
isEmpty()
should subsequently return true
.
r
- range to intersect with.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |