public class MeasureUnit
extends Object
implements Serializable
java.lang.Object | |
↳ | android.icu.util.MeasureUnit |
Known Direct Subclasses |
诸如长度,质量,体积,货币等的单位。单位与数字量相结合以产生度量。 MeasureUnit对象是不可变的。 所有的子类都必须保证。 (但是,不鼓励子类化。)
也可以看看:
Fields |
|
---|---|
public static final MeasureUnit |
ACRE 面积单位为常量:英亩 |
public static final MeasureUnit |
ACRE_FOOT 单位体积的常量:英亩 - 英尺 |
public static final MeasureUnit |
AMPERE 电单位常数:安培 |
public static final MeasureUnit |
ARC_MINUTE 角度单位的常量:弧分 |
public static final MeasureUnit |
ARC_SECOND 角度单位的常量:弧秒 |
public static final MeasureUnit |
ASTRONOMICAL_UNIT 长度单位常量:天文单位 |
public static final MeasureUnit |
BIT 数字单位常量:位 |
public static final MeasureUnit |
BUSHEL 单位量的常量:蒲式耳 |
public static final MeasureUnit |
BYTE 数字单元常量:字节 |
public static final MeasureUnit |
CALORIE 能量单位常量:卡路里 |
public static final MeasureUnit |
CARAT 质量单位常量:克拉 |
public static final MeasureUnit |
CELSIUS 温度单位常数:摄氏度 |
public static final MeasureUnit |
CENTILITER 单位体积的常量:centiliter |
public static final MeasureUnit |
CENTIMETER 长度单位常量:厘米 |
public static final MeasureUnit |
CUBIC_CENTIMETER 单位体积的常数:立方厘米 |
public static final MeasureUnit |
CUBIC_FOOT 单位体积的常量:立方英尺 |
public static final MeasureUnit |
CUBIC_INCH 单位体积的常数:立方英寸 |
public static final MeasureUnit |
CUBIC_KILOMETER 单位体积的常数:立方公里 |
public static final MeasureUnit |
CUBIC_METER 单位体积的常数:立方米 |
public static final MeasureUnit |
CUBIC_MILE 单位体积的常量:立方英里 |
public static final MeasureUnit |
CUBIC_YARD 单位体积的常数:立方码 |
public static final MeasureUnit |
CUP 体积单位常数:杯 |
public static final TimeUnit |
DAY 持续时间单位为常数:一天 |
public static final MeasureUnit |
DECILITER 单位体积的常量:分升 |
public static final MeasureUnit |
DECIMETER 长度单位的常量:分米 |
public static final MeasureUnit |
DEGREE 角度单位常数:度 |
public static final MeasureUnit |
FAHRENHEIT 温度单位常数:华氏度 |
public static final MeasureUnit |
FATHOM 长度单位的常数:fathom |
public static final MeasureUnit |
FLUID_OUNCE 体积单位常数:流体盎司 |
public static final MeasureUnit |
FOODCALORIE 单位能量的常数:foodcalorie |
public static final MeasureUnit |
FOOT 长度单位的常量:英尺 |
public static final MeasureUnit |
FURLONG 长度单位为常数:furlong |
public static final MeasureUnit |
GALLON 单位体积的常量:加仑 |
public static final MeasureUnit |
GIGABIT 数字单位常量:千兆位 |
public static final MeasureUnit |
GIGABYTE 数字单位常量:千兆字节 |
public static final MeasureUnit |
GIGAHERTZ 频率单位常数:千兆赫 |
public static final MeasureUnit |
GIGAWATT 单位功率常数:千兆瓦 |
public static final MeasureUnit |
GRAM 单位质量的常数:克 |
public static final MeasureUnit |
G_FORCE 加速度单位常数:重力 |
public static final MeasureUnit |
HECTARE 面积单位为常数:公顷 |
public static final MeasureUnit |
HECTOLITER 单位体积的常量:hectoliter |
public static final MeasureUnit |
HECTOPASCAL 压力单位常数:百帕斯卡 |
public static final MeasureUnit |
HERTZ 频率单位常数:赫兹 |
public static final MeasureUnit |
HORSEPOWER 功率单位常量:马力 |
public static final TimeUnit |
HOUR 持续时间单位为常数:小时 |
public static final MeasureUnit |
INCH 长度单位常数:英寸 |
public static final MeasureUnit |
INCH_HG 压力单位常数:英寸-Hg |
public static final MeasureUnit |
JOULE 能量单位常数:焦耳 |
public static final MeasureUnit |
KARAT 单位比例的常量:克拉 |
public static final MeasureUnit |
KELVIN 温度单位常数:开尔文 |
public static final MeasureUnit |
KILOBIT 数字单位常数:kilobit |
public static final MeasureUnit |
KILOBYTE 数字单位常量:千字节 |
public static final MeasureUnit |
KILOCALORIE 单位能量的常量:千卡 |
public static final MeasureUnit |
KILOGRAM 质量单位的常量:千克 |
public static final MeasureUnit |
KILOHERTZ 频率单位常数:千赫兹 |
public static final MeasureUnit |
KILOJOULE 单位能量的常量:千焦耳 |
public static final MeasureUnit |
KILOMETER 长度单位常量:公里 |
public static final MeasureUnit |
KILOMETER_PER_HOUR 速度单位常数:公里每小时 |
public static final MeasureUnit |
KILOWATT 单位功率常数:千瓦 |
public static final MeasureUnit |
KILOWATT_HOUR 单位能量的常量:千瓦小时 |
public static final MeasureUnit |
LIGHT_YEAR 长度单位常量:光年 |
public static final MeasureUnit |
LITER 单位体积的常量:升 |
public static final MeasureUnit |
LITER_PER_KILOMETER 单位消耗量的常数:每公里 |
public static final MeasureUnit |
LUX 灯光单位常数:勒克斯 |
public static final MeasureUnit |
MEGABIT 数字单位常量:兆位 |
public static final MeasureUnit |
MEGABYTE 数字单位常量:兆字节 |
public static final MeasureUnit |
MEGAHERTZ 频率单位常数:兆赫 |
public static final MeasureUnit |
MEGALITER 单位体积的常量:兆加仑 |
public static final MeasureUnit |
MEGAWATT 功率单位常数:兆瓦 |
public static final MeasureUnit |
METER 长度单位的常量:米 |
public static final MeasureUnit |
METER_PER_SECOND 速度单位的常量:米每秒 |
public static final MeasureUnit |
METER_PER_SECOND_SQUARED 加速度单位为常数:每秒平方米 |
public static final MeasureUnit |
METRIC_TON 质量单位的常量:公吨 |
public static final MeasureUnit |
MICROGRAM 质量单位的常数:微克 |
public static final MeasureUnit |
MICROMETER 长度单位常数:千分尺 |
public static final MeasureUnit |
MICROSECOND 单位持续时间的常量:微秒 |
public static final MeasureUnit |
MILE 长度单位的常量:英里 |
public static final MeasureUnit |
MILE_PER_GALLON 单位消耗量的常量:每加仑英里数 |
public static final MeasureUnit |
MILE_PER_HOUR 速度单位常数:每小时英里数 |
public static final MeasureUnit |
MILLIAMPERE 电单位常数:毫安 |
public static final MeasureUnit |
MILLIBAR 压力单位常数:毫巴 |
public static final MeasureUnit |
MILLIGRAM 质量单位的常量:毫克 |
public static final MeasureUnit |
MILLILITER 体积单位常数:毫升 |
public static final MeasureUnit |
MILLIMETER 长度单位常量:毫米 |
public static final MeasureUnit |
MILLIMETER_OF_MERCURY 压力单位常数:毫米汞柱 |
public static final MeasureUnit |
MILLISECOND 单位持续时间的常量:毫秒 |
public static final MeasureUnit |
MILLIWATT 功率单位常数:毫瓦 |
public static final TimeUnit |
MINUTE 持续时间单位为常数:分钟 |
public static final TimeUnit |
MONTH 持续时间单位的常量:月 |
public static final MeasureUnit |
NANOMETER 长度单位常数:纳米 |
public static final MeasureUnit |
NANOSECOND 单位持续时间的常量:纳秒 |
public static final MeasureUnit |
NAUTICAL_MILE 长度单位为常数:海里 - 英里 |
public static final MeasureUnit |
OHM 电单位常数:欧姆 |
public static final MeasureUnit |
OUNCE 质量单位的常量:盎司 |
public static final MeasureUnit |
OUNCE_TROY 质量单位的常量:盎司 - 特洛伊 |
public static final MeasureUnit |
PARSEC 长度单位的常量:parsec |
public static final MeasureUnit |
PICOMETER 长度单位为常数:皮米计 |
public static final MeasureUnit |
PINT 单位体积的常量:品脱 |
public static final MeasureUnit |
POUND 质量单位的常量:磅 |
public static final MeasureUnit |
POUND_PER_SQUARE_INCH 压力单位常数:磅/平方英寸 |
public static final MeasureUnit |
QUART 单位体积的常量:夸脱 |
public static final MeasureUnit |
RADIAN 角度单位常数:弧度 |
public static final TimeUnit |
SECOND 持续时间单位为常数:秒 |
public static final MeasureUnit |
SQUARE_CENTIMETER 面积单位常数:平方厘米 |
public static final MeasureUnit |
SQUARE_FOOT 面积单位为常数:平方英尺 |
public static final MeasureUnit |
SQUARE_INCH 面积单位为常数:平方英寸 |
public static final MeasureUnit |
SQUARE_KILOMETER 面积单位不变:平方千米 |
public static final MeasureUnit |
SQUARE_METER 面积单位为常数:平方米 |
public static final MeasureUnit |
SQUARE_MILE 面积单位为常数:平方英里 |
public static final MeasureUnit |
SQUARE_YARD 面积单位为常数:平方码 |
public static final MeasureUnit |
STONE 单位质量常数:石头 |
public static final MeasureUnit |
TABLESPOON 单位体积的常量:大汤匙 |
public static final MeasureUnit |
TEASPOON 单位体积的常量:茶匙 |
public static final MeasureUnit |
TERABIT 数字单位常量:太比特 |
public static final MeasureUnit |
TERABYTE 数字单位常量:兆兆字节 |
public static final MeasureUnit |
TON 单位质量常数:吨 |
public static final MeasureUnit |
VOLT 电单位常数:伏特 |
public static final MeasureUnit |
WATT 功率单位的常数:瓦特 |
public static final TimeUnit |
WEEK 持续时间单位的常量:周 |
public static final MeasureUnit |
YARD 长度单位常数:码 |
public static final TimeUnit |
YEAR 持续时间单位为常数:年 |
Public methods |
|
---|---|
boolean |
equals(Object rhs) 指示其他某个对象是否“等于”这一个。 |
static Set<MeasureUnit> |
getAvailable() 获取所有可用的单位。 |
static Set<MeasureUnit> |
getAvailable(String type) 对于给定的类型,返回可用的单位。 |
static Set<String> |
getAvailableTypes() 获取所有可用单位的类型。 |
String |
getSubtype() 获取子类型,例如“foot”。 |
String |
getType() 获取类型,如“长度” |
int |
hashCode() 返回对象的哈希码值。 |
String |
toString() 返回对象的字符串表示形式。 |
Inherited methods |
|
---|---|
From class java.lang.Object
|
boolean equals (Object rhs)
指示其他某个对象是否“等于”这一个。
equals
方法在非空对象引用上实现等价关系:
x
, x.equals(x)
should return true
. x
and y
, x.equals(y)
should return true
if and only if y.equals(x)
returns true
. x
, y
, and z
, if x.equals(y)
returns true
and y.equals(z)
returns true
, then x.equals(z)
should return true
. x
and y
, multiple invocations of x.equals(y)
consistently return true
or consistently return false
, provided no information used in equals
comparisons on the objects is modified. x
, x.equals(null)
should return false
. 对于类Object
的equals
方法实现了对象上最可能的等价关系; 也就是说,对于任何非空参考值x
和y
,当且仅当x
和y
引用同一对象( x == y
的值为true
)时,此方法返回true
。
请注意,无论何时覆盖此方法,通常都必须覆盖 hashCode
方法,以便维护 hashCode
方法的一般合同,该方法声明等同对象必须具有相同的哈希代码。
Parameters | |
---|---|
rhs |
Object : the reference object with which to compare. |
Returns | |
---|---|
boolean |
true if this object is the same as the obj argument; false otherwise. |
Set<MeasureUnit> getAvailable ()
获取所有可用的单位。 返回的集是不可修改的。
Returns | |
---|---|
Set<MeasureUnit> |
Set<MeasureUnit> getAvailable (String type)
对于给定的类型,返回可用的单位。
Parameters | |
---|---|
type |
String : the type |
Returns | |
---|---|
Set<MeasureUnit> |
the available units for type. Returned set is unmodifiable. |
Set<String> getAvailableTypes ()
获取所有可用单位的类型。 返回的集是不可修改的。
Returns | |
---|---|
Set<String> |
int hashCode ()
返回对象的哈希码值。 为了散列表的好处而支持此方法,例如由HashMap
提供的HashMap
。
一般合同 hashCode
是:
hashCode
method must consistently return the same integer, provided no information used in equals
comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application. equals(Object)
method, then calling the hashCode
method on each of the two objects must produce the same integer result. equals(java.lang.Object)
method, then calling the hashCode
method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables. 尽可能合理实用,类Object
定义的hashCode方法确实为不同的对象返回不同的整数。 (这通常通过将对象的内部地址转换为整数来实现,但Java TM编程语言不需要此实现技术。)
Returns | |
---|---|
int |
a hash code value for this object. |
String toString ()
返回对象的字符串表示形式。 一般来说, toString
方法会返回一个“文本表示”该对象的字符串。 结果应该是一个简洁但内容丰富的表述,对于一个人来说很容易阅读。 建议所有子类重写此方法。
类Object
的toString
方法返回一个字符串,其中包含对象为实例的类的名称,符号字符“ @
”以及对象的哈希代码的无符号十六进制表示形式。 换句话说,这个方法返回一个字符串,其值等于:
getClass().getName() + '@' + Integer.toHexString(hashCode())
Returns | |
---|---|
String |
a string representation of the object. |