Package uk.ac.starlink.vo

## Class ValueConverter

- java.lang.Object
- - uk.ac.starlink.vo.ValueConverter

- Direct Known Subclasses:
    `ValueConverter.DMSDegreesValueConverter`, `ValueConverter.HMSDegreesValueConverter`, `ValueConverter.UnitValueConverter`

      public abstract class ValueConverter
      extends java.lang.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​(java.lang.String name)` | Constructor.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `abstract double` | `convertValue​(java.lang.String sval)` | Converts a string value to a numeric for this format
    `java.lang.String` | `getName()` | Returns format name.
    `java.lang.String` | `toString()` |
    `abstract java.lang.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​(java.lang.String name)

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

  - ### Method Detail

    - #### convertValue

          public abstract double convertValue​(java.lang.String sval)

      Converts a string value to a numeric for this format
      Parameters:
        `sval` - string value
      Returns:
        numeric equivalent of `sval`
      Throws:
        `java.lang.IllegalArgumentException` - if `sval` doesn't make sense to this converter

    - #### unconvertValue

          public abstract java.lang.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 java.lang.String getName()

      Returns format name.
      Returns:
        name

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`