public abstract class RangeBase extends java.lang.Object implements Range
IllegalValue| Constructor and Description |
|---|
RangeBase() |
| Modifier and Type | Method and Description |
|---|---|
RangeBase |
clone() |
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.
|
abstract boolean |
isValid(java.lang.Object obj,
StringHolder errMsg)
Returns true if the specified object is valid for this Range,
and false otherwise.
|
boolean |
isWritable()
Returns
true if this component should in fact be written to
secondary storage. |
java.lang.Object |
makeValid(java.lang.Object obj)
Projects an object to lie within the range allowed by this Range, if
possible.
|
void |
scan(ReaderTokenizer rtok,
java.lang.Object ref)
Scans this element from a ReaderTokenizer.
|
static void |
setError(StringHolder errMsg,
java.lang.String msg) |
void |
write(java.io.PrintWriter pw,
NumberFormat fmt,
java.lang.Object ref)
Writes a text description of this element to a PrintWriter.
|
public static void setError(StringHolder errMsg, java.lang.String msg)
public abstract 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.public 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, Range.IllegalValue
should be returned.
In particular, projectToRange(obj) != obj should
be a valid indication that the obj is not within range.
public boolean isEmpty()
public void intersect(Range r)
Range.isEmpty()
should subsequently return true.public void scan(ReaderTokenizer rtok, java.lang.Object ref) throws java.io.IOException
write.public boolean isWritable()
true if this component should in fact be written to
secondary storage. This gives subclasses control over whether or
not they are actually written out.isWritable in interface Scannabletrue if this component should be written to
secondary storage.public void write(java.io.PrintWriter pw,
NumberFormat fmt,
java.lang.Object ref)
throws java.io.IOException
scan and complete
enough to allow full reconstruction of the element.