Package ucar.units
Class Prefix
- java.lang.Object
-
- ucar.units.Prefix
-
- All Implemented Interfaces:
Comparable<Object>
- Direct Known Subclasses:
PrefixName,PrefixSymbol
@Immutable public abstract class Prefix extends Object implements Comparable<Object>
Provides support for unit prefixes (e.g. "centi", "c"). Instances of this class are immutable.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract intcompareTo(Object obj)Compares this prefix to another.abstract intcompareTo(String string)Compares this prefix to a string.StringgetID()Gets the prefix identifier.doublegetValue()Gets the prefix value.intlength()Return the length of the prefix identifier.StringtoString()Returns the string representation of this prefix.
-
-
-
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.
-
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:
compareToin interfaceComparable<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.
-
-