Class Index | File Index

Classes


Class ilib.Measurement.Mass


Extends ilib.Measurement.
Create a new mass measurement instance.
Defined in: ilib-dyn-full.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Method Summary
Method Attributes Method Name and Description
<static>  
ilib.Measurement.Mass.convert(to, from, mass)
Convert a mass to another measure.
 
convert(to)
Return a new measurement instance that is converted to a new measurement unit.
 
Return the type of this measurement.
 
localize(locale)
Localize the measurement to the commonly used measurement in that locale.
 
scale(measurementsystem)
Scale the measurement unit to an acceptable level.
Methods borrowed from class ilib.Measurement:
getAmount, getOriginalUnit, getUnit, normalizeUnits
Class Detail
ilib.Measurement.Mass(options)
Parameters:
options
{{unit:string,amount:number|string|undefined}} Options controlling the construction of this instance
Method Detail
<static> {number|undefined} ilib.Measurement.Mass.convert(to, from, mass)
Convert a mass to another measure.
Parameters:
to
{string} unit to convert to
from
{string} unit to convert from
mass
{number} amount to be convert
Returns:
{number|undefined} the converted amount

{ilib.Measurement|undefined} convert(to)
Return a new measurement instance that is converted to a new measurement unit. Measurements can only be converted to measurements of the same type.

Parameters:
{string} to
The name of the units to convert to
Returns:
{ilib.Measurement|undefined} the converted measurement or undefined if the requested units are for a different measurement type

{string} getMeasure()
Return the type of this measurement. Examples are "mass", "length", "speed", etc. Measurements can only be converted to measurements of the same type.

The type of the units is determined automatically from the units. For example, the unit "grams" is type "mass". Use the static call ilib.Measurement.getAvailableUnits to find out what units this version of ilib supports.

Returns:
{string} the name of the type of this measurement

{ilib.Measurement} localize(locale)
Localize the measurement to the commonly used measurement in that locale. For example If a user's locale is "en-US" and the measurement is given as "60 kmh", the formatted number should be automatically converted to the most appropriate measure in the other system, in this case, mph. The formatted result should appear as "37.3 mph".
Parameters:
{string} locale
current locale string
Returns:
{ilib.Measurement} a new instance that is converted to locale

{ilib.Measurement} scale(measurementsystem)
Scale the measurement unit to an acceptable level. The scaling happens so that the integer part of the amount is as small as possible without being below zero. This will result in the largest units that can represent this measurement without fractions. Measurements can only be scaled to other measurements of the same type.
Parameters:
{string=} measurementsystem
system to use (uscustomary|imperial|metric), or undefined if the system can be inferred from the current measure
Returns:
{ilib.Measurement} a new instance that is scaled to the right level

Documentation generated by JsDoc Toolkit 2.4.0 on Tue Feb 02 2016 16:00:49 GMT-0800 (PST)