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)
  • 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