ucar.units
Class Prefix

java.lang.Object
  extended by ucar.units.Prefix
All Implemented Interfaces:
Comparable<Object>
Direct Known Subclasses:
PrefixName, PrefixSymbol

public abstract class Prefix
extends Object
implements Comparable<Object>

Provides support for unit prefixes (e.g. "centi", "c"). Instances of this class are immutable.

Version:
$Id: Prefix.java 64 2006-07-12 22:30:50Z edavis $
Author:
Steven R. Emmerson

Constructor Summary
protected Prefix(String id, double value)
          Constructs from an identifier and a value.
 
Method Summary
abstract  int compareTo(Object obj)
          Compares this prefix to another.
abstract  int compareTo(String string)
          Compares this prefix to a string.
 String getID()
          Gets the prefix identifier.
 double getValue()
          Gets the prefix value.
 int length()
          Return the length of the prefix identifier.
 String toString()
          Returns the string representation of this prefix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Prefix

protected Prefix(String id,
                 double value)
Constructs from an identifier and a value.

Parameters:
id - The prefix identifier (e.g. "milli" or "m").
value - The prefix value (e.g. 1e-3).
Method Detail

getID

public final String getID()
Gets the prefix identifier.

Returns:
The prefix identifier.

toString

public final String toString()
Returns the string representation of this prefix.

Overrides:
toString in class Object
Returns:
The string representation of this prefix.

getValue

public final double getValue()
Gets the prefix value.

Returns:
The prefix value.

compareTo

public abstract int compareTo(Object obj)
Compares this prefix to another.

Specified by:
compareTo in interface Comparable<Object>
Parameters:
obj - The other prefix.
Returns:
A negative value, zero, or a positive value depending on whether this prefix is less than equal to, or greater than obj.

compareTo

public abstract int compareTo(String string)
Compares this prefix to a string.

Parameters:
string - The string.
Returns:
A negative value, zero, or a positive value depending on whether this prefix is less than equal to, or greater than the string.

length

public final int length()
Return the length of the prefix identifier.

Returns:
The length of the prefix identifier.


Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.