The Quantity class represents an amount and UnitOfMeasure.
More...
|
def | __init__ (self, amount, uom) |
| Create a quantity with an amount and unit of measure. More...
|
|
def | __hash__ (self) |
|
def | __eq__ (self, other) |
|
def | __str__ (self) |
|
def | convert (self, toUOM) |
| Convert this quantity to the target UOM. More...
|
|
def | convertToPowerProduct (self, uom1, uom2) |
| Convert this quantity with a product or quotient unit of measure to the specified units of measure. More...
|
|
def | convertToPower (self, uom) |
| Convert this quantity of a power unit using the specified base unit of measure. More...
|
|
def | subtract (self, other) |
| Subtract a quantity from this quantity. More...
|
|
def | add (self, other) |
| Add two quantities. More...
|
|
def | divide (self, other) |
| Divide two quantities to create a third quantity. More...
|
|
def | divideByAmount (self, divisor) |
| Divide this quantity by the specified amount. More...
|
|
def | multiply (self, other) |
| Multiply this quantity by another quantity to create a third quantity. More...
|
|
def | multiplyByAmount (self, multiplier) |
| Multiply this quantity by the specified amount. More...
|
|
def | invert (self) |
| Invert this quantity, i.e. More...
|
|
def | compare (self, other) |
| Compare this quantity to the other quantity. More...
|
|
def | classify (self) |
| Find a matching unit type for the quantity's unit of measure. More...
|
|
The Quantity class represents an amount and UnitOfMeasure.
A constant quantity can be named and given a symbol, e.g. the speed of light.
◆ __init__()
def uom.quantity.Quantity.__init__ |
( |
|
self, |
|
|
|
amount, |
|
|
|
uom |
|
) |
| |
Create a quantity with an amount and unit of measure.
- Parameters
-
◆ add()
def uom.quantity.Quantity.add |
( |
|
self, |
|
|
|
other |
|
) |
| |
Add two quantities.
- Parameters
-
- Returns
- Sum Quantity
◆ classify()
def uom.quantity.Quantity.classify |
( |
|
self | ) |
|
Find a matching unit type for the quantity's unit of measure.
- Returns
- Quantity
◆ compare()
def uom.quantity.Quantity.compare |
( |
|
self, |
|
|
|
other |
|
) |
| |
Compare this quantity to the other quantity.
- Parameters
-
- Returns
- -1 if less than, 0 if equal and 1 if greater than
◆ convert()
def uom.quantity.Quantity.convert |
( |
|
self, |
|
|
|
toUOM |
|
) |
| |
Convert this quantity to the target UOM.
- Parameters
-
- Returns
- Converted quantity
◆ convertToPower()
def uom.quantity.Quantity.convertToPower |
( |
|
self, |
|
|
|
uom |
|
) |
| |
Convert this quantity of a power unit using the specified base unit of measure.
- Parameters
-
- Returns
- Converted quantity
◆ convertToPowerProduct()
def uom.quantity.Quantity.convertToPowerProduct |
( |
|
self, |
|
|
|
uom1, |
|
|
|
uom2 |
|
) |
| |
Convert this quantity with a product or quotient unit of measure to the specified units of measure.
- Parameters
-
- Returns
- Converted quantity
◆ createAmountFromString()
def uom.quantity.Quantity.createAmountFromString |
( |
|
value | ) |
|
|
static |
Create an amount of a quantity that adheres to precision and rounding settings from a Number.
- Parameters
-
- Returns
- Amount
◆ divide()
def uom.quantity.Quantity.divide |
( |
|
self, |
|
|
|
other |
|
) |
| |
Divide two quantities to create a third quantity.
- Parameters
-
- Returns
- Quotient Quantity
◆ divideByAmount()
def uom.quantity.Quantity.divideByAmount |
( |
|
self, |
|
|
|
divisor |
|
) |
| |
Divide this quantity by the specified amount.
- Parameters
-
- Returns
- Quantity Quantity
◆ invert()
def uom.quantity.Quantity.invert |
( |
|
self | ) |
|
Invert this quantity, i.e.
1 divided by this quantity to create another quantity
- Returns
- Quantity
◆ multiply()
def uom.quantity.Quantity.multiply |
( |
|
self, |
|
|
|
other |
|
) |
| |
Multiply this quantity by another quantity to create a third quantity.
- Parameters
-
- Returns
- Multiplied quantity
◆ multiplyByAmount()
def uom.quantity.Quantity.multiplyByAmount |
( |
|
self, |
|
|
|
multiplier |
|
) |
| |
Multiply this quantity by the specified amount.
- Parameters
-
- Returns
- Quantity Quantity
◆ subtract()
def uom.quantity.Quantity.subtract |
( |
|
self, |
|
|
|
other |
|
) |
| |
Subtract a quantity from this quantity.
- Parameters
-
- Returns
- New quantity
The documentation for this class was generated from the following file: