## visad
Class PromiscuousUnit

    java.lang.Object
      visad.Unit
          visad.PromiscuousUnit

All Implemented Interfaces:
  Serializable

public class PromiscuousUnit
extends Unit

PromiscuousUnit is the VisAD class for units that are convertable with any other Unit.

See Also:
  Serialized Form

Field Summary
`(package private) static Unit` `promiscuous`

Fields inherited from class visad.Unit
`hashCode, hashCodeSet`

Method Summary
`Unit` `divide(PromiscuousUnit that)`
`Unit` `divide(Unit that)` Divide this unit by another unit.
`protected Unit` `divideInto(Unit that)` Divide this unit into another unit.
`boolean` `equals(Unit unit)` Indicates whether or not this instance is equal to a unit.
`String` `getDefinition()` Returns the definition of this unit.
`int` `hashCode()` Returns the hash code of this instance.
`boolean` `isConvertible(Unit unit)` Indicate whether this unit is convertible with another unit.
`boolean` `isDimensionless()` Indicates if this instance is dimensionless.
`Unit` `multiply(Unit that)` Multiply this unit by another unit.
`Unit` `pow(double power)` Raise a unit to a power.
`Unit` `pow(int power)` Raise this unit to a power.
`protected Unit` `protectedClone(String identifier)` Clones this unit, changing the identifier.
`Unit` `root(int root)` Returns the N-th root of this unit.
`double[]` `toThat(double[] values, Unit that)` Convert values from this unit to another unit.
`float[]` `toThat(float[] values, Unit that)` Convert values from this unit to another unit.
`double[]` `toThis(double[] values, Unit that)` Convert values to this unit from another unit.
`float[]` `toThis(float[] values, Unit that)` Convert values to this unit from another unit.

Methods inherited from class visad.Unit
`adjustCheckAndCache, canConvert, canConvertArray, clone, convertTuple, convertTuple, convertTuple, convertTuple, copyUnitsArray, equals, getAbsoluteUnit, getIdentifier, scale, scale, shift, sqrt, toString, toThat, toThat, toThat, toThis, toThis, toThis, transformUnits, transformUnits, transformUnits, transformUnits`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### promiscuous

    static final Unit promiscuous

Method Detail

### isDimensionless

    public boolean isDimensionless()

  Indicates if this instance is dimensionless. A unit is dimensionless if it is a measure of a dimensionless quantity like angle or concentration. Examples of dimensionless units include radian, degree, steradian, and "g/kg".

  This implementation always returns `false` because the typical use of this method is to determine whether or not a function of dimensionless values (e.g. sin(), log()) may be applied to values in this unit and such functions shouldn't be applied to values in this unit. Instead, the client should ensure that the values are in a true, dimensionless unit.

  Specified by:
    `isDimensionless` in class `Unit`
  Returns:
    True if an only if this unit is dimensionless.

### protectedClone

    protected Unit protectedClone(String identifier)
                           throws UnitException

  Clones this unit, changing the identifier. This method always throws an exception because promiscuous units may not be cloned.

  Specified by:
    `protectedClone` in class `Unit`
  Parameters:
    `identifier` - The name or abbreviation for the cloned unit. May be `null` or empty.
  Returns:
    A unit equal to this instance but with the given identifier.
  Throws:
    `UnitException` - Promiscuous units may not be cloned. Always thrown.

### getDefinition

    public String getDefinition()

  Returns the definition of this unit. For promiscuous units, this is the same as the identifier.

  Specified by:
    `getDefinition` in class `Unit`
  Returns:
    The definition of this unit. Won't be `null` but may be empty.

### pow

    public Unit pow(int power)

  Description copied from class: `Unit`
  Raise this unit to a power.

  Specified by:
    `pow` in class `Unit`
  Parameters:
    `power` - The power to raise this unit by.
  Returns:
    The resulting unit.

### root

    public Unit root(int root)

  Description copied from class: `Unit`
  Returns the N-th root of this unit.

  Specified by:
    `root` in class `Unit`
  Parameters:
    `root` - The root to take (e.g. 2 means square root). Must not be zero.
  Returns:
    The unit corresponding to the `root`-th root of this unit.

### pow

    public Unit pow(double power)

  Description copied from class: `Unit`
  Raise a unit to a power.

  Specified by:
    `pow` in class `Unit`
  Parameters:
    `power` - The power to raise this unit by. If this unit is not dimensionless, then the value must be integral.
  Returns:
    The unit resulting from raising this unit to `power`.

### multiply

    public Unit multiply(Unit that)

  Description copied from class: `Unit`
  Multiply this unit by another unit.

  Specified by:
    `multiply` in class `Unit`
  Parameters:
    `that` - The given unit to multiply this unit by.
  Returns:
    The resulting unit.

### divide

    public Unit divide(Unit that)
                throws UnitException

  Description copied from class: `Unit`
  Divide this unit by another unit.

  Specified by:
    `divide` in class `Unit`
  Parameters:
    `that` - The unit to divide into this unit.
  Returns:
    The quotient of the two units.
  Throws:
    `UnitException` - It's meaningless to divide these units.

### divide

    public Unit divide(PromiscuousUnit that)

### divideInto

    protected Unit divideInto(Unit that)
                       throws UnitException

  Description copied from class: `Unit`
  Divide this unit into another unit.

  Specified by:
    `divideInto` in class `Unit`
  Parameters:
    `that` - The unit to be divided by this unit.
  Returns:
    The quotient of the two units.
  Throws:
    `UnitException` - It's meaningless to divide these units.

### toThis

    public double[] toThis(double[] values,
                           Unit that)

  Description copied from class: `Unit`
  Convert values to this unit from another unit.

  Specified by:
    `toThis` in class `Unit`
  Parameters:
    `values` - Values in units of the other unit.
    `that` - The other unit.
  Returns:
    Values in this unit.

### toThat

    public double[] toThat(double[] values,
                           Unit that)

  Description copied from class: `Unit`
  Convert values from this unit to another unit.

  Specified by:
    `toThat` in class `Unit`
  Parameters:
    `values` - The values in this unit.
    `that` - The other unit.
  Returns:
    Values converted to the other unit from this unit.

### toThis

    public float[] toThis(float[] values,
                          Unit that)

  Description copied from class: `Unit`
  Convert values to this unit from another unit.

  Specified by:
    `toThis` in class `Unit`
  Parameters:
    `values` - Values in units of the other unit.
    `that` - The other unit.
  Returns:
    Values in this unit.

### toThat

    public float[] toThat(float[] values,
                          Unit that)

  Description copied from class: `Unit`
  Convert values from this unit to another unit.

  Specified by:
    `toThat` in class `Unit`
  Parameters:
    `values` - The values in this unit.
    `that` - The other unit.
  Returns:
    Values converted to the other unit from this unit.

### isConvertible

    public boolean isConvertible(Unit unit)

  Indicate whether this unit is convertible with another unit. A PromiscuousUnit is always convertible with another unit.

  Specified by:
    `isConvertible` in class `Unit`
  Parameters:
    `unit` - The other unit.
  Returns:
    True, always.

### equals

    public boolean equals(Unit unit)

  Description copied from class: `Unit`
  Indicates whether or not this instance is equal to a unit.

  Specified by:
    `equals` in class `Unit`
  Parameters:
    `unit` - The unit.
  Returns:
    `true` if and only if this instance equals the unit.

### hashCode

    public int hashCode()

  Returns the hash code of this instance. `Object.hashCode()` should be overridden whenever `Object.equals(Object)` is.

  Specified by:
    `hashCode` in class `Unit`
  Returns:
    The hash code of this instance (includes the values).