Package org.kigalisim.engine.number
Class EngineNumber
java.lang.Object
org.kigalisim.engine.number.EngineNumber
Representation of a number with units within the engine.
This class encapsulates a numeric value (using BigDecimal for precision) and its associated units string. It provides methods to access the value, units, and check for specific unit types.
-
Constructor Summary
ConstructorsConstructorDescriptionEngineNumber(double value, String units) Create a new number with units from a double value.EngineNumber(BigDecimal value, String units) Create a new number with units. -
Method Summary
-
Constructor Details
-
EngineNumber
Create a new number with units.- Parameters:
value- The numeric value as a BigDecimalunits- The units to associate with this value like "kg"
-
EngineNumber
Create a new number with units from a double value.This constructor converts the double to BigDecimal for internal storage.
- Parameters:
value- The numeric value as a doubleunits- The units to associate with this value like "kg"
-
-
Method Details
-
getValue
Get the value of this number.- Returns:
- Value as a BigDecimal
-
getUnits
Get the units associated with this number.- Returns:
- The units as a string like "mt"
-
hasEquipmentUnits
public boolean hasEquipmentUnits()Check if this number has equipment units.- Returns:
- true if the units represent equipment units (start with "unit")
-
toString
Return a string representation of this number with its value and units.
-