1 package org.djunits.value.vfloat.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.vfloat.scalar.base.FloatScalarRel;
45 import org.djutils.base.NumberParser;
46 import org.djutils.exceptions.Throw;
47
48 import jakarta.annotation.Generated;
49
50
51
52
53
54
55
56
57
58
59 @Generated(value = "org.djunits.generator.GenerateDJUNIT", date = "2023-07-23T14:06:38.224104100Z")
60 public class FloatDimensionless extends FloatScalarRel<DimensionlessUnit, FloatDimensionless>
61 implements DimensionlessFunctions<DimensionlessUnit, FloatDimensionless>
62 {
63
64 private static final long serialVersionUID = 20150901L;
65
66
67 public static final FloatDimensionless ZERO = new FloatDimensionless(0.0f, DimensionlessUnit.SI);
68
69
70 public static final FloatDimensionless ONE = new FloatDimensionless(1.0f, DimensionlessUnit.SI);
71
72
73 @SuppressWarnings("checkstyle:constantname")
74 public static final FloatDimensionless NaN = new FloatDimensionless(Float.NaN, DimensionlessUnit.SI);
75
76
77 public static final FloatDimensionless POSITIVE_INFINITY =
78 new FloatDimensionless(Float.POSITIVE_INFINITY, DimensionlessUnit.SI);
79
80
81 public static final FloatDimensionless NEGATIVE_INFINITY =
82 new FloatDimensionless(Float.NEGATIVE_INFINITY, DimensionlessUnit.SI);
83
84
85 public static final FloatDimensionless POS_MAXVALUE = new FloatDimensionless(Float.MAX_VALUE, DimensionlessUnit.SI);
86
87
88 public static final FloatDimensionless NEG_MAXVALUE = new FloatDimensionless(-Float.MAX_VALUE, DimensionlessUnit.SI);
89
90
91
92
93
94
95 public FloatDimensionless(final float value, final DimensionlessUnit unit)
96 {
97 super(value, unit);
98 }
99
100
101
102
103
104 public FloatDimensionless(final FloatDimensionless value)
105 {
106 super(value);
107 }
108
109
110
111
112
113
114 public FloatDimensionless(final double value, final DimensionlessUnit unit)
115 {
116 super((float) value, unit);
117 }
118
119 @Override
120 public final FloatDimensionless instantiateRel(final float value, final DimensionlessUnit unit)
121 {
122 return new FloatDimensionless(value, unit);
123 }
124
125
126
127
128
129
130 public static final FloatDimensionless instantiateSI(final float value)
131 {
132 return new FloatDimensionless(value, DimensionlessUnit.SI);
133 }
134
135
136
137
138
139
140
141
142 public static FloatDimensionless interpolate(final FloatDimensionless zero, final FloatDimensionless one, final float ratio)
143 {
144 return new FloatDimensionless(zero.getInUnit() * (1 - ratio) + one.getInUnit(zero.getDisplayUnit()) * ratio,
145 zero.getDisplayUnit());
146 }
147
148
149
150
151
152
153
154 public static FloatDimensionless max(final FloatDimensionless r1, final FloatDimensionless r2)
155 {
156 return r1.gt(r2) ? r1 : r2;
157 }
158
159
160
161
162
163
164
165
166 public static FloatDimensionless max(final FloatDimensionless r1, final FloatDimensionless r2,
167 final FloatDimensionless... rn)
168 {
169 FloatDimensionless maxr = r1.gt(r2) ? r1 : r2;
170 for (FloatDimensionless r : rn)
171 {
172 if (r.gt(maxr))
173 {
174 maxr = r;
175 }
176 }
177 return maxr;
178 }
179
180
181
182
183
184
185
186 public static FloatDimensionless min(final FloatDimensionless r1, final FloatDimensionless r2)
187 {
188 return r1.lt(r2) ? r1 : r2;
189 }
190
191
192
193
194
195
196
197
198 public static FloatDimensionless min(final FloatDimensionless r1, final FloatDimensionless r2,
199 final FloatDimensionless... rn)
200 {
201 FloatDimensionless minr = r1.lt(r2) ? r1 : r2;
202 for (FloatDimensionless r : rn)
203 {
204 if (r.lt(minr))
205 {
206 minr = r;
207 }
208 }
209 return minr;
210 }
211
212
213
214
215
216
217
218
219
220
221 public static FloatDimensionless valueOf(final String text)
222 {
223 Throw.whenNull(text, "Error parsing FloatDimensionless: text to parse is null");
224 Throw.when(text.length() == 0, IllegalArgumentException.class, "Error parsing FloatDimensionless: empty text to parse");
225 try
226 {
227 NumberParser numberParser = new NumberParser().lenient().trailing();
228 float f = numberParser.parseFloat(text);
229 String unitString = text.substring(numberParser.getTrailingPosition()).trim();
230 if (unitString.length() != 0)
231 throw new IllegalArgumentException("Unit " + unitString + " not found for Dimensionless");
232 return new FloatDimensionless(f, DimensionlessUnit.SI);
233 }
234 catch (Exception exception)
235 {
236 throw new IllegalArgumentException("Error parsing FloatDimensionless from " + text + " using Locale "
237 + Locale.getDefault(Locale.Category.FORMAT), exception);
238 }
239 }
240
241
242
243
244
245
246
247
248
249 public static FloatDimensionless of(final float value, final String unitString)
250 {
251 Throw.whenNull(unitString, "Error parsing FloatDimensionless: unitString is null");
252 Throw.when(unitString.trim().length() != 0, IllegalArgumentException.class,
253 "Error parsing FloatDimensionless: non-empty unitString");
254 DimensionlessUnit unit = DimensionlessUnit.SI;
255 return new FloatDimensionless(value, unit);
256 }
257
258 @Override
259 public String toStringSIPrefixed(final int smallestPower, final int biggestPower)
260 {
261 return toString();
262 }
263
264 @Override
265 public final FloatDimensionless acos()
266 {
267 return instantiateRel((float) Math.acos(getInUnit()), getDisplayUnit());
268 }
269
270 @Override
271 public final FloatDimensionless asin()
272 {
273 return instantiateRel((float) Math.asin(getInUnit()), getDisplayUnit());
274 }
275
276 @Override
277 public final FloatDimensionless atan()
278 {
279 return instantiateRel((float) Math.atan(getInUnit()), getDisplayUnit());
280 }
281
282 @Override
283 public final FloatDimensionless cbrt()
284 {
285 return instantiateRel((float) Math.cbrt(getInUnit()), getDisplayUnit());
286 }
287
288 @Override
289 public final FloatDimensionless cos()
290 {
291 return instantiateRel((float) Math.cos(getInUnit()), getDisplayUnit());
292 }
293
294 @Override
295 public final FloatDimensionless cosh()
296 {
297 return instantiateRel((float) Math.cosh(getInUnit()), getDisplayUnit());
298 }
299
300 @Override
301 public final FloatDimensionless exp()
302 {
303 return instantiateRel((float) Math.exp(getInUnit()), getDisplayUnit());
304 }
305
306 @Override
307 public final FloatDimensionless expm1()
308 {
309 return instantiateRel((float) Math.expm1(getInUnit()), getDisplayUnit());
310 }
311
312 @Override
313 public final FloatDimensionless log()
314 {
315 return instantiateRel((float) Math.log(getInUnit()), getDisplayUnit());
316 }
317
318 @Override
319 public final FloatDimensionless log10()
320 {
321 return instantiateRel((float) Math.log10(getInUnit()), getDisplayUnit());
322 }
323
324 @Override
325 public final FloatDimensionless log1p()
326 {
327 return instantiateRel((float) Math.log1p(getInUnit()), getDisplayUnit());
328 }
329
330 @Override
331 public final FloatDimensionless pow(final double x)
332 {
333 return instantiateRel((float) Math.pow(getInUnit(), x), getDisplayUnit());
334 }
335
336 @Override
337 public final FloatDimensionless signum()
338 {
339 return instantiateRel(Math.signum(getInUnit()), getDisplayUnit());
340 }
341
342 @Override
343 public final FloatDimensionless sin()
344 {
345 return instantiateRel((float) Math.sin(getInUnit()), getDisplayUnit());
346 }
347
348 @Override
349 public final FloatDimensionless sinh()
350 {
351 return instantiateRel((float) Math.sinh(getInUnit()), getDisplayUnit());
352 }
353
354 @Override
355 public final FloatDimensionless sqrt()
356 {
357 return instantiateRel((float) Math.sqrt(getInUnit()), getDisplayUnit());
358 }
359
360 @Override
361 public final FloatDimensionless tan()
362 {
363 return instantiateRel((float) Math.tan(getInUnit()), getDisplayUnit());
364 }
365
366 @Override
367 public final FloatDimensionless tanh()
368 {
369 return instantiateRel((float) Math.tanh(getInUnit()), getDisplayUnit());
370 }
371
372 @Override
373 public final FloatDimensionless inv()
374 {
375 return instantiateRel(1.0f / getInUnit(), getDisplayUnit());
376 }
377
378
379
380
381
382
383 public final FloatDimensionless divide(final FloatDimensionless v)
384 {
385 return new FloatDimensionless(this.si / v.si, DimensionlessUnit.SI);
386 }
387
388
389
390
391
392
393 public final FloatAbsorbedDose times(final FloatAbsorbedDose v)
394 {
395 return new FloatAbsorbedDose(this.si * v.si, AbsorbedDoseUnit.SI);
396 }
397
398
399
400
401
402
403 public final FloatAcceleration times(final FloatAcceleration v)
404 {
405 return new FloatAcceleration(this.si * v.si, AccelerationUnit.SI);
406 }
407
408
409
410
411
412
413
414 public final FloatAmountOfSubstance times(final FloatAmountOfSubstance v)
415 {
416 return new FloatAmountOfSubstance(this.si * v.si, AmountOfSubstanceUnit.SI);
417 }
418
419
420
421
422
423
424 public final FloatAngle times(final FloatAngle v)
425 {
426 return new FloatAngle(this.si * v.si, AngleUnit.SI);
427 }
428
429
430
431
432
433
434 public final FloatSolidAngle times(final FloatSolidAngle v)
435 {
436 return new FloatSolidAngle(this.si * v.si, SolidAngleUnit.SI);
437 }
438
439
440
441
442
443
444 public final FloatArea times(final FloatArea v)
445 {
446 return new FloatArea(this.si * v.si, AreaUnit.SI);
447 }
448
449
450
451
452
453
454
455 public final FloatCatalyticActivity times(final FloatCatalyticActivity v)
456 {
457 return new FloatCatalyticActivity(this.si * v.si, CatalyticActivityUnit.SI);
458 }
459
460
461
462
463
464
465 public final FloatDensity times(final FloatDensity v)
466 {
467 return new FloatDensity(this.si * v.si, DensityUnit.SI);
468 }
469
470
471
472
473
474
475 public final FloatDimensionless times(final FloatDimensionless v)
476 {
477 return new FloatDimensionless(this.si * v.si, DimensionlessUnit.SI);
478 }
479
480
481
482
483
484
485
486 public final FloatElectricalCapacitance times(final FloatElectricalCapacitance v)
487 {
488 return new FloatElectricalCapacitance(this.si * v.si, ElectricalCapacitanceUnit.SI);
489 }
490
491
492
493
494
495
496
497 public final FloatElectricalCharge times(final FloatElectricalCharge v)
498 {
499 return new FloatElectricalCharge(this.si * v.si, ElectricalChargeUnit.SI);
500 }
501
502
503
504
505
506
507
508 public final FloatElectricalConductance times(final FloatElectricalConductance v)
509 {
510 return new FloatElectricalConductance(this.si * v.si, ElectricalConductanceUnit.SI);
511 }
512
513
514
515
516
517
518
519 public final FloatElectricalCurrent times(final FloatElectricalCurrent v)
520 {
521 return new FloatElectricalCurrent(this.si * v.si, ElectricalCurrentUnit.SI);
522 }
523
524
525
526
527
528
529
530 public final FloatElectricalInductance times(final FloatElectricalInductance v)
531 {
532 return new FloatElectricalInductance(this.si * v.si, ElectricalInductanceUnit.SI);
533 }
534
535
536
537
538
539
540
541 public final FloatElectricalPotential times(final FloatElectricalPotential v)
542 {
543 return new FloatElectricalPotential(this.si * v.si, ElectricalPotentialUnit.SI);
544 }
545
546
547
548
549
550
551
552 public final FloatElectricalResistance times(final FloatElectricalResistance v)
553 {
554 return new FloatElectricalResistance(this.si * v.si, ElectricalResistanceUnit.SI);
555 }
556
557
558
559
560
561
562 public final FloatEnergy times(final FloatEnergy v)
563 {
564 return new FloatEnergy(this.si * v.si, EnergyUnit.SI);
565 }
566
567
568
569
570
571
572
573 public final FloatEquivalentDose times(final FloatEquivalentDose v)
574 {
575 return new FloatEquivalentDose(this.si * v.si, EquivalentDoseUnit.SI);
576 }
577
578
579
580
581
582
583 public final FloatFlowMass times(final FloatFlowMass v)
584 {
585 return new FloatFlowMass(this.si * v.si, FlowMassUnit.SI);
586 }
587
588
589
590
591
592
593 public final FloatFlowVolume times(final FloatFlowVolume v)
594 {
595 return new FloatFlowVolume(this.si * v.si, FlowVolumeUnit.SI);
596 }
597
598
599
600
601
602
603 public final FloatForce times(final FloatForce v)
604 {
605 return new FloatForce(this.si * v.si, ForceUnit.SI);
606 }
607
608
609
610
611
612
613 public final FloatFrequency times(final FloatFrequency v)
614 {
615 return new FloatFrequency(this.si * v.si, FrequencyUnit.SI);
616 }
617
618
619
620
621
622
623 public final FloatIlluminance times(final FloatIlluminance v)
624 {
625 return new FloatIlluminance(this.si * v.si, IlluminanceUnit.SI);
626 }
627
628
629
630
631
632
633 public final FloatLength times(final FloatLength v)
634 {
635 return new FloatLength(this.si * v.si, LengthUnit.SI);
636 }
637
638
639
640
641
642
643 public final FloatLinearDensity times(final FloatLinearDensity v)
644 {
645 return new FloatLinearDensity(this.si * v.si, LinearDensityUnit.SI);
646 }
647
648
649
650
651
652
653 public final FloatLuminousFlux times(final FloatLuminousFlux v)
654 {
655 return new FloatLuminousFlux(this.si * v.si, LuminousFluxUnit.SI);
656 }
657
658
659
660
661
662
663
664 public final FloatLuminousIntensity times(final FloatLuminousIntensity v)
665 {
666 return new FloatLuminousIntensity(this.si * v.si, LuminousIntensityUnit.SI);
667 }
668
669
670
671
672
673
674
675 public final FloatMagneticFluxDensity times(final FloatMagneticFluxDensity v)
676 {
677 return new FloatMagneticFluxDensity(this.si * v.si, MagneticFluxDensityUnit.SI);
678 }
679
680
681
682
683
684
685 public final FloatMagneticFlux times(final FloatMagneticFlux v)
686 {
687 return new FloatMagneticFlux(this.si * v.si, MagneticFluxUnit.SI);
688 }
689
690
691
692
693
694
695 public final FloatMass times(final FloatMass v)
696 {
697 return new FloatMass(this.si * v.si, MassUnit.SI);
698 }
699
700
701
702
703
704
705 public final FloatPower times(final FloatPower v)
706 {
707 return new FloatPower(this.si * v.si, PowerUnit.SI);
708 }
709
710
711
712
713
714
715 public final FloatPressure times(final FloatPressure v)
716 {
717 return new FloatPressure(this.si * v.si, PressureUnit.SI);
718 }
719
720
721
722
723
724
725 public final FloatRadioActivity times(final FloatRadioActivity v)
726 {
727 return new FloatRadioActivity(this.si * v.si, RadioActivityUnit.SI);
728 }
729
730
731
732
733
734
735 public final FloatSpeed times(final FloatSpeed v)
736 {
737 return new FloatSpeed(this.si * v.si, SpeedUnit.SI);
738 }
739
740
741
742
743
744
745 public final FloatTemperature times(final FloatTemperature v)
746 {
747 return new FloatTemperature(this.si * v.si, TemperatureUnit.SI);
748 }
749
750
751
752
753
754
755 public final FloatDuration times(final FloatDuration v)
756 {
757 return new FloatDuration(this.si * v.si, DurationUnit.SI);
758 }
759
760
761
762
763
764
765 public final FloatTorque times(final FloatTorque v)
766 {
767 return new FloatTorque(this.si * v.si, TorqueUnit.SI);
768 }
769
770
771
772
773
774
775 public final FloatVolume times(final FloatVolume v)
776 {
777 return new FloatVolume(this.si * v.si, VolumeUnit.SI);
778 }
779
780
781
782
783
784
785 public final FloatLinearDensity divide(final FloatLength v)
786 {
787 return new FloatLinearDensity(this.si / v.si, LinearDensityUnit.SI);
788 }
789
790
791
792
793
794
795 public final FloatLength divide(final FloatLinearDensity v)
796 {
797 return new FloatLength(this.si / v.si, LengthUnit.SI);
798 }
799
800
801
802
803
804
805 public final FloatFrequency divide(final FloatDuration v)
806 {
807 return new FloatFrequency(this.si / v.si, FrequencyUnit.SI);
808 }
809
810
811
812
813
814
815 public final FloatDuration divide(final FloatFrequency v)
816 {
817 return new FloatDuration(this.si / v.si, DurationUnit.SI);
818 }
819
820
821
822
823
824
825
826 public final FloatElectricalResistance divide(final FloatElectricalConductance v)
827 {
828 return new FloatElectricalResistance(this.si / v.si, ElectricalResistanceUnit.SI);
829 }
830
831
832
833
834
835
836
837 public final FloatElectricalConductance divide(final FloatElectricalResistance v)
838 {
839 return new FloatElectricalConductance(this.si / v.si, ElectricalConductanceUnit.SI);
840 }
841
842 @Override
843 public FloatDimensionless reciprocal()
844 {
845 return FloatDimensionless.instantiateSI(1.0f / this.si);
846 }
847
848 }