pipeline.domain.measures.LinearVelocity
- class LinearVelocity(value: int | float | Decimal = 0, units: dict = {'mps': Decimal('1000'), 'name': 'KILOMETERS_PER_SECOND', 'symbol': 'km/s'})[source]
Bases:
ComparableUnitMethods
Converts this measure of linear velocity to the new units.
Returns the magnitude of this linear velocity in otherUnits.
Attributes
valueunits- __init__(value: int | float | Decimal = 0, units: dict = {'mps': Decimal('1000'), 'name': 'KILOMETERS_PER_SECOND', 'symbol': 'km/s'}) None[source]
Create a new linear velocity with the given magnitude and units.
If called without arguments, the constructor will create a default linear velocity of 0 kilometres per second.
- Parameters:
value -- The magnitude for this linear velocity.
units -- The new units for this linear velocity.
- convert_to(newUnits: dict = {'mps': Decimal('1000'), 'name': 'KILOMETERS_PER_SECOND', 'symbol': 'km/s'}) LinearVelocity[source]
Converts this measure of linear velocity to the new units. After this method is complete this linear veloity will have units of units and its value will have been converted accordingly.
- Parameters:
newUnits -- The new units for this linear velocity. If newUnits is None an IllegalArgumentException will be thrown.
- Returns:
This linear velocity. The reason for this return type is to allow code of this nature:
velocity = myLinearVelocity.convert_to(LinearVelocityUnits.Z)
- to_units(otherUnits: dict = {'mps': Decimal('1000'), 'name': 'KILOMETERS_PER_SECOND', 'symbol': 'km/s'}) Decimal[source]
Returns the magnitude of this linear velocity in otherUnits.
Note that this method does not alter the state of this linear velocity. Contrast this with convert_to(LinearVelocityUnits).
- Parameters:
otherUnits -- The units in which to express this linear velocity's magnitude. If otherUnits is None an IllegalArgumentException will be thrown.
- Returns:
This linear velocity's value converted to otherUnits.