uk.ac.starlink.vo
Class ValueConverter

java.lang.Object
  extended by uk.ac.starlink.vo.ValueConverter
Direct Known Subclasses:
ValueConverter.DMSDegreesValueConverter, ValueConverter.HMSDegreesValueConverter, ValueConverter.UnitValueConverter

public abstract class ValueConverter
extends Object

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
static class ValueConverter.DMSDegreesValueConverter
          Converter for degrees:minutes:seconds format.
static class ValueConverter.HMSDegreesValueConverter
          Converter for hours:minute:seconds format.
static class ValueConverter.UnitValueConverter
          ValueConverter class which scales by a given factor (represents a particular unit).
 
Constructor Summary
ValueConverter(String name)
          Constructor.
 
Method Summary
abstract  double convertValue(String sval)
          Converts a string value to a numeric for this format
 String getName()
          Returns format name.
 String toString()
           
abstract  String unconvertValue(double dval)
          Converts a numeric value to a string value for this format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ValueConverter

public ValueConverter(String name)
Constructor.

Parameters:
name - format name (suitable for display in a combo box)
Method Detail

convertValue

public abstract double convertValue(String sval)
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

public abstract String unconvertValue(double dval)
Converts a numeric value to a string value for this format.

Parameters:
dval - numeric value
Returns:
string representation of dval

getName

public String getName()
Returns format name.

Returns:
name

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.