public class WheelswitchFormatter
extends java.lang.Object
java.lang.String
s to be displayed as digits in the
Wheelswitch
. The format is specified in a format
java.lang.String
. WheelswitchFormatter
also
stores the value, its bounds (minimum and maximum) and also the unit
displayed by the Wheelswitch
.Modifier and Type | Field and Description |
---|---|
protected PrintfFormat |
defFormatter |
protected java.lang.String |
formatString |
protected PrintfFormat |
formatter |
protected java.lang.String |
generatedFormatString |
protected double |
maximum |
protected double |
minimum |
protected java.lang.String |
unit |
protected double |
value |
protected java.lang.String |
valueString |
Constructor and Description |
---|
WheelswitchFormatter()
Constructs the PlainWheelswitchFormatter with no format string.
|
WheelswitchFormatter(java.lang.String newFormatString)
Constructs the PlainWheelswitchFormatter and sets the format string.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
checkFormat(java.lang.String format)
Checks the number format string.
|
protected java.lang.String |
generateFormat() |
java.lang.String |
getFormat()
Gets the currently stored format string.
|
double |
getMaximum()
Gets the current maximum allowed value.
|
int |
getMaximumDigits()
Sets the maximum allowed number of digits to represent the value.
|
double |
getMinimum()
Gets the current minimum allowed value.
|
java.lang.String |
getString()
Gets the formatted string representing the currently stored value.
|
java.lang.String |
getUnit()
Returns the unit.
|
double |
getValue()
Gets the currently stored value.
|
void |
setFormat(java.lang.String newFormatString)
Sets the format string specifiing the format of
Wheelswitch
display. |
void |
setMaximum(double newMaximum)
Sets a new maximum allowed value.
|
void |
setMaximumDigits(int i)
Sets the maximum allowed number of digits to represent the value.
|
void |
setMinimum(double newMinimum)
Sets a new minimum allowed value.
|
void |
setString(java.lang.String newValueString)
DOCUMENT ME!
|
void |
setUnit(java.lang.String unit)
Sets the unit.
|
void |
setValue(double newValue)
Sets a new value and stores its formatted string.
|
static java.lang.String |
transformFormat(java.lang.String format)
A conviniance method for transforming between the Printf type format
strings and wheelswitch type format strings.
|
protected PrintfFormat defFormatter
protected PrintfFormat formatter
protected java.lang.String formatString
protected java.lang.String generatedFormatString
protected java.lang.String unit
protected java.lang.String valueString
protected double maximum
protected double minimum
protected double value
public WheelswitchFormatter(java.lang.String newFormatString)
newFormatString
- setFormat(String)
public WheelswitchFormatter()
setFormat(String)
public final void setFormat(java.lang.String newFormatString) throws java.lang.IllegalArgumentException
Wheelswitch
display. The format is first checked for validity by the
checkFormat(String)
method.newFormatString
- java.lang.IllegalArgumentException
- DOCUMENT ME!Double.parseDouble(String)
,
NumberFormatException
public java.lang.String getFormat()
public final void setMaximum(double newMaximum)
newMaximum
- DOCUMENT ME!public double getMaximum()
public final void setMinimum(double newMinimum)
newMinimum
- DOCUMENT ME!public double getMinimum()
public void setString(java.lang.String newValueString)
newValueString
- String representing the number to be formatted.public java.lang.String getString()
public void setValue(double newValue)
newValue
- DOCUMENT ME!getMaximum()
,
getMinimum()
public double getValue()
public static boolean checkFormat(java.lang.String format)
Double.parseDouble()
.format
- public static java.lang.String transformFormat(java.lang.String format)
format
- DOCUMENT ME!java.lang.NullPointerException
- DOCUMENT ME!java.lang.IllegalArgumentException
- DOCUMENT ME!public void setMaximumDigits(int i)
i
- public int getMaximumDigits()
public void setUnit(java.lang.String unit)
unit
- The unit to setpublic java.lang.String getUnit()
protected java.lang.String generateFormat()