- All Implemented Interfaces:
Serializable,Comparable<Power>,Constable,Dimension,DimensionWithLinearConversion
@ClassVersion(sourceVersion="$Id: Power.java 1073 2023-10-01 11:08:51Z tquadrat $")
@API(status=STABLE,
since="0.3.0")
public enum Power
extends Enum<Power>
implements DimensionWithLinearConversion
The various instances of power …
- Author:
- Thomas Thrien (thomas.thrien@tquadrat.org)
- Version:
- $Id: Power.java 1073 2023-10-01 11:08:51Z tquadrat $
- Since:
- 0.3.0
- UML Diagram
-
UML Diagram for "org.tquadrat.foundation.value.Power"
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionAn erg per second.A giga Watt.A 'horsepower'.A kilo Watt.A kilo Watt.A micro Watt.A milli Watt.A Tera Watt.A Watt. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BigDecimalThe factor.private final intThe default precision.private final StringThe unit string.Fields inherited from interface org.tquadrat.foundation.value.api.DimensionWithLinearConversion
MSG_UnknownUnit -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivatePower(BigDecimal factor, String unitSymbol) Creates a newPowerinstance, with a default precision of zero mantissa digits.privatePower(BigDecimal factor, String unitSymbol, int precision) Creates a newPowerinstance. -
Method Summary
Modifier and TypeMethodDescriptionfinal PowerbaseUnit()Returns the base unit.final BigDecimalfactor()Returns the factor that is used to convert a value from this unit to the base unit.static final PowerReturns thePowerinstance for the given unit symbol.final intReturns the default precision for this unit that is used when the respective value is converted to a String.final StringReturns the unit symbol for the dimension as a single line string.static PowerReturns the enum constant of this class with the specified name.static Power[]values()Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOfMethods inherited from interface org.tquadrat.foundation.value.api.Dimension
equals, name, toString, unitSymbolForPrintingMethods inherited from interface org.tquadrat.foundation.value.api.DimensionWithLinearConversion
fromBase, toBase
-
Enum Constant Details
-
ERG_PER_SECOND
An erg per second.
This is the unit of power in the CGS unit system.
-
MICROWATT
A micro Watt. -
MILLIWATT
A milli Watt. -
WATT
A Watt. -
HORSE_POWER
A 'horsepower'. -
KILOWATT
A kilo Watt. -
MEGAWATT
A kilo Watt. -
GIGAWATT
A giga Watt. -
TERAWATT
A Tera Watt.
-
-
Field Details
-
m_Factor
The factor. -
m_Precision
The default precision. -
m_UnitSymbol
The unit string.
-
-
Constructor Details
-
Power
Creates a newPowerinstance, with a default precision of zero mantissa digits.- Parameters:
factor- The factor.unitSymbol- The unit symbol String.
-
Power
Creates a newPowerinstance.- Parameters:
factor- The factor.unitSymbol- The unit symbol String.precision- The default precision.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
baseUnit
Returns the base unit.
E.g. for length, the base unit would be Meter (m), for mass, it is Kilogram (kg), and so on.
-
factor
Returns the factor that is used to convert a value from this unit to the base unit.
For length, if you have to convert a Centimeter value to Meter, you will divide that by 100 or multiply it with a factor of 0.01.
For the base unit, the factor is 1.0.
- Specified by:
factorin interfaceDimensionWithLinearConversion- Returns:
- The factor.
- See Also:
-
forUnit
Returns thePowerinstance for the given unit symbol.- Parameters:
unitSymbol- The unit symbol.- Returns:
- The respective instance.
- Throws:
IllegalArgumentException- The given unit is unknown.
-
getPrecision
Returns the default precision for this unit that is used when the respective value is converted to a String.- Specified by:
getPrecisionin interfaceDimension- Returns:
- The mantissa length for a value with this unit.
-
unitSymbol
Returns the unit symbol for the dimension as a single line string.
For a length, this would be "m", for a speed "km/h", and for an acceleration, it could be "m/(s^2)".
- Specified by:
unitSymbolin interfaceDimension- Returns:
- The unit.
-
