Enum Class Speed
- All Implemented Interfaces:
Serializable, Comparable<Speed>, Constable, Dimension, DimensionWithLinearConversion
@ClassVersion(sourceVersion="$Id: Speed.java 1195 2026-04-15 21:33:40Z tquadrat $")
@API(status=STABLE,
since="0.0.4")
public enum Speed
extends Enum<Speed>
implements DimensionWithLinearConversion
The various instances of speed …
Because speed is distance per time, the values for
factor()
are calculated based on the values from
Length.factor()
and
Time.factor().
- Author:
- Thomas Thrien (thomas.thrien@tquadrat.org)
- Version:
- $Id: Speed.java 1195 2026-04-15 21:33:40Z tquadrat $
- Since:
- 0.0.4
- UML Diagram
-
UML Diagram for "org.tquadrat.foundation.value.Speed"
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionÅngström per Week.Feet per second.Kilometer per hour.Knot (nautical mile per hour).Meter per second.Mile per hour. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BigDecimalThe factor.private final StringThe unit symbol.Fields inherited from interface DimensionWithLinearConversion
MSG_UnknownUnit -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateSpeed(BigDecimal factor, String unitSymbol) Creates a newSpeedinstance. -
Method Summary
Modifier and TypeMethodDescriptionfinal SpeedbaseUnit()final BigDecimalfactor()static final SpeedReturns theSpeedinstance for the given unit.final Stringstatic SpeedReturns the enum constant of this class with the specified name.static Speed[]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, getPrecision, name, toString, unitSymbolForPrintingMethods inherited from interface DimensionWithLinearConversion
fromBase, toBase
-
Enum Constant Details
-
ÅNGSTRÖM_PER_WEEK
Ångström per Week. This is by far not a useful unit for speed, but it is the implementation of a famous instance of Murphy's Laws:
"Units are always provided in the most impractical form, e.g. a speed as Ångström per Week." -
FEET_PER_SECOND
Feet per second. -
KNOT
-
KILOMETER_PER_HOUR
Kilometer per hour. -
METER_PER_SECOND
Meter per second. -
MILE_PER_HOUR
Mile per hour.
-
-
Field Details
-
m_Factor
The factor. -
m_UnitSymbol
The unit symbol.
-
-
Constructor Details
-
Speed
Creates a newSpeedinstance.- Parameters:
factor- The factor.unitSymbol- The unit symbol.
-
-
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
- Specified by:
factorin interfaceDimensionWithLinearConversion
-
forUnit
Returns theSpeedinstance for the given unit.- Parameters:
unitSymbol- The unit symbol.- Returns:
- The respective instance.
- Throws:
IllegalArgumentException- The given unit is unknown.
-
unitSymbol
- Specified by:
unitSymbolin interfaceDimension
-
