|
PySharp Units of Measure
Units of Measure in Python
|
The Quantity class represents an amount and UnitOfMeasure. More...
Public Member Functions | |
| __init__ (self, amount, uom) | |
| Create a quantity with an amount and unit of measure. | |
| __hash__ (self) | |
| __eq__ (self, other) | |
| __str__ (self) | |
| convert (self, toUOM) | |
| Convert this quantity to the target UOM. | |
| convertToPowerProduct (self, uom1, uom2) | |
| Convert this quantity with a product or quotient unit of measure to the specified units of measure. | |
| convertToPower (self, uom) | |
| Convert this quantity of a power unit using the specified base unit of measure. | |
| subtract (self, other) | |
| Subtract a quantity from this quantity. | |
| add (self, other) | |
| Add two quantities. | |
| divide (self, other) | |
| Divide two quantities to create a third quantity. | |
| divideByAmount (self, divisor) | |
| Divide this quantity by the specified amount. | |
| multiply (self, other) | |
| Multiply this quantity by another quantity to create a third quantity. | |
| multiplyByAmount (self, multiplier) | |
| Multiply this quantity by the specified amount. | |
| invert (self) | |
| Invert this quantity, i.e. | |
| compare (self, other) | |
| Compare this quantity to the other quantity. | |
| classify (self) | |
| Find a matching unit type for the quantity's unit of measure. | |
Static Public Member Functions | |
| createAmountFromString (value) | |
| Create an amount of a quantity that adheres to precision and rounding settings from a Number. | |
Public Attributes | |
| amount | |
| uom | |
The Quantity class represents an amount and UnitOfMeasure.
A constant quantity can be named and given a symbol, e.g. the speed of light.
| uom.quantity.Quantity.__init__ | ( | self, | |
| amount, | |||
| uom ) |
Create a quantity with an amount and unit of measure.
| amount | Amount |
| uom | UnitOfMeasure |
| uom.quantity.Quantity.add | ( | self, | |
| other ) |
| uom.quantity.Quantity.classify | ( | self | ) |
Find a matching unit type for the quantity's unit of measure.
Quantity | uom.quantity.Quantity.compare | ( | self, | |
| other ) |
Compare this quantity to the other quantity.
| other | Quantity |
| uom.quantity.Quantity.convert | ( | self, | |
| toUOM ) |
| uom.quantity.Quantity.convertToPower | ( | self, | |
| uom ) |
Convert this quantity of a power unit using the specified base unit of measure.
| uom | Base UnitOfMeasure |
| uom.quantity.Quantity.convertToPowerProduct | ( | self, | |
| uom1, | |||
| uom2 ) |
Convert this quantity with a product or quotient unit of measure to the specified units of measure.
| uom1 | Multiplier or dividend UnitOfMeasure |
| uom2 | Multiplicand or divisor UnitOfMeasure |
|
static |
Create an amount of a quantity that adheres to precision and rounding settings from a Number.
| number | Value |
| uom.quantity.Quantity.divide | ( | self, | |
| other ) |
| uom.quantity.Quantity.divideByAmount | ( | self, | |
| divisor ) |
| uom.quantity.Quantity.invert | ( | self | ) |
| uom.quantity.Quantity.multiply | ( | self, | |
| other ) |
Multiply this quantity by another quantity to create a third quantity.
| other | Quantity |
| uom.quantity.Quantity.multiplyByAmount | ( | self, | |
| multiplier ) |
Multiply this quantity by the specified amount.
| multiplier | Amount |
Quantity | uom.quantity.Quantity.subtract | ( | self, | |
| other ) |
Subtract a quantity from this quantity.
| other | quantity |