EnumValue
MimeEncodedText
Money
Quantity
DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!
Let us know so we can improve!
Represents the quantity of an item.
| Property | Description |
|---|---|
available: Boolean (read-only) | Identifies if the instance contains settings for value and unit. |
decimalValue: Decimal (read-only) | Returns the quantity as Decimal, null is returned when the quantity is not available. |
unit: String (read-only) | Returns the value for unit which identifies the unit of measure for the quantity. |
value: Number (read-only) | Returns the quantity value. |
| Constructor | Description |
|---|---|
| Quantity(Number, String) | Creates a new quantity instance with the specified value and unit. |
| Method | Description |
|---|---|
| add(Quantity) | Add Quantity object to the current object. |
| compareTo(Quantity) | Compares two Quantity values. |
| divide(Number) | Divide Quantity object by specified divisor. |
| equals(Object) | Compares two decimal values whether they are equivalent. |
| getDecimalValue() | Returns the quantity as Decimal, null is returned when the quantity is not available. |
| getUnit() | Returns the value for unit which identifies the unit of measure for the quantity. |
| getValue() | Returns the quantity value. |
| hashCode() | Calculates the hash code for a decimal. |
| isAvailable() | Identifies if the instance contains settings for value and unit. |
| isOfSameUnit(Quantity) | Identifies if two Quantities have the same unit. |
| multiply(Number) | Multiply Quantity object by specified factor. |
| newQuantity(Decimal) | Method returns a new instance of Quantity with the same unit but different value. |
| round(Number) | Rounds the Quantity value to the number of specified decimal digits. |
| subtract(Quantity) | Subtract Quantity object from the current object. |
| toString() | Returns a string representation of this quantity object. |
| valueOf() | According to the ECMA spec returns the “natural” primitive value. |
assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values
(read-only)Identifies if the instance contains settings for value and unit.
(read-only)Returns the quantity as Decimal, null is returned when the quantity is not available.
(read-only)Returns the value for unit which identifies the unit of measure for the quantity. Examples of unit are 'inches' or 'pounds'.
(read-only)Returns the quantity value.
See Also:
Creates a new quantity instance with the specified value and unit.
Parameters:
nullnullAdd Quantity object to the current object. Only objects representing the same unit can be added.
Parameters:
Returns:
Compares two Quantity values. An exception is thrown if the two Quantities values are of different unit. If one of the Quantity values represents the N/A value it is treated as 0.0.
Parameters:
Returns:
Divide Quantity object by specified divisor.
Parameters:
Returns:
Compares two decimal values whether they are equivalent.
Parameters:
Returns:
Returns the quantity as Decimal, null is returned when the quantity is not available.
Returns:
Returns the value for unit which identifies the unit of measure for the quantity. Examples of unit are 'inches' or 'pounds'.
Returns:
Returns the quantity value.
Returns:
See Also:
Calculates the hash code for a decimal.
Returns:
Identifies if the instance contains settings for value and unit.
Returns:
Identifies if two Quantities have the same unit.
Parameters:
Returns:
Multiply Quantity object by specified factor.
Parameters:
Returns:
Method returns a new instance of Quantity with the same unit but different value. An N/A instance is returned if value is null.
Parameters:
Returns:
Rounds the Quantity value to the number of specified decimal digits.
Parameters:
Returns:
Subtract Quantity object from the current object. Only objects representing the same unit can be subtracted.
Parameters:
Returns:
Returns a string representation of this quantity object.
Returns:
According to the ECMA spec returns the "natural" primitive value. Here the value portion of the Quantity is returned.