|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectucar.units.UnitID
ucar.units.UnitName
public final class UnitName
Provides support for unit names.
Constructor Summary | |
---|---|
protected |
UnitName(String name,
String symbol)
Constructs from a name and a symbol. |
protected |
UnitName(String name,
String plural,
String symbol)
Constructs from a name, a plural form of the unit name, and a symbol. |
Method Summary | |
---|---|
int |
compareTo(Object object)
Compares this UnitName with another UnitName. |
boolean |
equals(Object object)
Indicates if this UnitName is semantically identical to an object. |
String |
getName()
Returns the name. |
String |
getPlural()
Returns the plural form of the unit name. |
String |
getSymbol()
Returns the symbol. |
int |
hashCode()
Returns the hash code of this instance. |
protected String |
makePlural(String name)
Returns the plural form of a name. |
static UnitName |
newUnitName(String name)
Factory method for constructing a UnitName from a name. |
static UnitName |
newUnitName(String name,
String plural)
Factory method for constructing a UnitName from a name and a plural form of the name. |
static UnitName |
newUnitName(String name,
String plural,
String symbol)
Factory method for constructing a UnitName from a name, a plural form of the name, and a symbol. |
String |
toString()
Returns the string representation of this identifier. |
Methods inherited from class ucar.units.UnitID |
---|
newUnitID |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected UnitName(String name, String symbol) throws NameException
name
- The name of the unit. Shall not be
null
.symbol
- The symbol for the unit. May be null
.
NameException
- name == null
.protected UnitName(String name, String plural, String symbol) throws NameException
name
- The name of the unit. Shall not be
null
.plural
- The plural form of the name. May be
null
, in which
case regular plural- forming rules are used to construct the
plural form from the name.symbol
- The symbol for the unit. May be null
.
NameException
- name == null
.Method Detail |
---|
public static UnitName newUnitName(String name) throws NameException
name
- The name of the unit. Shall not be
null
.
NameException
- name == null
.public static UnitName newUnitName(String name, String plural) throws NameException
name
- The name of the unit. Shall not be
null
.plural
- The plural form of the name. May be
null
, in which
case regular plural- forming rules are used to construct the
plural form from the name.
NameException
- name == null
.public static UnitName newUnitName(String name, String plural, String symbol) throws NameException
name
- The name of the unit. Shall not be
null
.plural
- The plural form of the name. May be
null
, in which
case regular plural- forming rules are used to construct the
plural form from the name.symbol
- The symbol for the unit. May be null
.
NameException
- name == null
.public final String getName()
getName
in class UnitID
null
.public String getPlural()
getPlural
in class UnitID
public final String getSymbol()
getSymbol
in class UnitID
null
.public final String toString()
toString
in class UnitID
public final int compareTo(Object object)
compareTo
in interface Comparable<Object>
public final boolean equals(Object object)
equals
in class Object
public int hashCode()
hashCode
in class Object
protected String makePlural(String name)
name
- The name.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |