Interface Dimension
public interface Dimension
Represents the physical dimension of a quantity.
A dimension is defined by the exponents of the seven SI base dimensions: Length (L), Mass (M), Time (T), Electric Current (I), Temperature (Θ), Amount of Substance (N), and Luminous Intensity (J).
Dimensions enable dimensional analysis - checking that equations are dimensionally consistent. For example:
Force = Mass × Acceleration [F] = [M] × [L][T]⻲ [F] = [M¹L¹T⻲]
Example Usage:
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DimensionAmount of substance dimension [N].static final DimensionDimensionless (alias for NONE).static final DimensionElectric current dimension [I].static final DimensionLength dimension [L].static final DimensionLuminous intensity dimension [J].static final DimensionMass dimension [M].static final DimensionDimensionless (no dimension) - all exponents are zero.static final DimensionTemperature dimension [Θ].static final DimensionTime dimension [T]. -
Method Summary
Modifier and TypeMethodDescriptionReturns the quotient of this dimension by another.intReturns the amount of substance exponent (N).intReturns the electric current exponent (I).intReturns the length exponent (L).intReturns the luminous intensity exponent (J).intReturns the mass exponent (M).intReturns the temperature exponent (Θ).intReturns the time exponent (T).default booleanChecks if this is a dimensionless quantity.Returns the product of this dimension with another.static Dimensionof(int length, int mass, int time, int electricCurrent, int temperature, int amountOfSubstance, int luminousIntensity) Creates a dimension with the specified exponents.pow(int exponent) Returns this dimension raised to the specified power.sqrt()Returns the square root of this dimension.
-
Field Details
-
NONE
Dimensionless (no dimension) - all exponents are zero. -
DIMENSIONLESS
Dimensionless (alias for NONE). -
LENGTH
Length dimension [L]. -
MASS
Mass dimension [M]. -
TIME
Time dimension [T]. -
ELECTRIC_CURRENT
Electric current dimension [I]. -
TEMPERATURE
Temperature dimension [Θ]. -
AMOUNT_OF_SUBSTANCE
Amount of substance dimension [N]. -
LUMINOUS_INTENSITY
Luminous intensity dimension [J].
-
-
Method Details
-
getLengthExponent
int getLengthExponent()Returns the length exponent (L).- Returns:
- the length exponent
-
getMassExponent
int getMassExponent()Returns the mass exponent (M).- Returns:
- the mass exponent
-
getTimeExponent
int getTimeExponent()Returns the time exponent (T).- Returns:
- the time exponent
-
getElectricCurrentExponent
int getElectricCurrentExponent()Returns the electric current exponent (I).- Returns:
- the electric current exponent
-
getTemperatureExponent
int getTemperatureExponent()Returns the temperature exponent (Θ).- Returns:
- the temperature exponent
-
getAmountOfSubstanceExponent
int getAmountOfSubstanceExponent()Returns the amount of substance exponent (N).- Returns:
- the amount of substance exponent
-
getLuminousIntensityExponent
int getLuminousIntensityExponent()Returns the luminous intensity exponent (J).- Returns:
- the luminous intensity exponent
-
multiply
-
divide
-
pow
Returns this dimension raised to the specified power.Raising to a power multiplies all exponents by the power.
- Parameters:
exponent- the exponent- Returns:
- the dimension raised to the power
-
sqrt
Dimension sqrt()Returns the square root of this dimension.All exponents must be even for the square root to be defined.
- Returns:
- the square root dimension
- Throws:
IllegalArgumentException- if any exponent is odd
-
isDimensionless
default boolean isDimensionless()Checks if this is a dimensionless quantity.- Returns:
- true if all exponents are zero
-
of
static Dimension of(int length, int mass, int time, int electricCurrent, int temperature, int amountOfSubstance, int luminousIntensity) Creates a dimension with the specified exponents.- Parameters:
length- length exponent (L)mass- mass exponent (M)time- time exponent (T)electricCurrent- electric current exponent (I)temperature- temperature exponent (Θ)amountOfSubstance- amount of substance exponent (N)luminousIntensity- luminous intensity exponent (J)- Returns:
- the dimension
-