1 package org.djunits.value.vdouble.scalar;
2
3 import java.util.regex.Matcher;
4
5 import javax.annotation.Generated;
6
7 import org.djunits.Throw;
8 import org.djunits.unit.AbsorbedDoseUnit;
9 import org.djunits.unit.AccelerationUnit;
10 import org.djunits.unit.AmountOfSubstanceUnit;
11 import org.djunits.unit.AngleUnit;
12 import org.djunits.unit.AreaUnit;
13 import org.djunits.unit.CatalyticActivityUnit;
14 import org.djunits.unit.DensityUnit;
15 import org.djunits.unit.DimensionlessUnit;
16 import org.djunits.unit.DurationUnit;
17 import org.djunits.unit.ElectricalCapacitanceUnit;
18 import org.djunits.unit.ElectricalChargeUnit;
19 import org.djunits.unit.ElectricalConductanceUnit;
20 import org.djunits.unit.ElectricalCurrentUnit;
21 import org.djunits.unit.ElectricalInductanceUnit;
22 import org.djunits.unit.ElectricalPotentialUnit;
23 import org.djunits.unit.ElectricalResistanceUnit;
24 import org.djunits.unit.EnergyUnit;
25 import org.djunits.unit.EquivalentDoseUnit;
26 import org.djunits.unit.FlowMassUnit;
27 import org.djunits.unit.FlowVolumeUnit;
28 import org.djunits.unit.ForceUnit;
29 import org.djunits.unit.FrequencyUnit;
30 import org.djunits.unit.IlluminanceUnit;
31 import org.djunits.unit.LengthUnit;
32 import org.djunits.unit.LinearDensityUnit;
33 import org.djunits.unit.LuminousFluxUnit;
34 import org.djunits.unit.LuminousIntensityUnit;
35 import org.djunits.unit.MagneticFluxDensityUnit;
36 import org.djunits.unit.MagneticFluxUnit;
37 import org.djunits.unit.MassUnit;
38 import org.djunits.unit.PowerUnit;
39 import org.djunits.unit.PressureUnit;
40 import org.djunits.unit.RadioActivityUnit;
41 import org.djunits.unit.SolidAngleUnit;
42 import org.djunits.unit.SpeedUnit;
43 import org.djunits.unit.TemperatureUnit;
44 import org.djunits.unit.TorqueUnit;
45 import org.djunits.unit.VolumeUnit;
46 import org.djunits.value.function.DimensionlessFunctions;
47 import org.djunits.value.util.ValueUtil;
48 import org.djunits.value.vdouble.scalar.base.AbstractDoubleScalarRel;
49
50
51
52
53
54
55
56
57
58
59 @Generated(value = "org.djunits.generator.GenerateDJUNIT", date = "2020-01-19T15:21:24.964166400Z")
60 public class Dimensionless extends AbstractDoubleScalarRel<DimensionlessUnit, Dimensionless>
61 implements DimensionlessFunctions<DimensionlessUnit, Dimensionless>
62 {
63
64 private static final long serialVersionUID = 20150905L;
65
66
67 public static final Dimensionlessar/Dimensionless.html#Dimensionless">Dimensionless ZERO = new Dimensionless(0.0, DimensionlessUnit.SI);
68
69
70 public static final Dimensionlesslar/Dimensionless.html#Dimensionless">Dimensionless ONE = new Dimensionless(1.0, DimensionlessUnit.SI);
71
72
73 @SuppressWarnings("checkstyle:constantname")
74 public static final Dimensionlesslar/Dimensionless.html#Dimensionless">Dimensionless NaN = new Dimensionless(Double.NaN, DimensionlessUnit.SI);
75
76
77 public static final Dimensionlessess.html#Dimensionless">Dimensionless POSITIVE_INFINITY = new Dimensionless(Double.POSITIVE_INFINITY, DimensionlessUnit.SI);
78
79
80 public static final Dimensionlessess.html#Dimensionless">Dimensionless NEGATIVE_INFINITY = new Dimensionless(Double.NEGATIVE_INFINITY, DimensionlessUnit.SI);
81
82
83 public static final Dimensionlesssionless.html#Dimensionless">Dimensionless POS_MAXVALUE = new Dimensionless(Double.MAX_VALUE, DimensionlessUnit.SI);
84
85
86 public static final Dimensionlesssionless.html#Dimensionless">Dimensionless NEG_MAXVALUE = new Dimensionless(-Double.MAX_VALUE, DimensionlessUnit.SI);
87
88
89
90
91
92
93 public Dimensionless(final double value, final DimensionlessUnit unit)
94 {
95 super(value, unit);
96 }
97
98
99
100
101
102 public Dimensionless/scalar/Dimensionless.html#Dimensionless">Dimensionless(final Dimensionless value)
103 {
104 super(value);
105 }
106
107
108 @Override
109 public final Dimensionless instantiateRel(final double value, final DimensionlessUnit unit)
110 {
111 return new Dimensionless(value, unit);
112 }
113
114
115
116
117
118
119 public static final Dimensionless instantiateSI(final double value)
120 {
121 return new Dimensionless(value, DimensionlessUnit.SI);
122 }
123
124
125
126
127
128
129
130
131 public static Dimensionlessr/Dimensionless.html#Dimensionless">Dimensionlessnsionless.html#Dimensionless">Dimensionless interpolate(final Dimensionlessr/Dimensionless.html#Dimensionless">Dimensionless zero, final Dimensionless one, final double ratio)
132 {
133 return new Dimensionless(zero.getInUnit() * (1 - ratio) + one.getInUnit(zero.getDisplayUnit()) * ratio,
134 zero.getDisplayUnit());
135 }
136
137
138
139
140
141
142
143 public static Dimensionlesslar/Dimensionless.html#Dimensionless">Dimensionlesslar/Dimensionless.html#Dimensionless">Dimensionless max(final Dimensionlesslar/Dimensionless.html#Dimensionless">Dimensionless r1, final Dimensionless r2)
144 {
145 return r1.gt(r2) ? r1 : r2;
146 }
147
148
149
150
151
152
153
154
155 public static Dimensionlesslar/Dimensionless.html#Dimensionless">Dimensionlesslar/Dimensionless.html#Dimensionless">Dimensionless max(final Dimensionlesslar/Dimensionless.html#Dimensionless">Dimensionless r1, final Dimensionless r2, final Dimensionless... rn)
156 {
157 Dimensionless maxr = r1.gt(r2) ? r1 : r2;
158 for (Dimensionless r : rn)
159 {
160 if (r.gt(maxr))
161 {
162 maxr = r;
163 }
164 }
165 return maxr;
166 }
167
168
169
170
171
172
173
174 public static Dimensionlesslar/Dimensionless.html#Dimensionless">Dimensionlesslar/Dimensionless.html#Dimensionless">Dimensionless min(final Dimensionlesslar/Dimensionless.html#Dimensionless">Dimensionless r1, final Dimensionless r2)
175 {
176 return r1.lt(r2) ? r1 : r2;
177 }
178
179
180
181
182
183
184
185
186 public static Dimensionlesslar/Dimensionless.html#Dimensionless">Dimensionlesslar/Dimensionless.html#Dimensionless">Dimensionless min(final Dimensionlesslar/Dimensionless.html#Dimensionless">Dimensionless r1, final Dimensionless r2, final Dimensionless... rn)
187 {
188 Dimensionless minr = r1.lt(r2) ? r1 : r2;
189 for (Dimensionless r : rn)
190 {
191 if (r.lt(minr))
192 {
193 minr = r;
194 }
195 }
196 return minr;
197 }
198
199
200
201
202
203
204
205
206
207
208 public static Dimensionless valueOf(final String text)
209 {
210 Throw.whenNull(text, "Error parsing Dimensionless: text to parse is null");
211 Throw.when(text.length() == 0, IllegalArgumentException.class, "Error parsing Dimensionless: empty text to parse");
212 Matcher matcher = ValueUtil.NUMBER_PATTERN.matcher(text);
213 if (matcher.find())
214 {
215 int index = matcher.end();
216 String unitString = text.substring(index).trim();
217 String valueString = text.substring(0, index).trim();
218 DimensionlessUnit unit = DimensionlessUnit.BASE.getUnitByAbbreviation(unitString);
219 if (unit != null)
220 {
221 double d = Double.parseDouble(valueString);
222 return new Dimensionless(d, unit);
223 }
224 }
225 throw new IllegalArgumentException("Error parsing Dimensionless from " + text);
226 }
227
228
229
230
231
232
233
234
235
236 public static Dimensionless of(final double value, final String unitString)
237 {
238 Throw.whenNull(unitString, "Error parsing Dimensionless: unitString is null");
239 Throw.when(unitString.length() == 0, IllegalArgumentException.class, "Error parsing Dimensionless: empty unitString");
240 DimensionlessUnit unit = DimensionlessUnit.BASE.getUnitByAbbreviation(unitString);
241 if (unit != null)
242 {
243 return new Dimensionless(value, unit);
244 }
245 throw new IllegalArgumentException("Error parsing Dimensionless with unit " + unitString);
246 }
247
248
249 @Override
250 public final Dimensionless acos()
251 {
252 return instantiateRel(Math.acos(getInUnit()), getDisplayUnit());
253 }
254
255
256 @Override
257 public final Dimensionless asin()
258 {
259 return instantiateRel(Math.asin(getInUnit()), getDisplayUnit());
260 }
261
262
263 @Override
264 public final Dimensionless atan()
265 {
266 return instantiateRel(Math.atan(getInUnit()), getDisplayUnit());
267 }
268
269
270 @Override
271 public final Dimensionless cbrt()
272 {
273 return instantiateRel(Math.cbrt(getInUnit()), getDisplayUnit());
274 }
275
276
277 @Override
278 public final Dimensionless cos()
279 {
280 return instantiateRel(Math.cos(getInUnit()), getDisplayUnit());
281 }
282
283
284 @Override
285 public final Dimensionless cosh()
286 {
287 return instantiateRel(Math.cosh(getInUnit()), getDisplayUnit());
288 }
289
290
291 @Override
292 public final Dimensionless exp()
293 {
294 return instantiateRel(Math.exp(getInUnit()), getDisplayUnit());
295 }
296
297
298 @Override
299 public final Dimensionless expm1()
300 {
301 return instantiateRel(Math.expm1(getInUnit()), getDisplayUnit());
302 }
303
304
305 @Override
306 public final Dimensionless log()
307 {
308 return instantiateRel(Math.log(getInUnit()), getDisplayUnit());
309 }
310
311
312 @Override
313 public final Dimensionless log10()
314 {
315 return instantiateRel(Math.log10(getInUnit()), getDisplayUnit());
316 }
317
318
319 @Override
320 public final Dimensionless log1p()
321 {
322 return instantiateRel(Math.log1p(getInUnit()), getDisplayUnit());
323 }
324
325
326 @Override
327 public final Dimensionless pow(final double x)
328 {
329 return instantiateRel(Math.pow(getInUnit(), x), getDisplayUnit());
330 }
331
332
333 @Override
334 public final Dimensionless signum()
335 {
336 return instantiateRel(Math.signum(getInUnit()), getDisplayUnit());
337 }
338
339
340 @Override
341 public final Dimensionless sin()
342 {
343 return instantiateRel(Math.sin(getInUnit()), getDisplayUnit());
344 }
345
346
347 @Override
348 public final Dimensionless sinh()
349 {
350 return instantiateRel(Math.sinh(getInUnit()), getDisplayUnit());
351 }
352
353
354 @Override
355 public final Dimensionless sqrt()
356 {
357 return instantiateRel(Math.sqrt(getInUnit()), getDisplayUnit());
358 }
359
360
361 @Override
362 public final Dimensionless tan()
363 {
364 return instantiateRel(Math.tan(getInUnit()), getDisplayUnit());
365 }
366
367
368 @Override
369 public final Dimensionless tanh()
370 {
371 return instantiateRel(Math.tanh(getInUnit()), getDisplayUnit());
372 }
373
374
375 @Override
376 public final Dimensionless inv()
377 {
378 return instantiateRel(1.0 / getInUnit(), getDisplayUnit());
379 }
380
381
382
383
384
385
386 public final Dimensionless/Dimensionless.html#Dimensionless">Dimensionless divide(final Dimensionless v)
387 {
388 return new Dimensionless(this.si / v.si, DimensionlessUnit.SI);
389 }
390
391
392
393
394
395
396 public final AbsorbedDosear/AbsorbedDose.html#AbsorbedDose">AbsorbedDose times(final AbsorbedDose v)
397 {
398 return new AbsorbedDose(this.si * v.si, AbsorbedDoseUnit.SI);
399 }
400
401
402
403
404
405
406 public final Accelerationar/Acceleration.html#Acceleration">Acceleration times(final Acceleration v)
407 {
408 return new Acceleration(this.si * v.si, AccelerationUnit.SI);
409 }
410
411
412
413
414
415
416 public final AmountOfSubstanceountOfSubstance.html#AmountOfSubstance">AmountOfSubstance times(final AmountOfSubstance v)
417 {
418 return new AmountOfSubstance(this.si * v.si, AmountOfSubstanceUnit.SI);
419 }
420
421
422
423
424
425
426 public final Anglele/scalar/Angle.html#Angle">Angle times(final Angle v)
427 {
428 return new Angle(this.si * v.si, AngleUnit.SI);
429 }
430
431
432
433
434
435
436 public final SolidAnglealar/SolidAngle.html#SolidAngle">SolidAngle times(final SolidAngle v)
437 {
438 return new SolidAngle(this.si * v.si, SolidAngleUnit.SI);
439 }
440
441
442
443
444
445
446 public final Areable/scalar/Area.html#Area">Area times(final Area v)
447 {
448 return new Area(this.si * v.si, AreaUnit.SI);
449 }
450
451
452
453
454
455
456 public final CatalyticActivitytalyticActivity.html#CatalyticActivity">CatalyticActivity times(final CatalyticActivity v)
457 {
458 return new CatalyticActivity(this.si * v.si, CatalyticActivityUnit.SI);
459 }
460
461
462
463
464
465
466 public final Density/scalar/Density.html#Density">Density times(final Density v)
467 {
468 return new Density(this.si * v.si, DensityUnit.SI);
469 }
470
471
472
473
474
475
476 public final Dimensionlessr/Dimensionless.html#Dimensionless">Dimensionless times(final Dimensionless v)
477 {
478 return new Dimensionless(this.si * v.si, DimensionlessUnit.SI);
479 }
480
481
482
483
484
485
486 public final ElectricalCapacitanceicalCapacitance.html#ElectricalCapacitance">ElectricalCapacitance times(final ElectricalCapacitance v)
487 {
488 return new ElectricalCapacitance(this.si * v.si, ElectricalCapacitanceUnit.SI);
489 }
490
491
492
493
494
495
496 public final ElectricalChargelectricalCharge.html#ElectricalCharge">ElectricalCharge times(final ElectricalCharge v)
497 {
498 return new ElectricalCharge(this.si * v.si, ElectricalChargeUnit.SI);
499 }
500
501
502
503
504
505
506 public final ElectricalConductanceicalConductance.html#ElectricalConductance">ElectricalConductance times(final ElectricalConductance v)
507 {
508 return new ElectricalConductance(this.si * v.si, ElectricalConductanceUnit.SI);
509 }
510
511
512
513
514
515
516 public final ElectricalCurrentectricalCurrent.html#ElectricalCurrent">ElectricalCurrent times(final ElectricalCurrent v)
517 {
518 return new ElectricalCurrent(this.si * v.si, ElectricalCurrentUnit.SI);
519 }
520
521
522
523
524
525
526 public final ElectricalInductancericalInductance.html#ElectricalInductance">ElectricalInductance times(final ElectricalInductance v)
527 {
528 return new ElectricalInductance(this.si * v.si, ElectricalInductanceUnit.SI);
529 }
530
531
532
533
534
535
536 public final ElectricalPotentialtricalPotential.html#ElectricalPotential">ElectricalPotential times(final ElectricalPotential v)
537 {
538 return new ElectricalPotential(this.si * v.si, ElectricalPotentialUnit.SI);
539 }
540
541
542
543
544
545
546 public final ElectricalResistancericalResistance.html#ElectricalResistance">ElectricalResistance times(final ElectricalResistance v)
547 {
548 return new ElectricalResistance(this.si * v.si, ElectricalResistanceUnit.SI);
549 }
550
551
552
553
554
555
556 public final Energye/scalar/Energy.html#Energy">Energy times(final Energy v)
557 {
558 return new Energy(this.si * v.si, EnergyUnit.SI);
559 }
560
561
562
563
564
565
566 public final EquivalentDose/EquivalentDose.html#EquivalentDose">EquivalentDose times(final EquivalentDose v)
567 {
568 return new EquivalentDose(this.si * v.si, EquivalentDoseUnit.SI);
569 }
570
571
572
573
574
575
576 public final FlowMassscalar/FlowMass.html#FlowMass">FlowMass times(final FlowMass v)
577 {
578 return new FlowMass(this.si * v.si, FlowMassUnit.SI);
579 }
580
581
582
583
584
585
586 public final FlowVolumealar/FlowVolume.html#FlowVolume">FlowVolume times(final FlowVolume v)
587 {
588 return new FlowVolume(this.si * v.si, FlowVolumeUnit.SI);
589 }
590
591
592
593
594
595
596 public final Forcele/scalar/Force.html#Force">Force times(final Force v)
597 {
598 return new Force(this.si * v.si, ForceUnit.SI);
599 }
600
601
602
603
604
605
606 public final Frequencycalar/Frequency.html#Frequency">Frequency times(final Frequency v)
607 {
608 return new Frequency(this.si * v.si, FrequencyUnit.SI);
609 }
610
611
612
613
614
615
616 public final Illuminancelar/Illuminance.html#Illuminance">Illuminance times(final Illuminance v)
617 {
618 return new Illuminance(this.si * v.si, IlluminanceUnit.SI);
619 }
620
621
622
623
624
625
626 public final Lengthe/scalar/Length.html#Length">Length times(final Length v)
627 {
628 return new Length(this.si * v.si, LengthUnit.SI);
629 }
630
631
632
633
634
635
636 public final LinearDensityr/LinearDensity.html#LinearDensity">LinearDensity times(final LinearDensity v)
637 {
638 return new LinearDensity(this.si * v.si, LinearDensityUnit.SI);
639 }
640
641
642
643
644
645
646 public final LuminousFluxar/LuminousFlux.html#LuminousFlux">LuminousFlux times(final LuminousFlux v)
647 {
648 return new LuminousFlux(this.si * v.si, LuminousFluxUnit.SI);
649 }
650
651
652
653
654
655
656 public final LuminousIntensityminousIntensity.html#LuminousIntensity">LuminousIntensity times(final LuminousIntensity v)
657 {
658 return new LuminousIntensity(this.si * v.si, LuminousIntensityUnit.SI);
659 }
660
661
662
663
664
665
666 public final MagneticFluxDensityeticFluxDensity.html#MagneticFluxDensity">MagneticFluxDensity times(final MagneticFluxDensity v)
667 {
668 return new MagneticFluxDensity(this.si * v.si, MagneticFluxDensityUnit.SI);
669 }
670
671
672
673
674
675
676 public final MagneticFluxar/MagneticFlux.html#MagneticFlux">MagneticFlux times(final MagneticFlux v)
677 {
678 return new MagneticFlux(this.si * v.si, MagneticFluxUnit.SI);
679 }
680
681
682
683
684
685
686 public final Massble/scalar/Mass.html#Mass">Mass times(final Mass v)
687 {
688 return new Mass(this.si * v.si, MassUnit.SI);
689 }
690
691
692
693
694
695
696 public final Powerle/scalar/Power.html#Power">Power times(final Power v)
697 {
698 return new Power(this.si * v.si, PowerUnit.SI);
699 }
700
701
702
703
704
705
706 public final Pressurescalar/Pressure.html#Pressure">Pressure times(final Pressure v)
707 {
708 return new Pressure(this.si * v.si, PressureUnit.SI);
709 }
710
711
712
713
714
715
716 public final RadioActivityr/RadioActivity.html#RadioActivity">RadioActivity times(final RadioActivity v)
717 {
718 return new RadioActivity(this.si * v.si, RadioActivityUnit.SI);
719 }
720
721
722
723
724
725
726 public final Speedle/scalar/Speed.html#Speed">Speed times(final Speed v)
727 {
728 return new Speed(this.si * v.si, SpeedUnit.SI);
729 }
730
731
732
733
734
735
736 public final Temperaturelar/Temperature.html#Temperature">Temperature times(final Temperature v)
737 {
738 return new Temperature(this.si * v.si, TemperatureUnit.SI);
739 }
740
741
742
743
744
745
746 public final Durationscalar/Duration.html#Duration">Duration times(final Duration v)
747 {
748 return new Duration(this.si * v.si, DurationUnit.SI);
749 }
750
751
752
753
754
755
756 public final Torquee/scalar/Torque.html#Torque">Torque times(final Torque v)
757 {
758 return new Torque(this.si * v.si, TorqueUnit.SI);
759 }
760
761
762
763
764
765
766 public final Volumee/scalar/Volume.html#Volume">Volume times(final Volume v)
767 {
768 return new Volume(this.si * v.si, VolumeUnit.SI);
769 }
770
771
772
773
774
775
776 public final LinearDensity divide(final Length v)
777 {
778 return new LinearDensity(this.si / v.si, LinearDensityUnit.SI);
779 }
780
781
782
783
784
785
786 public final Length divide(final LinearDensity v)
787 {
788 return new Length(this.si / v.si, LengthUnit.SI);
789 }
790
791
792
793
794
795
796 public final Frequency divide(final Duration v)
797 {
798 return new Frequency(this.si / v.si, FrequencyUnit.SI);
799 }
800
801
802
803
804
805
806 public final Duration divide(final Frequency v)
807 {
808 return new Duration(this.si / v.si, DurationUnit.SI);
809 }
810
811 }