maspack.widgets
Class FormatRange

java.lang.Object
  extended by maspack.util.RangeBase
      extended by maspack.widgets.FormatRange
All Implemented Interfaces:
java.lang.Cloneable, Clonable, Range, Scannable

public class FormatRange
extends RangeBase


Field Summary
 
Fields inherited from interface maspack.util.Range
IllegalValue
 
Constructor Summary
FormatRange()
           
FormatRange(java.lang.String validChars)
           
 
Method Summary
 boolean isValid(java.lang.Object obj, StringHolder errMsg)
          Returns true if the specified object is valid for this Range, and false otherwise.
 void scan(ReaderTokenizer rtok, java.lang.Object ref)
          Scans this element from a ReaderTokenizer.
 void write(java.io.PrintWriter pw, NumberFormat fmt, java.lang.Object ref)
          Writes a text description of this element to a PrintWriter.
 
Methods inherited from class maspack.util.RangeBase
clone, intersect, isEmpty, isWritable, makeValid, setError
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormatRange

public FormatRange()

FormatRange

public FormatRange(java.lang.String validChars)
Method Detail

isValid

public boolean isValid(java.lang.Object obj,
                       StringHolder errMsg)
Description copied from class: RangeBase
Returns true if the specified object is valid for this Range, and false otherwise. If the object is not valid, and errMsg is not null, then errMsg.value should be set to a message describing why the object is not valid.

Specified by:
isValid in interface Range
Specified by:
isValid in class RangeBase
Parameters:
obj - Object to be testes
errMsg - Optional handle for storing error message
Returns:
true if the object is valid

scan

public void scan(ReaderTokenizer rtok,
                 java.lang.Object ref)
          throws java.io.IOException
Scans this element from a ReaderTokenizer. The expected text format is assumed to be compatible with that produced by write.

Specified by:
scan in interface Scannable
Overrides:
scan in class RangeBase
Parameters:
rtok - Tokenizer from which to scan the element
ref - optional reference object which can be used for resolving references to other objects
Throws:
java.io.IOException - if an I/O or formatting error occured

write

public void write(java.io.PrintWriter pw,
                  NumberFormat fmt,
                  java.lang.Object ref)
           throws java.io.IOException
Writes a text description of this element to a PrintWriter. The text description should be compatable with scan and complete enough to allow full reconstruction of the element.

Specified by:
write in interface Scannable
Overrides:
write in class RangeBase
Parameters:
pw - stream for writing the element
fmt - numeric formating information
ref - optional reference object which can be used for producing references to other objects
Throws:
java.io.IOException - if an I/O error occured