- 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 SummaryNested classes/interfaces inherited from class java.lang.EnumEnum.EnumDesc<E extends Enum<E>>
- 
Enum Constant SummaryEnum 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 SummaryFieldsModifier and TypeFieldDescriptionprivate final BigDecimalThe factor.private final intThe default precision.private final StringThe unit string.Fields inherited from interface org.tquadrat.foundation.value.api.DimensionWithLinearConversionMSG_UnknownUnit
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprivateEnergy(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 SummaryModifier 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 java.lang.Enumclone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOfMethods inherited from interface org.tquadrat.foundation.value.api.Dimensionequals, name, toString, unitSymbolForPrintingMethods inherited from interface org.tquadrat.foundation.value.api.DimensionWithLinearConversionfromBase, toBase
- 
Enum Constant Details- 
ELECTRONVOLTAn electron volt.
- 
ERGAn erg.
- 
JOULEA Joule.
- 
CALORIEA calorie.
- 
KILOJOULEA kilo Joule.
- 
BTUA British Thermal Unit (BTU).
- 
KILOCALORIEA kilo calorie.
- 
KILOPONDMETERA kilopond meter.
- 
MEGAJOULEA Mega Joule.
- 
KILOWATT_HOURA kilo Watt per hour.
- 
KILOGRAM_TNTThe energy equivalent of one kg TNT. This is usually used to rate the power of (nuclear) bombs or other explosives. 
- 
GIGAJOULEA Giga Joule.
- 
TERAJOULEA Mega Joule.
- 
KILOTON_TNTThe energy equivalent of one thousand tons of TNT. This is usually used to rate the power of (nuclear) bombs or other explosives. 
- 
MEGATON_TNTThe energy equivalent of one million tons of TNT. This is usually used to rate the power of (nuclear) bombs or other explosives. 
- 
QUADA quad.
- 
FOEA 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).
- 
BETHEA bethe. This is the same as foe.
 
- 
- 
Field Details- 
m_FactorThe factor.
- 
m_PrecisionThe default precision.
- 
m_UnitSymbolThe unit string.
 
- 
- 
Constructor Details- 
EnergyCreates a newLengthinstance, with a default precision of zero mantissa digits.- Parameters:
- factor- The factor.
- unitSymbol- The unit symbol String.
 
- 
EnergyCreates a newLengthinstance.- Parameters:
- factor- The factor.
- unitSymbol- The unit symbol String.
- precision- The default precision.
 
 
- 
- 
Method Details- 
valuesReturns 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
 
- 
valueOfReturns 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 name
- NullPointerException- if the argument is null
 
- 
baseUnitReturns the base unit. E.g. for length, the base unit would be Meter (m), for mass, it is Kilogram (kg), and so on. 
- 
factorReturns 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 interface- DimensionWithLinearConversion
- Returns:
- The factor.
- See Also:
 
- 
forUnitReturns theEnergyinstance for the given unit symbol.- Parameters:
- unitSymbol- The unit symbol.
- Returns:
- The respective instance.
- Throws:
- IllegalArgumentException- The given unit is unknown.
 
- 
getPrecisionReturns the default precision for this unit that is used when the respective value is converted to a String.- Specified by:
- getPrecisionin interface- Dimension
- Returns:
- The mantissa length for a value with this unit.
 
- 
unitSymbolReturns 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 interface- Dimension
- Returns:
- The unit.
 
 
- 
