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-2020 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:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
Modifier and Type Method Description RU
getRelativeUnit()
Retrieve the corresponding relative unit that has the same conversion factor.OffsetLinearScale
getScale()
Retrieve the scale.AbsoluteLinearUnit.Builder<AU,RU>
setAdditionalAbbreviations(String... abbreviations)
Set the additional abbreviations.AbsoluteLinearUnit.Builder<AU,RU>
setDefaultDisplayAbbreviation(String defaultDisplayAbbreviation)
Set the default display abbreviation.AbsoluteLinearUnit.Builder<AU,RU>
setDefaultTextualAbbreviation(String defaultTextualAbbreviation)
Set the default textual abbreviation.AbsoluteLinearUnit.Builder<AU,RU>
setGenerated(boolean generated)
Set the generated flag.AbsoluteLinearUnit.Builder<AU,RU>
setId(String id)
Set the id of the unit that this builder builds.AbsoluteLinearUnit.Builder<AU,RU>
setName(String name)
Set the name.AbsoluteLinearUnit.Builder<AU,RU>
setQuantity(Quantity<AU> baseUnit)
Set the unit base.AbsoluteLinearUnit.Builder<AU,RU>
setRelativeUnit(RU newRelativeUnit)
Sets the corresponding relative unit that has the same conversion factor.AbsoluteLinearUnit.Builder<AU,RU>
setScale(Scale scale)
Set the scale.AbsoluteLinearUnit.Builder<AU,RU>
setSiPrefixes(SIPrefixes siPrefixes, double power)
Set whether SI prefixes, ranging from yotta (y) to yocto (Y), are allowed.AbsoluteLinearUnit.Builder<AU,RU>
setUnitSystem(UnitSystem unitSystem)
Set the unit system.String
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
Retrieve the scale.- Overrides:
getScale
in classUnit.Builder<AU extends AbsoluteLinearUnit<AU,RU>>
- Returns:
- Scale; the scale
-
setScale
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
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
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
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)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)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
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
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
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
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>>
-