# Class Unit

java.lang.Object
uk.ac.starlink.ttools.plot2.layer.Unit

Direct Known Subclasses:
  `SolidAngleUnit, TimeUnit`

@Equality public class Unit extends Object
Defines a numeric factor corresponding to an extent on an axis. Functionally, this is just a labelled double precision value, but it has the semantics of a scaling factor along a plot axis.

Since:
  11 Jan 2018
Author:
  Mark Taylor

## Field Summary

Fields
Modifier and Type
Field
Description
`static final Unit`
`UNIT`
Unit instance with value of unity.

## Constructor Summary

Constructors
Constructor
Description
`Unit(String label, String textName, String symbol, double extent, String description)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`equals(Object o)`
`String`
`getDescription()`
Description text to be included in XML documentation.
`double`
`getExtent()`
Returns the extent along an axis in some externally-defined units represented by this object.
`String`
`getLabel()`
Returns the label, suitable for user interface selection.
`String`
`getSymbol()`
Returns the unit symbol, suitable for use in unit metadata.
`String`
`getTextName()`
Returns the name suitable for use in descriptive text.
`int`
`hashCode()`
`String`
`toString()`
Returns the label.

### Methods inherited from class Object

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

## Field Details

### UNIT

public static final Unit UNIT
Unit instance with value of unity.

## Constructor Details

### Unit

public Unit(String label, String textName, String symbol, double extent, String description)
Constructor.

Parameters:
  `label` - text to appear in a selection interface
  `textName` - text to appear in user-directed descriptive text
  `symbol` - text to appear as unit metadata, preferably compatible with the VOUnit standard
  `extent` - distance along an axis in some externally-defined units
  `description` - textual description to be included in XML

## Method Details

### getLabel

public String getLabel()
Returns the label, suitable for user interface selection.

Returns:
  label

### getTextName

public String getTextName()
Returns the name suitable for use in descriptive text.

Returns:
  text name

### getSymbol

public String getSymbol()
Returns the unit symbol, suitable for use in unit metadata.

Returns:
  symbol, preferably VOUnit-compatible

### getDescription

public String getDescription()
Description text to be included in XML documentation.

Returns:
  XML-friendly descriptive text

### getExtent

public double getExtent()
Returns the extent along an axis in some externally-defined units represented by this object.

Returns:
  extent

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### equals

public boolean equals(Object o)

Overrides:
  `equals` in class `Object`

### toString

public String toString()
Returns the label.

Overrides:
  `toString` in class `Object`