Package org.djunits.unit
Class AbsoluteLinearUnit.Builder<AU extends AbsoluteLinearUnit<AU,RU>,RU extends Unit<RU>>
java.lang.Object
org.djunits.unit.Unit.Builder<AU>
org.djunits.unit.AbsoluteLinearUnit.Builder<AU,RU>
- Type Parameters:
AU
- the specific unit for which this is the builderRU
- the corresponding relative unit
- All Implemented Interfaces:
Serializable
- Enclosing class:
- AbsoluteLinearUnit<AU extends AbsoluteLinearUnit<AU,
RU>, RU extends Unit<RU>>
public static class AbsoluteLinearUnit.Builder<AU extends AbsoluteLinearUnit<AU,RU>,RU extends Unit<RU>>
extends Unit.Builder<AU>
Builder for the AbsoluteUnit. This builder forces a relative unit base to be set for the absolute unit as well.
Furthermore, it forces an OffsetLinearScale rather than a linear scale.
Copyright (c) 2019-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License.
- Author:
- Alexander Verbraeck
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionRetrieve the corresponding relative unit that has the same conversion factor.getScale()
Retrieve the scale.setAdditionalAbbreviations
(String... abbreviations) Set the additional abbreviations.setDefaultDisplayAbbreviation
(String defaultDisplayAbbreviation) Set the default display abbreviation.setDefaultTextualAbbreviation
(String defaultTextualAbbreviation) Set the default textual abbreviation.setGenerated
(boolean generated) Set the generated flag.Set the id of the unit that this builder builds.Set the name.setQuantity
(Quantity<AU> baseUnit) Set the unit base.setRelativeUnit
(RU newRelativeUnit) Sets the corresponding relative unit that has the same conversion factor.Set the scale.setSiPrefixes
(SIPrefixes siPrefixes, double power) Set whether SI prefixes, ranging from yotta (y) to yocto (Y), are allowed.setUnitSystem
(UnitSystem unitSystem) Set the unit system.toString()
Methods inherited from class org.djunits.unit.Unit.Builder
getAdditionalAbbreviations, getDefaultDisplayAbbreviation, getDefaultTextualAbbreviation, getId, getName, getQuantity, getSiPrefixes, getSiPrefixPowerFactor, getUnitSystem, isGenerated
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
getScale
Description copied from class:Unit.Builder
Retrieve the scale.- Overrides:
getScale
in classUnit.Builder<AU extends AbsoluteLinearUnit<AU,
RU>> - Returns:
- Scale; the scale
-
setScale
Description copied from class:Unit.Builder
Set the scale.- Overrides:
setScale
in classUnit.Builder<AU extends AbsoluteLinearUnit<AU,
RU>> - Parameters:
scale
- Scale; set the scale- Returns:
- Builder; this builder instance that is being constructed (for method call chaining)
-
getRelativeUnit
Retrieve the corresponding relative unit that has the same conversion factor.- Returns:
- Unit<?>; the the corresponding relative unit with the same conversion factor
-
setRelativeUnit
Sets the corresponding relative unit that has the same conversion factor.- Parameters:
newRelativeUnit
- RU; the the corresponding relative unit with the same conversion factor- Returns:
- Builder; this builder instance that is being constructed (for method call chaining)
-
setSiPrefixes
Description copied from class:Unit.Builder
Set whether SI prefixes, ranging from yotta (y) to yocto (Y), are allowed. If not set; this property defaults tofalse
.- Overrides:
setSiPrefixes
in classUnit.Builder<AU extends AbsoluteLinearUnit<AU,
RU>> - Parameters:
siPrefixes
- SIPrefixes; SIPrefixes set siPrefixes, NONE (e.g., for inch), ALL (e.g., for meter) or KILO (e.g., for kilometer)power
- double; power factor of the SI prefixes, e.g. 2.0 for square meters and 3.0 for cubic meters- Returns:
- Builder; this builder instance that is being constructed (for method call chaining)
-
setId
Description copied from class:Unit.Builder
Set the id of the unit that this builder builds.- Overrides:
setId
in classUnit.Builder<AU extends AbsoluteLinearUnit<AU,
RU>> - Parameters:
id
- String; set the id of the unit that this builder builds (must be set; the default isnull
which is invalid)- Returns:
- Builder; this builder instance that is being constructed (for method call chaining)
-
setAdditionalAbbreviations
Description copied from class:Unit.Builder
Set the additional abbreviations.- Overrides:
setAdditionalAbbreviations
in classUnit.Builder<AU extends AbsoluteLinearUnit<AU,
RU>> - Parameters:
abbreviations
- String...; the additional abbreviations- Returns:
- Builder; this builder instance that is being constructed (for method call chaining)
-
setDefaultDisplayAbbreviation
public AbsoluteLinearUnit.Builder<AU,RU> setDefaultDisplayAbbreviation(String defaultDisplayAbbreviation) Description copied from class:Unit.Builder
Set the default display abbreviation.- Overrides:
setDefaultDisplayAbbreviation
in classUnit.Builder<AU extends AbsoluteLinearUnit<AU,
RU>> - Parameters:
defaultDisplayAbbreviation
- String; the default display abbreviation- Returns:
- Builder; this builder instance that is being constructed (for method call chaining)
-
setDefaultTextualAbbreviation
public AbsoluteLinearUnit.Builder<AU,RU> setDefaultTextualAbbreviation(String defaultTextualAbbreviation) Description copied from class:Unit.Builder
Set the default textual abbreviation.- Overrides:
setDefaultTextualAbbreviation
in classUnit.Builder<AU extends AbsoluteLinearUnit<AU,
RU>> - Parameters:
defaultTextualAbbreviation
- String; the default textual abbreviation- Returns:
- Builder; this builder instance that is being constructed (for method call chaining)
-
setName
Description copied from class:Unit.Builder
Set the name.- Overrides:
setName
in classUnit.Builder<AU extends AbsoluteLinearUnit<AU,
RU>> - Parameters:
name
- String; the name- Returns:
- Builder; this builder instance that is being constructed (for method call chaining)
-
setUnitSystem
Description copied from class:Unit.Builder
Set the unit system.- Overrides:
setUnitSystem
in classUnit.Builder<AU extends AbsoluteLinearUnit<AU,
RU>> - Parameters:
unitSystem
- UnitSystem; the unit system- Returns:
- Builder; this builder instance that is being constructed (for method call chaining)
-
setGenerated
Description copied from class:Unit.Builder
Set the generated flag. Defaults to false. Should be set for units that are automatically generated.- Overrides:
setGenerated
in classUnit.Builder<AU extends AbsoluteLinearUnit<AU,
RU>> - Parameters:
generated
- boolean; the value for the generated flag- Returns:
- Builder; this builder instance that is being constructed (for method call chaining)
-
setQuantity
Description copied from class:Unit.Builder
Set the unit base. Can never be null and has to be filled.- Overrides:
setQuantity
in classUnit.Builder<AU extends AbsoluteLinearUnit<AU,
RU>> - Parameters:
baseUnit
- Quantity<U>; the unit base- Returns:
- Builder; this builder instance that is being constructed (for method call chaining)
-
toString
- Overrides:
toString
in classUnit.Builder<AU extends AbsoluteLinearUnit<AU,
RU>>
-