edu.nrao.sss.measure
Class LinearVelocityUnits

java.lang.Object
  extended by edu.nrao.sss.measure.LinearVelocityUnits
All Implemented Interfaces:
Symbolic

public class LinearVelocityUnits
extends Object
implements Symbolic

Units of linear velocity.

Version Info:

$Revision: 1586 $
$Date: 2008-10-01 10:38:49 -0600 (Wed, 01 Oct 2008) $
$Author: dharland $ (last person to modify)

Since:
2006-03-31
Author:
David M. Harland

Field Summary
static LinearVelocityUnits KILOMETERS_PER_SECOND
          Kilometers per second.
static LinearVelocityUnits METERS_PER_SECOND
          Meters per second.
static LinearVelocityUnits Z
          A redshift measurement related to velocity.
 
Method Summary
 boolean equals(Object o)
          Returns true if o is equal to this units.
static LinearVelocityUnits from(DistanceUnits distanceUnits, TimeUnits timeUnits)
          Returns linear velocity units for the given distance and time units.
static LinearVelocityUnits fromString(String text)
          Returns the linear velocity units represented by text.
static LinearVelocityUnits getDefault()
          Returns a default unit of linear velocity.
 DistanceUnits getDistanceUnits()
          Returns the units of distance used by this unit of velocity.
static List<LinearVelocityUnits> getFrequentlyUsedUnits()
          Returns a list of frequently used velocity units.
 String getSymbol()
          Returns the symbol for this unit.
 TimeUnits getTimeUnits()
          Returns the units of time used by this unit of velocity.
 int hashCode()
          Returns a hash code for this units.
 String name()
          Returns the name of this unit.
 boolean symbolsAreCaseSensitive()
          Returns true if either the DistanceUnits or TimeUnits class has case-sensitive symbols.
static void throwBadUnitsText(String text, DistanceUnits du, TimeUnits tu)
           
 String toString()
          Returns a text representation of this unit of linear velocity.
 BigDecimal toUnits(LinearVelocityUnits otherUnits)
          Returns a factor for converting from this unit to otherUnits.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

METERS_PER_SECOND

public static final LinearVelocityUnits METERS_PER_SECOND
Meters per second.


KILOMETERS_PER_SECOND

public static final LinearVelocityUnits KILOMETERS_PER_SECOND
Kilometers per second.


Z

public static final LinearVelocityUnits Z
A redshift measurement related to velocity.

For more information on the relationship of z to velocity, see these references:

Method Detail

from

public static LinearVelocityUnits from(DistanceUnits distanceUnits,
                                       TimeUnits timeUnits)
Returns linear velocity units for the given distance and time units. Successive calls to this method with the same parameters will return the same object, not new equal objects.

Parameters:
distanceUnits - units of distance, the numerator for the returned velocity units.
timeUnits - units of time, the denominator for the returned velocity units.
Returns:
linear velocity units of distanceUnits per timeUnits.

getDefault

public static LinearVelocityUnits getDefault()
Returns a default unit of linear velocity.

Returns:
a default unit of linear velocity.

getFrequentlyUsedUnits

public static List<LinearVelocityUnits> getFrequentlyUsedUnits()
Returns a list of frequently used velocity units. This is a small subset of the total set of units that could be produced by all combinations of DistanceUnits and TimeUnits.

Returns:
a list of frequently used velocity units.

symbolsAreCaseSensitive

public boolean symbolsAreCaseSensitive()
Returns true if either the DistanceUnits or TimeUnits class has case-sensitive symbols.

Specified by:
symbolsAreCaseSensitive in interface Symbolic
Returns:
true if the case of the symbols carry meaning.

getDistanceUnits

public DistanceUnits getDistanceUnits()
Returns the units of distance used by this unit of velocity.

Returns:
the units of distance used by this unit of velocity.

getTimeUnits

public TimeUnits getTimeUnits()
Returns the units of time used by this unit of velocity.

Returns:
the units of time used by this unit of velocity.

toUnits

public BigDecimal toUnits(LinearVelocityUnits otherUnits)
Returns a factor for converting from this unit to otherUnits.

Parameters:
otherUnits - the unit to which conversion is desired.
Returns:
a factor for converting from this unit to otherUnits.

getSymbol

public String getSymbol()
Returns the symbol for this unit.

Specified by:
getSymbol in interface Symbolic
Returns:
the symbol for this unit.

name

public String name()
Returns the name of this unit. This method is here for historical reasons; it mimics the behavior this method had when this class had been an enum class. The toString() is a better alternative.

Returns:
the name of this unit.

toString

public String toString()
Returns a text representation of this unit of linear velocity.

Overrides:
toString in class Object
Returns:
a text representation of this unit of linear velocity.

fromString

public static LinearVelocityUnits fromString(String text)
Returns the linear velocity units represented by text.

Two basic formats for text are employed, both based on the text representations of the component distance and time units. The first is of the form distUnits.symbol / timeUnits.symbol. The amount of space surrounding the "/" separator is not material; zero or more spaces are allowed on either side of the separator. The second is of the form distUnits.name per timeUnits.name. The case of the separator "per" is not material. The same comment about whitespace given above applies here as well. The rules governing the format of the symbol or name of the component units are given in EnumerationUtility.enumFromString(Class, String).

Parameters:
text - a text representation of a unit of linear velocity.
Returns:
the linear velocity units represented by text.
Throws:
IllegalArgumentException - if text cannot be parsed to a valid units.

throwBadUnitsText

public static void throwBadUnitsText(String text,
                                     DistanceUnits du,
                                     TimeUnits tu)
                              throws IllegalArgumentException
Throws:
IllegalArgumentException

equals

public boolean equals(Object o)
Returns true if o is equal to this units.

Overrides:
equals in class Object

hashCode

public int hashCode()
Returns a hash code for this units.

Overrides:
hashCode in class Object


Copyright © 2009. All Rights Reserved.