Enum Class Energy
- All Implemented Interfaces:
Serializable, Comparable<Energy>, Constable, Dimension, DimensionWithLinearConversion
- Author:
- Thomas Thrien (thomas.thrien@tquadrat.org)
- Version:
- $Id: Energy.java 1077 2023-10-14 23:00:23Z tquadrat $
- Since:
- 0.3.0
- UML Diagram
-
UML Diagram for "org.tquadrat.foundation.value.Energy"
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionA bethe.A British Thermal Unit (BTU).A calorie.An electron volt.An erg.A foe (or a 'bethe').A Giga Joule.A Joule.A kilo calorie.The energy equivalent of one kg TNTA kilo Joule.A kilopond meter.The energy equivalent of one thousand tons of TNTA kilo Watt per hour.A Mega Joule.The energy equivalent of one million tons of TNTA quad.A Mega Joule. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BigDecimalThe factor.private final intThe default precision.private final StringThe unit string.Fields inherited from interface DimensionWithLinearConversion
MSG_UnknownUnit -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateEnergy(BigDecimal factor, String unitSymbol) Creates a newLengthinstance, with a default precision of zero mantissa digits.privateEnergy(BigDecimal factor, String unitSymbol, int precision) Creates a newLengthinstance. -
Method Summary
Modifier and TypeMethodDescriptionfinal EnergybaseUnit()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 EnergyReturns theEnergyinstance 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 EnergyReturns the enum constant of this class with the specified name.static Energy[]values()Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOfMethods inherited from interface Dimension
equals, name, toString, unitSymbolForPrintingMethods inherited from interface DimensionWithLinearConversion
fromBase, toBase
-
Enum Constant Details
-
ELECTRONVOLT
An electron volt. -
ERG
-
JOULE
-
CALORIE
-
KILOJOULE
-
BTU
-
KILOCALORIE
A kilo calorie. -
KILOPONDMETER
A kilopond meter. -
MEGAJOULE
-
KILOWATT_HOUR
A kilo Watt per hour. -
KILOGRAM_TNT
The energy equivalent of one kg TNT. This is usually used to rate the power of (nuclear) bombs or other explosives.
-
GIGAJOULE
-
TERAJOULE
-
KILOTON_TNT
The energy equivalent of one thousand tons of TNT. This is usually used to rate the power of (nuclear) bombs or other explosives.
-
MEGATON_TNT
The energy equivalent of one million tons of TNT. This is usually used to rate the power of (nuclear) bombs or other explosives.
-
QUAD
-
FOE
A foe (or a 'bethe').
A
foeis used to express the large amount of energy released by a supernova. An acronym for "[ten to the power of] fifty-one ergs", the term was introduced by Gerald E. Brown of Stony Brook University in his work with Hans Bethe, because "it came up often enough in our work".Without mentioning the foe, Steven Weinberg proposed in 2006 "a new unit called the bethe (
B)" with the same value, to "replace" it.This unit of measure is convenient because a supernova typically releases about one
foeof observable energy in a very short period (which can be measured in seconds). -
BETHE
-
-
Field Details
-
m_Factor
The factor. -
m_Precision
The default precision. -
m_UnitSymbol
The unit string.
-
-
Constructor Details
-
Energy
Creates a newLengthinstance, with a default precision of zero mantissa digits.- Parameters:
factor- The factor.unitSymbol- The unit symbol String.
-
Energy
Creates a newLengthinstance.- Parameters:
factor- The factor.unitSymbol- The unit symbol String.precision- The default precision.
-
-
Method Details
-
values
-
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
-
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 theEnergyinstance 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.
-
