Package uk.ac.starlink.vo
Class ValueConverter
java.lang.Object
uk.ac.starlink.vo.ValueConverter
- Direct Known Subclasses:
ValueConverter.DMSDegreesValueConverter
,ValueConverter.HMSDegreesValueConverter
,ValueConverter.UnitValueConverter
Provides some way of converting a string value into a numeric.
A number of useful subclasses are provided.
- Since:
- 21 Dec 2004
- Author:
- Mark Taylor (Starlink)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Converter for degrees:minutes:seconds format.static class
Converter for hours:minute:seconds format.static class
ValueConverter class which scales by a given factor (represents a particular unit). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract double
convertValue
(String sval) Converts a string value to a numeric for this formatgetName()
Returns format name.toString()
abstract String
unconvertValue
(double dval) Converts a numeric value to a string value for this format.
-
Constructor Details
-
ValueConverter
Constructor.- Parameters:
name
- format name (suitable for display in a combo box)
-
-
Method Details
-
convertValue
Converts a string value to a numeric for this format- Parameters:
sval
- string value- Returns:
- numeric equivalent of sval
- Throws:
IllegalArgumentException
- if sval doesn't make sense to this converter
-
unconvertValue
Converts a numeric value to a string value for this format.- Parameters:
dval
- numeric value- Returns:
- string representation of dval
-
getName
Returns format name.- Returns:
- name
-
toString
-