public final class UnitName extends UnitID implements Comparable<Object>
Modifier | Constructor and Description |
---|---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
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
.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()
public String getPlural()
public final String getSymbol()
public final String toString()
public final int compareTo(Object object)
compareTo
in interface Comparable<Object>
public final boolean equals(Object object)
public int hashCode()
Copyright © 1999–2016 UCAR/Unidata. All rights reserved.