View Javadoc
1   package org.djunits.value.vdouble.scalar;
2   
3   import java.util.Locale;
4   
5   import org.djunits.unit.AbsorbedDoseUnit;
6   import org.djunits.unit.AccelerationUnit;
7   import org.djunits.unit.AmountOfSubstanceUnit;
8   import org.djunits.unit.AngleUnit;
9   import org.djunits.unit.AreaUnit;
10  import org.djunits.unit.CatalyticActivityUnit;
11  import org.djunits.unit.DensityUnit;
12  import org.djunits.unit.DimensionlessUnit;
13  import org.djunits.unit.DurationUnit;
14  import org.djunits.unit.ElectricalCapacitanceUnit;
15  import org.djunits.unit.ElectricalChargeUnit;
16  import org.djunits.unit.ElectricalConductanceUnit;
17  import org.djunits.unit.ElectricalCurrentUnit;
18  import org.djunits.unit.ElectricalInductanceUnit;
19  import org.djunits.unit.ElectricalPotentialUnit;
20  import org.djunits.unit.ElectricalResistanceUnit;
21  import org.djunits.unit.EnergyUnit;
22  import org.djunits.unit.EquivalentDoseUnit;
23  import org.djunits.unit.FlowMassUnit;
24  import org.djunits.unit.FlowVolumeUnit;
25  import org.djunits.unit.ForceUnit;
26  import org.djunits.unit.FrequencyUnit;
27  import org.djunits.unit.IlluminanceUnit;
28  import org.djunits.unit.LengthUnit;
29  import org.djunits.unit.LinearDensityUnit;
30  import org.djunits.unit.LuminousFluxUnit;
31  import org.djunits.unit.LuminousIntensityUnit;
32  import org.djunits.unit.MagneticFluxDensityUnit;
33  import org.djunits.unit.MagneticFluxUnit;
34  import org.djunits.unit.MassUnit;
35  import org.djunits.unit.PowerUnit;
36  import org.djunits.unit.PressureUnit;
37  import org.djunits.unit.RadioActivityUnit;
38  import org.djunits.unit.SolidAngleUnit;
39  import org.djunits.unit.SpeedUnit;
40  import org.djunits.unit.TemperatureUnit;
41  import org.djunits.unit.TorqueUnit;
42  import org.djunits.unit.VolumeUnit;
43  import org.djunits.value.function.DimensionlessFunctions;
44  import org.djunits.value.vdouble.scalar.base.DoubleScalarRel;
45  import org.djutils.base.NumberParser;
46  import org.djutils.exceptions.Throw;
47  
48  import jakarta.annotation.Generated;
49  
50  /**
51   * Easy access methods for the Dimensionless DoubleScalar, which is relative by definition.
52   * <p>
53   * Copyright (c) 2013-2025 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
54   * BSD-style license. See <a href="https://djunits.org/docs/license.html">DJUNITS License</a>.
55   * </p>
56   * @author <a href="https://www.tudelft.nl/averbraeck">Alexander Verbraeck</a>
57   * @author <a href="https://www.tudelft.nl/staff/p.knoppers/">Peter Knoppers</a>
58   */
59  @Generated(value = "org.djunits.generator.GenerateDJUNIT", date = "2025-09-06T15:16:28.380798Z")
60  public class Dimensionless extends DoubleScalarRel<DimensionlessUnit, Dimensionless>
61          implements DimensionlessFunctions<DimensionlessUnit, Dimensionless>
62  {
63      /** */
64      private static final long serialVersionUID = 20150905L;
65  
66      /** Constant with value zero. */
67      public static final Dimensionless ZERO = new Dimensionless(0.0, DimensionlessUnit.SI);
68  
69      /** Constant with value one. */
70      public static final Dimensionless ONE = new Dimensionless(1.0, DimensionlessUnit.SI);
71  
72      /** Constant with value NaN. */
73      @SuppressWarnings("checkstyle:constantname")
74      public static final Dimensionless NaN = new Dimensionless(Double.NaN, DimensionlessUnit.SI);
75  
76      /** Constant with value POSITIVE_INFINITY. */
77      public static final Dimensionless POSITIVE_INFINITY = new Dimensionless(Double.POSITIVE_INFINITY, DimensionlessUnit.SI);
78  
79      /** Constant with value NEGATIVE_INFINITY. */
80      public static final Dimensionless NEGATIVE_INFINITY = new Dimensionless(Double.NEGATIVE_INFINITY, DimensionlessUnit.SI);
81  
82      /** Constant with value MAX_VALUE. */
83      public static final Dimensionless POS_MAXVALUE = new Dimensionless(Double.MAX_VALUE, DimensionlessUnit.SI);
84  
85      /** Constant with value -MAX_VALUE. */
86      public static final Dimensionless NEG_MAXVALUE = new Dimensionless(-Double.MAX_VALUE, DimensionlessUnit.SI);
87  
88      /**
89       * Construct Dimensionless scalar with a unit.
90       * @param value the double value, expressed in the given unit
91       * @param unit unit for the double value
92       */
93      public Dimensionless(final double value, final DimensionlessUnit unit)
94      {
95          super(value, unit);
96      }
97  
98      /**
99       * Construct Dimensionless scalar.
100      * @param value Scalar from which to construct this instance
101      */
102     public Dimensionless(final Dimensionless value)
103     {
104         super(value);
105     }
106 
107     @Override
108     public final Dimensionless instantiateRel(final double value, final DimensionlessUnit unit)
109     {
110         return new Dimensionless(value, unit);
111     }
112 
113     /**
114      * Construct Dimensionless scalar based on an SI value.
115      * @param value the double value in SI units
116      * @return the new scalar with the SI value
117      */
118     public static final Dimensionless ofSI(final double value)
119     {
120         return new Dimensionless(value, DimensionlessUnit.SI);
121     }
122 
123     /**
124      * Interpolate between two values. Note that the first value does not have to be smaller than the second.
125      * @param zero the value at a ratio of zero
126      * @param one the value at a ratio of one
127      * @param ratio the ratio between 0 and 1, inclusive
128      * @return a Dimensionless at the given ratio between 0 and 1
129      */
130     public static Dimensionless interpolate(final Dimensionless zero, final Dimensionless one, final double ratio)
131     {
132         Throw.when(ratio < 0.0 || ratio > 1.0, IllegalArgumentException.class,
133                 "ratio for interpolation should be between 0 and 1, but is %f", ratio);
134         return new Dimensionless(zero.getInUnit() * (1 - ratio) + one.getInUnit(zero.getDisplayUnit()) * ratio,
135                 zero.getDisplayUnit());
136     }
137 
138     /**
139      * Return the maximum value of two relative scalars.
140      * @param r1 the first scalar
141      * @param r2 the second scalar
142      * @return the maximum value of two relative scalars
143      */
144     public static Dimensionless max(final Dimensionless r1, final Dimensionless r2)
145     {
146         return r1.gt(r2) ? r1 : r2;
147     }
148 
149     /**
150      * Return the maximum value of more than two relative scalars.
151      * @param r1 the first scalar
152      * @param r2 the second scalar
153      * @param rn the other scalars
154      * @return the maximum value of more than two relative scalars
155      */
156     public static Dimensionless max(final Dimensionless r1, final Dimensionless r2, final Dimensionless... rn)
157     {
158         Dimensionless maxr = r1.gt(r2) ? r1 : r2;
159         for (Dimensionless r : rn)
160         {
161             if (r.gt(maxr))
162             {
163                 maxr = r;
164             }
165         }
166         return maxr;
167     }
168 
169     /**
170      * Return the minimum value of two relative scalars.
171      * @param r1 the first scalar
172      * @param r2 the second scalar
173      * @return the minimum value of two relative scalars
174      */
175     public static Dimensionless min(final Dimensionless r1, final Dimensionless r2)
176     {
177         return r1.lt(r2) ? r1 : r2;
178     }
179 
180     /**
181      * Return the minimum value of more than two relative scalars.
182      * @param r1 the first scalar
183      * @param r2 the second scalar
184      * @param rn the other scalars
185      * @return the minimum value of more than two relative scalars
186      */
187     public static Dimensionless min(final Dimensionless r1, final Dimensionless r2, final Dimensionless... rn)
188     {
189         Dimensionless minr = r1.lt(r2) ? r1 : r2;
190         for (Dimensionless r : rn)
191         {
192             if (r.lt(minr))
193             {
194                 minr = r;
195             }
196         }
197         return minr;
198     }
199 
200     /**
201      * Returns a Dimensionless representation of a textual representation of a value with a unit. The String representation that
202      * can be parsed is the double value in the unit, followed by a localized or English abbreviation of the unit. Spaces are
203      * allowed, but not required, between the value and the unit.
204      * @param text the textual representation to parse into a Dimensionless
205      * @return the Scalar representation of the value in its unit
206      * @throws IllegalArgumentException when the text cannot be parsed
207      * @throws NullPointerException when the text argument is null
208      */
209     public static Dimensionless valueOf(final String text)
210     {
211         Throw.whenNull(text, "Error parsing Dimensionless: text to parse is null");
212         Throw.when(text.length() == 0, IllegalArgumentException.class, "Error parsing Dimensionless: empty text to parse");
213         try
214         {
215             NumberParser numberParser = new NumberParser().lenient().trailing();
216             double d = numberParser.parseDouble(text);
217             String unitString = text.substring(numberParser.getTrailingPosition()).trim();
218             Throw.when(unitString.length() != 0, IllegalArgumentException.class, "Dimensionless should not have unit %s",
219                     unitString);
220             return new Dimensionless(d, DimensionlessUnit.SI);
221         }
222         catch (Exception exception)
223         {
224             throw new IllegalArgumentException(
225                     "Error parsing Dimensionless from " + text + " using Locale " + Locale.getDefault(Locale.Category.FORMAT),
226                     exception);
227         }
228     }
229 
230     /**
231      * Returns a Dimensionless based on a value and the textual representation of the unit, which can be localized.
232      * @param value the value to use
233      * @param unitString the textual representation of the unit
234      * @return the Scalar representation of the value in its unit
235      * @throws IllegalArgumentException when the unit cannot be parsed or is incorrect
236      * @throws NullPointerException when the unitString argument is null
237      */
238     public static Dimensionless of(final double value, final String unitString)
239     {
240         Throw.whenNull(unitString, "Error parsing Dimensionless: unitString is null");
241         Throw.when(unitString.trim().length() != 0, IllegalArgumentException.class,
242                 "Error parsing Dimensionless: non-empty unitString");
243         DimensionlessUnit unit = DimensionlessUnit.SI;
244         return new Dimensionless(value, unit);
245     }
246 
247     @Override
248     public String toStringSIPrefixed(final int smallestPower, final int biggestPower)
249     {
250         return toString();
251     }
252 
253     @Override
254     public final Dimensionless acos()
255     {
256         return instantiateRel(Math.acos(getInUnit()), getDisplayUnit());
257     }
258 
259     @Override
260     public final Dimensionless asin()
261     {
262         return instantiateRel(Math.asin(getInUnit()), getDisplayUnit());
263     }
264 
265     @Override
266     public final Dimensionless atan()
267     {
268         return instantiateRel(Math.atan(getInUnit()), getDisplayUnit());
269     }
270 
271     @Override
272     public final Dimensionless cbrt()
273     {
274         return instantiateRel(Math.cbrt(getInUnit()), getDisplayUnit());
275     }
276 
277     @Override
278     public final Dimensionless cos()
279     {
280         return instantiateRel(Math.cos(getInUnit()), getDisplayUnit());
281     }
282 
283     @Override
284     public final Dimensionless cosh()
285     {
286         return instantiateRel(Math.cosh(getInUnit()), getDisplayUnit());
287     }
288 
289     @Override
290     public final Dimensionless exp()
291     {
292         return instantiateRel(Math.exp(getInUnit()), getDisplayUnit());
293     }
294 
295     @Override
296     public final Dimensionless expm1()
297     {
298         return instantiateRel(Math.expm1(getInUnit()), getDisplayUnit());
299     }
300 
301     @Override
302     public final Dimensionless log()
303     {
304         return instantiateRel(Math.log(getInUnit()), getDisplayUnit());
305     }
306 
307     @Override
308     public final Dimensionless log10()
309     {
310         return instantiateRel(Math.log10(getInUnit()), getDisplayUnit());
311     }
312 
313     @Override
314     public final Dimensionless log1p()
315     {
316         return instantiateRel(Math.log1p(getInUnit()), getDisplayUnit());
317     }
318 
319     @Override
320     public final Dimensionless pow(final double x)
321     {
322         return instantiateRel(Math.pow(getInUnit(), x), getDisplayUnit());
323     }
324 
325     @Override
326     public final Dimensionless signum()
327     {
328         return instantiateRel(Math.signum(getInUnit()), getDisplayUnit());
329     }
330 
331     @Override
332     public final Dimensionless sin()
333     {
334         return instantiateRel(Math.sin(getInUnit()), getDisplayUnit());
335     }
336 
337     @Override
338     public final Dimensionless sinh()
339     {
340         return instantiateRel(Math.sinh(getInUnit()), getDisplayUnit());
341     }
342 
343     @Override
344     public final Dimensionless sqrt()
345     {
346         return instantiateRel(Math.sqrt(getInUnit()), getDisplayUnit());
347     }
348 
349     @Override
350     public final Dimensionless tan()
351     {
352         return instantiateRel(Math.tan(getInUnit()), getDisplayUnit());
353     }
354 
355     @Override
356     public final Dimensionless tanh()
357     {
358         return instantiateRel(Math.tanh(getInUnit()), getDisplayUnit());
359     }
360 
361     @Override
362     public final Dimensionless inv()
363     {
364         return instantiateRel(1.0 / getInUnit(), getDisplayUnit());
365     }
366 
367     /**
368      * Calculate the division of Dimensionless and Dimensionless, which results in a Dimensionless scalar.
369      * @param v scalar
370      * @return scalar as a division of Dimensionless and Dimensionless
371      */
372     public final Dimensionless divide(final Dimensionless v)
373     {
374         return new Dimensionless(this.si / v.si, DimensionlessUnit.SI);
375     }
376 
377     /**
378      * Calculate the multiplication of Dimensionless and AbsorbedDose, which results in a AbsorbedDose scalar.
379      * @param v scalar
380      * @return scalar as a multiplication of Dimensionless and AbsorbedDose
381      */
382     public final AbsorbedDose times(final AbsorbedDose v)
383     {
384         return new AbsorbedDose(this.si * v.si, AbsorbedDoseUnit.SI);
385     }
386 
387     /**
388      * Calculate the multiplication of Dimensionless and Acceleration, which results in a Acceleration scalar.
389      * @param v scalar
390      * @return scalar as a multiplication of Dimensionless and Acceleration
391      */
392     public final Acceleration times(final Acceleration v)
393     {
394         return new Acceleration(this.si * v.si, AccelerationUnit.SI);
395     }
396 
397     /**
398      * Calculate the multiplication of Dimensionless and AmountOfSubstance, which results in a AmountOfSubstance scalar.
399      * @param v scalar
400      * @return scalar as a multiplication of Dimensionless and AmountOfSubstance
401      */
402     public final AmountOfSubstance times(final AmountOfSubstance v)
403     {
404         return new AmountOfSubstance(this.si * v.si, AmountOfSubstanceUnit.SI);
405     }
406 
407     /**
408      * Calculate the multiplication of Dimensionless and Angle, which results in a Angle scalar.
409      * @param v scalar
410      * @return scalar as a multiplication of Dimensionless and Angle
411      */
412     public final Angle times(final Angle v)
413     {
414         return new Angle(this.si * v.si, AngleUnit.SI);
415     }
416 
417     /**
418      * Calculate the multiplication of Dimensionless and SolidAngle, which results in a SolidAngle scalar.
419      * @param v scalar
420      * @return scalar as a multiplication of Dimensionless and SolidAngle
421      */
422     public final SolidAngle times(final SolidAngle v)
423     {
424         return new SolidAngle(this.si * v.si, SolidAngleUnit.SI);
425     }
426 
427     /**
428      * Calculate the multiplication of Dimensionless and Area, which results in a Area scalar.
429      * @param v scalar
430      * @return scalar as a multiplication of Dimensionless and Area
431      */
432     public final Area times(final Area v)
433     {
434         return new Area(this.si * v.si, AreaUnit.SI);
435     }
436 
437     /**
438      * Calculate the multiplication of Dimensionless and CatalyticActivity, which results in a CatalyticActivity scalar.
439      * @param v scalar
440      * @return scalar as a multiplication of Dimensionless and CatalyticActivity
441      */
442     public final CatalyticActivity times(final CatalyticActivity v)
443     {
444         return new CatalyticActivity(this.si * v.si, CatalyticActivityUnit.SI);
445     }
446 
447     /**
448      * Calculate the multiplication of Dimensionless and Density, which results in a Density scalar.
449      * @param v scalar
450      * @return scalar as a multiplication of Dimensionless and Density
451      */
452     public final Density times(final Density v)
453     {
454         return new Density(this.si * v.si, DensityUnit.SI);
455     }
456 
457     /**
458      * Calculate the multiplication of Dimensionless and Dimensionless, which results in a Dimensionless scalar.
459      * @param v scalar
460      * @return scalar as a multiplication of Dimensionless and Dimensionless
461      */
462     public final Dimensionless times(final Dimensionless v)
463     {
464         return new Dimensionless(this.si * v.si, DimensionlessUnit.SI);
465     }
466 
467     /**
468      * Calculate the multiplication of Dimensionless and ElectricalCapacitance, which results in a ElectricalCapacitance scalar.
469      * @param v scalar
470      * @return scalar as a multiplication of Dimensionless and ElectricalCapacitance
471      */
472     public final ElectricalCapacitance times(final ElectricalCapacitance v)
473     {
474         return new ElectricalCapacitance(this.si * v.si, ElectricalCapacitanceUnit.SI);
475     }
476 
477     /**
478      * Calculate the multiplication of Dimensionless and ElectricalCharge, which results in a ElectricalCharge scalar.
479      * @param v scalar
480      * @return scalar as a multiplication of Dimensionless and ElectricalCharge
481      */
482     public final ElectricalCharge times(final ElectricalCharge v)
483     {
484         return new ElectricalCharge(this.si * v.si, ElectricalChargeUnit.SI);
485     }
486 
487     /**
488      * Calculate the multiplication of Dimensionless and ElectricalConductance, which results in a ElectricalConductance scalar.
489      * @param v scalar
490      * @return scalar as a multiplication of Dimensionless and ElectricalConductance
491      */
492     public final ElectricalConductance times(final ElectricalConductance v)
493     {
494         return new ElectricalConductance(this.si * v.si, ElectricalConductanceUnit.SI);
495     }
496 
497     /**
498      * Calculate the multiplication of Dimensionless and ElectricalCurrent, which results in a ElectricalCurrent scalar.
499      * @param v scalar
500      * @return scalar as a multiplication of Dimensionless and ElectricalCurrent
501      */
502     public final ElectricalCurrent times(final ElectricalCurrent v)
503     {
504         return new ElectricalCurrent(this.si * v.si, ElectricalCurrentUnit.SI);
505     }
506 
507     /**
508      * Calculate the multiplication of Dimensionless and ElectricalInductance, which results in a ElectricalInductance scalar.
509      * @param v scalar
510      * @return scalar as a multiplication of Dimensionless and ElectricalInductance
511      */
512     public final ElectricalInductance times(final ElectricalInductance v)
513     {
514         return new ElectricalInductance(this.si * v.si, ElectricalInductanceUnit.SI);
515     }
516 
517     /**
518      * Calculate the multiplication of Dimensionless and ElectricalPotential, which results in a ElectricalPotential scalar.
519      * @param v scalar
520      * @return scalar as a multiplication of Dimensionless and ElectricalPotential
521      */
522     public final ElectricalPotential times(final ElectricalPotential v)
523     {
524         return new ElectricalPotential(this.si * v.si, ElectricalPotentialUnit.SI);
525     }
526 
527     /**
528      * Calculate the multiplication of Dimensionless and ElectricalResistance, which results in a ElectricalResistance scalar.
529      * @param v scalar
530      * @return scalar as a multiplication of Dimensionless and ElectricalResistance
531      */
532     public final ElectricalResistance times(final ElectricalResistance v)
533     {
534         return new ElectricalResistance(this.si * v.si, ElectricalResistanceUnit.SI);
535     }
536 
537     /**
538      * Calculate the multiplication of Dimensionless and Energy, which results in a Energy scalar.
539      * @param v scalar
540      * @return scalar as a multiplication of Dimensionless and Energy
541      */
542     public final Energy times(final Energy v)
543     {
544         return new Energy(this.si * v.si, EnergyUnit.SI);
545     }
546 
547     /**
548      * Calculate the multiplication of Dimensionless and EquivalentDose, which results in a EquivalentDose scalar.
549      * @param v scalar
550      * @return scalar as a multiplication of Dimensionless and EquivalentDose
551      */
552     public final EquivalentDose times(final EquivalentDose v)
553     {
554         return new EquivalentDose(this.si * v.si, EquivalentDoseUnit.SI);
555     }
556 
557     /**
558      * Calculate the multiplication of Dimensionless and FlowMass, which results in a FlowMass scalar.
559      * @param v scalar
560      * @return scalar as a multiplication of Dimensionless and FlowMass
561      */
562     public final FlowMass times(final FlowMass v)
563     {
564         return new FlowMass(this.si * v.si, FlowMassUnit.SI);
565     }
566 
567     /**
568      * Calculate the multiplication of Dimensionless and FlowVolume, which results in a FlowVolume scalar.
569      * @param v scalar
570      * @return scalar as a multiplication of Dimensionless and FlowVolume
571      */
572     public final FlowVolume times(final FlowVolume v)
573     {
574         return new FlowVolume(this.si * v.si, FlowVolumeUnit.SI);
575     }
576 
577     /**
578      * Calculate the multiplication of Dimensionless and Force, which results in a Force scalar.
579      * @param v scalar
580      * @return scalar as a multiplication of Dimensionless and Force
581      */
582     public final Force times(final Force v)
583     {
584         return new Force(this.si * v.si, ForceUnit.SI);
585     }
586 
587     /**
588      * Calculate the multiplication of Dimensionless and Frequency, which results in a Frequency scalar.
589      * @param v scalar
590      * @return scalar as a multiplication of Dimensionless and Frequency
591      */
592     public final Frequency times(final Frequency v)
593     {
594         return new Frequency(this.si * v.si, FrequencyUnit.SI);
595     }
596 
597     /**
598      * Calculate the multiplication of Dimensionless and Illuminance, which results in a Illuminance scalar.
599      * @param v scalar
600      * @return scalar as a multiplication of Dimensionless and Illuminance
601      */
602     public final Illuminance times(final Illuminance v)
603     {
604         return new Illuminance(this.si * v.si, IlluminanceUnit.SI);
605     }
606 
607     /**
608      * Calculate the multiplication of Dimensionless and Length, which results in a Length scalar.
609      * @param v scalar
610      * @return scalar as a multiplication of Dimensionless and Length
611      */
612     public final Length times(final Length v)
613     {
614         return new Length(this.si * v.si, LengthUnit.SI);
615     }
616 
617     /**
618      * Calculate the multiplication of Dimensionless and LinearDensity, which results in a LinearDensity scalar.
619      * @param v scalar
620      * @return scalar as a multiplication of Dimensionless and LinearDensity
621      */
622     public final LinearDensity times(final LinearDensity v)
623     {
624         return new LinearDensity(this.si * v.si, LinearDensityUnit.SI);
625     }
626 
627     /**
628      * Calculate the multiplication of Dimensionless and LuminousFlux, which results in a LuminousFlux scalar.
629      * @param v scalar
630      * @return scalar as a multiplication of Dimensionless and LuminousFlux
631      */
632     public final LuminousFlux times(final LuminousFlux v)
633     {
634         return new LuminousFlux(this.si * v.si, LuminousFluxUnit.SI);
635     }
636 
637     /**
638      * Calculate the multiplication of Dimensionless and LuminousIntensity, which results in a LuminousIntensity scalar.
639      * @param v scalar
640      * @return scalar as a multiplication of Dimensionless and LuminousIntensity
641      */
642     public final LuminousIntensity times(final LuminousIntensity v)
643     {
644         return new LuminousIntensity(this.si * v.si, LuminousIntensityUnit.SI);
645     }
646 
647     /**
648      * Calculate the multiplication of Dimensionless and MagneticFluxDensity, which results in a MagneticFluxDensity scalar.
649      * @param v scalar
650      * @return scalar as a multiplication of Dimensionless and MagneticFluxDensity
651      */
652     public final MagneticFluxDensity times(final MagneticFluxDensity v)
653     {
654         return new MagneticFluxDensity(this.si * v.si, MagneticFluxDensityUnit.SI);
655     }
656 
657     /**
658      * Calculate the multiplication of Dimensionless and MagneticFlux, which results in a MagneticFlux scalar.
659      * @param v scalar
660      * @return scalar as a multiplication of Dimensionless and MagneticFlux
661      */
662     public final MagneticFlux times(final MagneticFlux v)
663     {
664         return new MagneticFlux(this.si * v.si, MagneticFluxUnit.SI);
665     }
666 
667     /**
668      * Calculate the multiplication of Dimensionless and Mass, which results in a Mass scalar.
669      * @param v scalar
670      * @return scalar as a multiplication of Dimensionless and Mass
671      */
672     public final Mass times(final Mass v)
673     {
674         return new Mass(this.si * v.si, MassUnit.SI);
675     }
676 
677     /**
678      * Calculate the multiplication of Dimensionless and Power, which results in a Power scalar.
679      * @param v scalar
680      * @return scalar as a multiplication of Dimensionless and Power
681      */
682     public final Power times(final Power v)
683     {
684         return new Power(this.si * v.si, PowerUnit.SI);
685     }
686 
687     /**
688      * Calculate the multiplication of Dimensionless and Pressure, which results in a Pressure scalar.
689      * @param v scalar
690      * @return scalar as a multiplication of Dimensionless and Pressure
691      */
692     public final Pressure times(final Pressure v)
693     {
694         return new Pressure(this.si * v.si, PressureUnit.SI);
695     }
696 
697     /**
698      * Calculate the multiplication of Dimensionless and RadioActivity, which results in a RadioActivity scalar.
699      * @param v scalar
700      * @return scalar as a multiplication of Dimensionless and RadioActivity
701      */
702     public final RadioActivity times(final RadioActivity v)
703     {
704         return new RadioActivity(this.si * v.si, RadioActivityUnit.SI);
705     }
706 
707     /**
708      * Calculate the multiplication of Dimensionless and Speed, which results in a Speed scalar.
709      * @param v scalar
710      * @return scalar as a multiplication of Dimensionless and Speed
711      */
712     public final Speed times(final Speed v)
713     {
714         return new Speed(this.si * v.si, SpeedUnit.SI);
715     }
716 
717     /**
718      * Calculate the multiplication of Dimensionless and Temperature, which results in a Temperature scalar.
719      * @param v scalar
720      * @return scalar as a multiplication of Dimensionless and Temperature
721      */
722     public final Temperature times(final Temperature v)
723     {
724         return new Temperature(this.si * v.si, TemperatureUnit.SI);
725     }
726 
727     /**
728      * Calculate the multiplication of Dimensionless and Duration, which results in a Duration scalar.
729      * @param v scalar
730      * @return scalar as a multiplication of Dimensionless and Duration
731      */
732     public final Duration times(final Duration v)
733     {
734         return new Duration(this.si * v.si, DurationUnit.SI);
735     }
736 
737     /**
738      * Calculate the multiplication of Dimensionless and Torque, which results in a Torque scalar.
739      * @param v scalar
740      * @return scalar as a multiplication of Dimensionless and Torque
741      */
742     public final Torque times(final Torque v)
743     {
744         return new Torque(this.si * v.si, TorqueUnit.SI);
745     }
746 
747     /**
748      * Calculate the multiplication of Dimensionless and Volume, which results in a Volume scalar.
749      * @param v scalar
750      * @return scalar as a multiplication of Dimensionless and Volume
751      */
752     public final Volume times(final Volume v)
753     {
754         return new Volume(this.si * v.si, VolumeUnit.SI);
755     }
756 
757     /**
758      * Calculate the division of Dimensionless and Length, which results in a LinearDensity scalar.
759      * @param v scalar
760      * @return scalar as a division of Dimensionless and Length
761      */
762     public final LinearDensity divide(final Length v)
763     {
764         return new LinearDensity(this.si / v.si, LinearDensityUnit.SI);
765     }
766 
767     /**
768      * Calculate the division of Dimensionless and LinearDensity, which results in a Length scalar.
769      * @param v scalar
770      * @return scalar as a division of Dimensionless and LinearDensity
771      */
772     public final Length divide(final LinearDensity v)
773     {
774         return new Length(this.si / v.si, LengthUnit.SI);
775     }
776 
777     /**
778      * Calculate the division of Dimensionless and Duration, which results in a Frequency scalar.
779      * @param v scalar
780      * @return scalar as a division of Dimensionless and Duration
781      */
782     public final Frequency divide(final Duration v)
783     {
784         return new Frequency(this.si / v.si, FrequencyUnit.SI);
785     }
786 
787     /**
788      * Calculate the division of Dimensionless and Frequency, which results in a Duration scalar.
789      * @param v scalar
790      * @return scalar as a division of Dimensionless and Frequency
791      */
792     public final Duration divide(final Frequency v)
793     {
794         return new Duration(this.si / v.si, DurationUnit.SI);
795     }
796 
797     /**
798      * Calculate the division of Dimensionless and ElectricalConductance, which results in a ElectricalResistance scalar.
799      * @param v scalar
800      * @return scalar as a division of Dimensionless and ElectricalConductance
801      */
802     public final ElectricalResistance divide(final ElectricalConductance v)
803     {
804         return new ElectricalResistance(this.si / v.si, ElectricalResistanceUnit.SI);
805     }
806 
807     /**
808      * Calculate the division of Dimensionless and ElectricalResistance, which results in a ElectricalConductance scalar.
809      * @param v scalar
810      * @return scalar as a division of Dimensionless and ElectricalResistance
811      */
812     public final ElectricalConductance divide(final ElectricalResistance v)
813     {
814         return new ElectricalConductance(this.si / v.si, ElectricalConductanceUnit.SI);
815     }
816 
817     @Override
818     public Dimensionless reciprocal()
819     {
820         return Dimensionless.ofSI(1.0 / this.si);
821     }
822 
823     /**
824      * Multiply two scalars that result in a scalar of type Dimensionless.
825      * @param scalar1 the first scalar
826      * @param scalar2 the second scalar
827      * @return the multiplication of both scalars as an instance of Dimensionless
828      */
829     public static Dimensionless multiply(final DoubleScalarRel<?, ?> scalar1, final DoubleScalarRel<?, ?> scalar2)
830     {
831         Throw.whenNull(scalar1, "scalar1 cannot be null");
832         Throw.whenNull(scalar2, "scalar2 cannot be null");
833         Throw.when(
834                 !scalar1.getDisplayUnit().getQuantity().getSiDimensions()
835                         .plus(scalar2.getDisplayUnit().getQuantity().getSiDimensions())
836                         .equals(DimensionlessUnit.BASE.getSiDimensions()),
837                 IllegalArgumentException.class, "Multiplying %s by %s does not result in instance of type Dimensionless",
838                 scalar1.toDisplayString(), scalar2.toDisplayString());
839         return new Dimensionless(scalar1.si * scalar2.si, DimensionlessUnit.SI);
840     }
841 
842     /**
843      * Divide two scalars that result in a scalar of type Dimensionless.
844      * @param scalar1 the first scalar
845      * @param scalar2 the second scalar
846      * @return the division of scalar1 by scalar2 as an instance of Dimensionless
847      */
848     public static Dimensionless divide(final DoubleScalarRel<?, ?> scalar1, final DoubleScalarRel<?, ?> scalar2)
849     {
850         Throw.whenNull(scalar1, "scalar1 cannot be null");
851         Throw.whenNull(scalar2, "scalar2 cannot be null");
852         Throw.when(
853                 !scalar1.getDisplayUnit().getQuantity().getSiDimensions()
854                         .minus(scalar2.getDisplayUnit().getQuantity().getSiDimensions())
855                         .equals(DimensionlessUnit.BASE.getSiDimensions()),
856                 IllegalArgumentException.class, "Dividing %s by %s does not result in an instance of type Dimensionless",
857                 scalar1.toDisplayString(), scalar2.toDisplayString());
858         return new Dimensionless(scalar1.si / scalar2.si, DimensionlessUnit.SI);
859     }
860 
861 }