# Class ValueConverter

java.lang.Object
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

Nested Classes
Modifier and Type
Class
Description
`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

Constructors
Constructor
Description
`ValueConverter(String name)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`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 Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### ValueConverter

public ValueConverter(String name)
Constructor.

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

## Method Details

### 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`