Package org.parts3492.partslib
Class PARTsUnit
java.lang.Object
org.parts3492.partslib.PARTsUnit
PARTsUnit - A unit container to store and convert values.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
ConstructorsConstructorDescriptionPARTsUnit(double value, PARTsUnit.PARTsUnitType unitType) Create a new PARTsUnit. -
Method Summary
Modifier and TypeMethodDescriptionas(PARTsUnit.PARTsUnitType unitType) Converts current unit into the requested unit.doubleGets the absolute value as a double.Get the current unit type for an instance ofPARTsUnit.doublegetValue()Gets the raw value as a double.doubleto(PARTsUnit.PARTsUnitType unitType) Converts current unit into the requested unit.
-
Field Details
-
InchesToMeters
-
MetersToInches
-
DegreesToRadians
-
-
Constructor Details
-
PARTsUnit
Create a new PARTsUnit.- Parameters:
value- The initial value of the unit.unitType- The type that the initial value is currently in.
-
-
Method Details
-
getValue
public double getValue()Gets the raw value as a double.- Returns:
- The value as a double.
-
getMagnitude
public double getMagnitude()Gets the absolute value as a double.- Returns:
- The value as a double.
-
getUnitType
Get the current unit type for an instance ofPARTsUnit.- Returns:
- The unit type as a
PARTsUnitType.
-
to
Converts current unit into the requested unit.- Parameters:
unitType- The target unit.- Returns:
- Converted unit in double.
-
as
Converts current unit into the requested unit.- Parameters:
unitType- The targetPARTsUnitType.- Returns:
- The converted
PARTsUnit.
-