1 package org.djunits.value.vdouble.scalar;
2
3 import java.util.Locale;
4
5 import org.djunits.unit.AngularAccelerationUnit;
6 import org.djunits.unit.AngularVelocityUnit;
7 import org.djunits.unit.DimensionlessUnit;
8 import org.djunits.unit.FrequencyUnit;
9 import org.djunits.value.vdouble.scalar.base.DoubleScalar;
10 import org.djunits.value.vdouble.scalar.base.DoubleScalarRel;
11 import org.djutils.base.NumberParser;
12 import org.djutils.exceptions.Throw;
13
14 import jakarta.annotation.Generated;
15
16
17
18
19
20
21
22
23
24
25 @Generated(value = "org.djunits.generator.GenerateDJUNIT", date = "2023-07-23T14:06:38.224104100Z")
26 public class AngularAcceleration extends DoubleScalarRel<AngularAccelerationUnit, AngularAcceleration>
27 {
28
29 private static final long serialVersionUID = 20150905L;
30
31
32 public static final AngularAcceleration ZERO = new AngularAcceleration(0.0, AngularAccelerationUnit.SI);
33
34
35 public static final AngularAcceleration ONE = new AngularAcceleration(1.0, AngularAccelerationUnit.SI);
36
37
38 @SuppressWarnings("checkstyle:constantname")
39 public static final AngularAcceleration NaN = new AngularAcceleration(Double.NaN, AngularAccelerationUnit.SI);
40
41
42 public static final AngularAcceleration POSITIVE_INFINITY =
43 new AngularAcceleration(Double.POSITIVE_INFINITY, AngularAccelerationUnit.SI);
44
45
46 public static final AngularAcceleration NEGATIVE_INFINITY =
47 new AngularAcceleration(Double.NEGATIVE_INFINITY, AngularAccelerationUnit.SI);
48
49
50 public static final AngularAcceleration POS_MAXVALUE =
51 new AngularAcceleration(Double.MAX_VALUE, AngularAccelerationUnit.SI);
52
53
54 public static final AngularAcceleration NEG_MAXVALUE =
55 new AngularAcceleration(-Double.MAX_VALUE, AngularAccelerationUnit.SI);
56
57
58
59
60
61
62 public AngularAcceleration(final double value, final AngularAccelerationUnit unit)
63 {
64 super(value, unit);
65 }
66
67
68
69
70
71 public AngularAcceleration(final AngularAcceleration value)
72 {
73 super(value);
74 }
75
76 @Override
77 public final AngularAcceleration instantiateRel(final double value, final AngularAccelerationUnit unit)
78 {
79 return new AngularAcceleration(value, unit);
80 }
81
82
83
84
85
86
87 public static final AngularAcceleration instantiateSI(final double value)
88 {
89 return new AngularAcceleration(value, AngularAccelerationUnit.SI);
90 }
91
92
93
94
95
96
97
98
99 public static AngularAcceleration interpolate(final AngularAcceleration zero, final AngularAcceleration one,
100 final double ratio)
101 {
102 return new AngularAcceleration(zero.getInUnit() * (1 - ratio) + one.getInUnit(zero.getDisplayUnit()) * ratio,
103 zero.getDisplayUnit());
104 }
105
106
107
108
109
110
111
112 public static AngularAcceleration max(final AngularAcceleration r1, final AngularAcceleration r2)
113 {
114 return r1.gt(r2) ? r1 : r2;
115 }
116
117
118
119
120
121
122
123
124 public static AngularAcceleration max(final AngularAcceleration r1, final AngularAcceleration r2,
125 final AngularAcceleration... rn)
126 {
127 AngularAcceleration maxr = r1.gt(r2) ? r1 : r2;
128 for (AngularAcceleration r : rn)
129 {
130 if (r.gt(maxr))
131 {
132 maxr = r;
133 }
134 }
135 return maxr;
136 }
137
138
139
140
141
142
143
144 public static AngularAcceleration min(final AngularAcceleration r1, final AngularAcceleration r2)
145 {
146 return r1.lt(r2) ? r1 : r2;
147 }
148
149
150
151
152
153
154
155
156 public static AngularAcceleration min(final AngularAcceleration r1, final AngularAcceleration r2,
157 final AngularAcceleration... rn)
158 {
159 AngularAcceleration minr = r1.lt(r2) ? r1 : r2;
160 for (AngularAcceleration r : rn)
161 {
162 if (r.lt(minr))
163 {
164 minr = r;
165 }
166 }
167 return minr;
168 }
169
170
171
172
173
174
175
176
177
178
179 public static AngularAcceleration valueOf(final String text)
180 {
181 Throw.whenNull(text, "Error parsing AngularAcceleration: text to parse is null");
182 Throw.when(text.length() == 0, IllegalArgumentException.class,
183 "Error parsing AngularAcceleration: empty text to parse");
184 try
185 {
186 NumberParser numberParser = new NumberParser().lenient().trailing();
187 double d = numberParser.parseDouble(text);
188 String unitString = text.substring(numberParser.getTrailingPosition()).trim();
189 AngularAccelerationUnit unit = AngularAccelerationUnit.BASE.getUnitByAbbreviation(unitString);
190 if (unit == null)
191 throw new IllegalArgumentException("Unit " + unitString + " not found");
192 return new AngularAcceleration(d, unit);
193 }
194 catch (Exception exception)
195 {
196 throw new IllegalArgumentException("Error parsing AngularAcceleration from " + text + " using Locale "
197 + Locale.getDefault(Locale.Category.FORMAT), exception);
198 }
199 }
200
201
202
203
204
205
206
207
208
209 public static AngularAcceleration of(final double value, final String unitString)
210 {
211 Throw.whenNull(unitString, "Error parsing AngularAcceleration: unitString is null");
212 Throw.when(unitString.length() == 0, IllegalArgumentException.class,
213 "Error parsing AngularAcceleration: empty unitString");
214 AngularAccelerationUnit unit = AngularAccelerationUnit.BASE.getUnitByAbbreviation(unitString);
215 if (unit != null)
216 {
217 return new AngularAcceleration(value, unit);
218 }
219 throw new IllegalArgumentException("Error parsing AngularAcceleration with unit " + unitString);
220 }
221
222
223
224
225
226
227 public final Dimensionless divide(final AngularAcceleration v)
228 {
229 return new Dimensionless(this.si / v.si, DimensionlessUnit.SI);
230 }
231
232
233
234
235
236
237 public final AngularVelocity times(final Duration v)
238 {
239 return new AngularVelocity(this.si * v.si, AngularVelocityUnit.SI);
240 }
241
242
243
244
245
246
247 public final AngularVelocity divide(final Frequency v)
248 {
249 return new AngularVelocity(this.si / v.si, AngularVelocityUnit.SI);
250 }
251
252
253
254
255
256
257 public final Frequency divide(final AngularVelocity v)
258 {
259 return new Frequency(this.si / v.si, FrequencyUnit.SI);
260 }
261
262 @Override
263 public SIScalar reciprocal()
264 {
265 return DoubleScalar.divide(Dimensionless.ONE, this);
266 }
267
268 }