数量/ Quantity模式 Slid before 1st Section Divider 随时间变化事物 (Things That 扩 Change with Time 模式 展 Unused 观察和 Section 测量模 Space 2
Slides before 1st Section Divider 随时间变化事物 (Things That Change with Time) 模式 数量/ Quantity模式 Unused Section Space 2 观察和 测量模式 Unused Section Space 3 Unused Section Space 4 Unused Section Space 1 扩展
观察和测量模式 徐迎晓 复旦大学软件学院 xuyingxiao@126.com
观察和测量模式 徐迎晓 复旦大学软件学院 xuyingxiao@126.com
数量/ Quantity ● class Person{ int height; int weight
数量/Quantity class Person{ int height; int weight; … }
Java中已有的 Number ●C| ass number Method Summary byte byte O Returns the value of the specified number as a byte. abstract double O double Returns the value of the specified number as a double abstract float value O float Returns the value of the specified number as a float abstract intValueO ant Returns the value of the specified number as an int abstract long Value long Returns the value of the specified number as a long. short shortValueO Returns the value of the specified number as a short
Java中已有的Number Class Number
Person height: Number weight: Number blood gl ucose le vel Number
数量 Person Quantit height: Quant amount. Number weight: Quantity units: Unit blood glucose level: Quantity
数量
Quantit amount: number unit: UnIt to[unit]: quanity to stinE
Quantity
● arithmetic
arithmetic
Java中已有的Unit o Currency Method Summary Strins getCurrencyCode() Gets the Iso 4217 currency code of this currency. getDefaultFractionDigitsO Gets the default number of fraction digits used with this currency. static Currensz getInst ance(Locale locale) Returns the Currency inst ance for the country of the given locale. static Currensz get Inst ance(String currency Code) Returns the Currency inst ance for the given currency code stran get Sobol( Gets the symbol of this currency for the default locale. Strins get Symbol(Localelocale Gets the symbol of this currency for the specified locale. Strins toString( Returns the iso 4217 currency code of this currency
Java中已有的Unit Currency
Money ● Money是数量的一种特殊实例
Money Money是数量的一种特殊实例