Class Units
java.lang.Object
org.episteme.core.measure.Units
Standard units of measurement.
Provides SI base units, derived units, and common non-SI units. All units follow UCUM (Unified Code for Units of Measure) conventions where applicable.
Example Usage:
import static org.episteme.core.measure.Units.*;
Quantity<Length> distance = Quantities.create(100, METER);
Quantity<Velocity> speed = Quantities.create(50, KILOMETER_PER_HOUR);
* @author Silvere Martin-Michiellot- Since:
- 1.0
- Author:
- Gemini AI (Google DeepMind)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Unit<ElectricCurrent> The SI unit of electric current: ampere (A).Atmosphere: 1 atm = 101325 PaBar: 1 bar = 100000 PaCalorie (thermochemical): 1 cal = 4.184 Jstatic final Unit<LuminousIntensity> The SI unit of luminous intensity: candela (cd).static final Unit<Temperature> Celsius: °C = K - 273.15 Since add(offset) means Value(Base) = Value(Derived) + Offset usually?Centimeter: 1 cm = 0.01 mstatic final Unit<ElectricCharge> Coulomb: C (electric charge). 1 C = 1 Aâ‹…sCubic meter: m³ (volume).Day: 1 d = 86400 sDegree: 1° = À/180 radElectronvolt: 1 eV ≈ 1.602×10⻹⹠Jstatic final Unit<Temperature> Fahrenheit: 0 F = 255.37 K (relative offset) + 255.37 step?static final Unit<ElectricCapacitance> Farad: F (capacitance).Foot: 1 ft = 0.3048 m (exactly)Alias for GRAMUS Liquid Gallon: 1 gal = 3.785411784 LGram: 1 g = 0.001 kgstatic final Unit<Inductance> Henry: H (inductance). 1 H = kgâ‹…m²/(s²⋅A²)Hertz: Hz (frequency). 1 Hz = 1/sHour: 1 h = 3600 sInch: 1 in = 0.0254 m (exactly)Joule: J (energy). 1 J = 1 kgâ‹…m²/s²static final Unit<Temperature> The SI unit of temperature: kelvin (K).Alias for KILOGRAMKilocalorie (food calorie): 1 kcal = 1000 calThe SI unit of mass: kilogram (kg).static final Unit<MassDensity> Kilogram per cubic meter: kg/m³ (density).Kilojoule: 1 kJ = 1000 JKilometer: 1 km = 1000 mKilometer per hour: km/h (velocity).Legacy Alias for KILOMETER_PER_HOUR (British spelling)Kilowatt-hour: kWh = 1000 WhAlias for KILOMETERKnot: 1 kn = 1852 m/hAlias for KILOMETER_PER_HOURLight-year: 1 ly ≈ 9.461×10¹âµ mLitre: 1 L = 0.001 m³Alias for METERMach: Speed of sound in air at 20°C ≈ 343.2 m/sThe SI unit of length: meter (m).Meter per second: m/s (velocity).Legacy Alias for METER_PER_SECONDstatic final Unit<Acceleration> Meter per second squared: m/s² (acceleration).Micrometer: 1 μm = 10âÂȉ¶ mMicrosecond: 1 μs = 10âÂȉ¶ sMile: 1 mi = 1609.344 mMiles per hour: mphLegacy Alias for MILE_PER_HOURMilligram: 1 mg = 10âÂȉ¶ kgMillimeter: 1 mm = 0.001 mMillimeter of mercury: 1 mmHg ≈ 133.322 PaMillisecond: 1 ms = 0.001 sMinute: 1 min = 60 sMinute (angle): 1' = 1°/60static final Unit<AmountOfSubstance> The SI unit of amount of substance: mole (mol).Alias for MILE_PER_HOURAlias for METER_PER_SECONDNanometer: 1 nm = 10âÂȉ¹ mNanosecond: 1 ns = 10âÂȉ¹ sNautical Mile: 1852 mNewton: N (force). 1 N = 1 kgâ‹…m/s²static final Unit<ElectricResistance> Ohm: Ω (electric resistance). 1 Ω = 1 V/Astatic final Unit<Dimensionless> Dimensionless unit: 1 (for ratios).Ounce: 1 oz = 0.028349523125 kgPascal: Pa (pressure). 1 Pa = 1 N/m² = 1 kg/(mâ‹…s²)static final Unit<Dimensionless> Percent unit: % = 1/100.Pound (mass): 1 lb = 0.45359237 kg (exactly)Pound per square inch: 1 psi ≈ 6894.76 PaRadian: rad (plane angle).Alias for SECONDThe SI unit of time: second (s).Second (angle): 1" = 1'/60Square meter: m² (area).static final Unit<Dimensionless> Steradian: sr (solid angle).Tonne (metric ton): 1 t = 1000 kgThe Unified Atomic Mass Unit: u (Dalton). 1 u = 1.66053906660e-27 kg.static final Unit<ElectricPotential> Volt: V (electric potential). 1 V = 1 W/A = 1 J/(Aâ‹…s)Watt: W (power). 1 W = 1 J/sWatt-hour: W*h = 3600 JWeek: 1 wk = 7 dYard: 1 yd = 0.9144 mJulian Year: 1 yr = 365.25 d -
Method Summary
-
Field Details
-
METER
-
KILOGRAM
-
UNIFIED_ATOMIC_MASS
-
SECOND
-
KELVIN
The SI unit of temperature: kelvin (K). -
CELSIUS
Celsius: °C = K - 273.15 Since add(offset) means Value(Base) = Value(Derived) + Offset usually? Let's test assumption: If 0 C = 273.15 K. If Val(K) = Val(C) + 273.15. then add(273.15). Previous code had -273.15 which implies Val(K) = Val(C) - 273.15. -
FAHRENHEIT
Fahrenheit: 0 F = 255.37 K (relative offset) + 255.37 step? Correct conversion chain K invalid input: '<'-> F: Val(K) = (Val(F) + 459.67) * 5/9 Val(K) = Val(F) * 5/9 + 255.372222... This corresponds to Mult(5/9) -> Add(255.372...). -
AMPERE
The SI unit of electric current: ampere (A). -
MOLE
The SI unit of amount of substance: mole (mol). -
CANDELA
The SI unit of luminous intensity: candela (cd). -
RADIAN
-
STERADIAN
Steradian: sr (solid angle). -
KILOMETER
-
CENTIMETER
-
MILLIMETER
-
MICROMETER
-
NANOMETER
-
GRAM
-
MILLIGRAM
-
TONNE
-
MINUTE
-
HOUR
-
DAY
-
WEEK
-
MILLISECOND
-
MICROSECOND
-
NANOSECOND
-
ONE
Dimensionless unit: 1 (for ratios). -
PERCENT
Percent unit: % = 1/100. -
SQUARE_METER
-
CUBIC_METER
-
KILOGRAM_PER_CUBIC_METER
Kilogram per cubic meter: kg/m³ (density). -
METER_PER_SECOND
-
KILOMETER_PER_HOUR
-
METERS_PER_SECOND_SQUARED
Meter per second squared: m/s² (acceleration). -
JOULE
-
KILOJOULE
-
WATT
-
WATT_HOUR
-
KILOWATT_HOUR
-
NEWTON
-
PASCAL
-
HERTZ
-
VOLT
Volt: V (electric potential). 1 V = 1 W/A = 1 J/(Aâ‹…s) -
COULOMB
Coulomb: C (electric charge). 1 C = 1 Aâ‹…s -
FARAD
Farad: F (capacitance). Simplified as C²⋅s²/(kg⋅m²) -
HENRY
Henry: H (inductance). 1 H = kg⋅m²/(s²⋅A²) -
OHM
Ohm: Ω (electric resistance). 1 Ω = 1 V/A -
INCH
-
FOOT
-
YARD
-
MILE
-
POUND
-
OUNCE
-
MILE_PER_HOUR
-
LITRE
-
GALLON_LIQUID_US
-
ATMOSPHERE
-
BAR
-
POUND_PER_SQUARE_INCH
-
MILLIMETRE_OF_MERCURY
-
CALORIE
-
KILOCALORIE
-
ELECTRON_VOLT
-
DEGREE_ANGLE
-
MINUTE_ANGLE
-
SECOND_ANGLE
-
YEAR
-
KNOT
-
LIGHT_YEAR
-
NAUTICAL_MILE
-
MACH
-
M
-
KM
-
KG
-
G
-
S
-
MPS
-
KPH
-
MPH
-
METERS_PER_SECOND
-
KILOMETRES_PER_HOUR
-
MILES_PER_HOUR
-
-
Method Details
-
parseUnit
Parses a unit from its symbol.- Parameters:
symbol- the unit symbol (e.g., "m", "kg", "m/s")- Returns:
- the unit corresponding to the symbol
- Throws:
IllegalArgumentException- if the symbol is not recognized
-