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.DimensionlessUnit;
9 import org.djunits.unit.MagneticFluxDensityUnit;
10 import org.djunits.unit.MagneticFluxUnit;
11 import org.djunits.value.util.ValueUtil;
12 import org.djunits.value.vdouble.scalar.base.AbstractDoubleScalarRel;
13
14
15
16
17
18
19
20
21
22
23 @Generated(value = "org.djunits.generator.GenerateDJUNIT", date = "2020-01-19T15:21:24.964166400Z")
24 public class MagneticFluxDensity extends AbstractDoubleScalarRel<MagneticFluxDensityUnit, MagneticFluxDensity>
25 {
26
27 private static final long serialVersionUID = 20150905L;
28
29
30 public static final MagneticFluxDensityneticFluxDensity.html#MagneticFluxDensity">MagneticFluxDensity ZERO = new MagneticFluxDensity(0.0, MagneticFluxDensityUnit.SI);
31
32
33 public static final MagneticFluxDensitygneticFluxDensity.html#MagneticFluxDensity">MagneticFluxDensity ONE = new MagneticFluxDensity(1.0, MagneticFluxDensityUnit.SI);
34
35
36 @SuppressWarnings("checkstyle:constantname")
37 public static final MagneticFluxDensitygneticFluxDensity.html#MagneticFluxDensity">MagneticFluxDensity NaN = new MagneticFluxDensity(Double.NaN, MagneticFluxDensityUnit.SI);
38
39
40 public static final MagneticFluxDensity POSITIVE_INFINITY =
41 new MagneticFluxDensity(Double.POSITIVE_INFINITY, MagneticFluxDensityUnit.SI);
42
43
44 public static final MagneticFluxDensity NEGATIVE_INFINITY =
45 new MagneticFluxDensity(Double.NEGATIVE_INFINITY, MagneticFluxDensityUnit.SI);
46
47
48 public static final MagneticFluxDensity POS_MAXVALUE =
49 new MagneticFluxDensity(Double.MAX_VALUE, MagneticFluxDensityUnit.SI);
50
51
52 public static final MagneticFluxDensity NEG_MAXVALUE =
53 new MagneticFluxDensity(-Double.MAX_VALUE, MagneticFluxDensityUnit.SI);
54
55
56
57
58
59
60 public MagneticFluxDensity(final double value, final MagneticFluxDensityUnit unit)
61 {
62 super(value, unit);
63 }
64
65
66
67
68
69 public MagneticFluxDensityr/MagneticFluxDensity.html#MagneticFluxDensity">MagneticFluxDensity(final MagneticFluxDensity value)
70 {
71 super(value);
72 }
73
74
75 @Override
76 public final MagneticFluxDensity instantiateRel(final double value, final MagneticFluxDensityUnit unit)
77 {
78 return new MagneticFluxDensity(value, unit);
79 }
80
81
82
83
84
85
86 public static final MagneticFluxDensity instantiateSI(final double value)
87 {
88 return new MagneticFluxDensity(value, MagneticFluxDensityUnit.SI);
89 }
90
91
92
93
94
95
96
97
98 public static MagneticFluxDensityeticFluxDensity.html#MagneticFluxDensity">MagneticFluxDensityuxDensity.html#MagneticFluxDensity">MagneticFluxDensity interpolate(final MagneticFluxDensityeticFluxDensity.html#MagneticFluxDensity">MagneticFluxDensity zero, final MagneticFluxDensity one,
99 final double ratio)
100 {
101 return new MagneticFluxDensity(zero.getInUnit() * (1 - ratio) + one.getInUnit(zero.getDisplayUnit()) * ratio,
102 zero.getDisplayUnit());
103 }
104
105
106
107
108
109
110
111 public static MagneticFluxDensitygneticFluxDensity.html#MagneticFluxDensity">MagneticFluxDensitygneticFluxDensity.html#MagneticFluxDensity">MagneticFluxDensity max(final MagneticFluxDensitygneticFluxDensity.html#MagneticFluxDensity">MagneticFluxDensity r1, final MagneticFluxDensity r2)
112 {
113 return r1.gt(r2) ? r1 : r2;
114 }
115
116
117
118
119
120
121
122
123 public static MagneticFluxDensitygneticFluxDensity.html#MagneticFluxDensity">MagneticFluxDensitygneticFluxDensity.html#MagneticFluxDensity">MagneticFluxDensity max(final MagneticFluxDensitygneticFluxDensity.html#MagneticFluxDensity">MagneticFluxDensity r1, final MagneticFluxDensity r2,
124 final MagneticFluxDensity... rn)
125 {
126 MagneticFluxDensity maxr = r1.gt(r2) ? r1 : r2;
127 for (MagneticFluxDensity r : rn)
128 {
129 if (r.gt(maxr))
130 {
131 maxr = r;
132 }
133 }
134 return maxr;
135 }
136
137
138
139
140
141
142
143 public static MagneticFluxDensitygneticFluxDensity.html#MagneticFluxDensity">MagneticFluxDensitygneticFluxDensity.html#MagneticFluxDensity">MagneticFluxDensity min(final MagneticFluxDensitygneticFluxDensity.html#MagneticFluxDensity">MagneticFluxDensity r1, final MagneticFluxDensity r2)
144 {
145 return r1.lt(r2) ? r1 : r2;
146 }
147
148
149
150
151
152
153
154
155 public static MagneticFluxDensitygneticFluxDensity.html#MagneticFluxDensity">MagneticFluxDensitygneticFluxDensity.html#MagneticFluxDensity">MagneticFluxDensity min(final MagneticFluxDensitygneticFluxDensity.html#MagneticFluxDensity">MagneticFluxDensity r1, final MagneticFluxDensity r2,
156 final MagneticFluxDensity... rn)
157 {
158 MagneticFluxDensity minr = r1.lt(r2) ? r1 : r2;
159 for (MagneticFluxDensity r : rn)
160 {
161 if (r.lt(minr))
162 {
163 minr = r;
164 }
165 }
166 return minr;
167 }
168
169
170
171
172
173
174
175
176
177
178 public static MagneticFluxDensity valueOf(final String text)
179 {
180 Throw.whenNull(text, "Error parsing MagneticFluxDensity: text to parse is null");
181 Throw.when(text.length() == 0, IllegalArgumentException.class,
182 "Error parsing MagneticFluxDensity: empty text to parse");
183 Matcher matcher = ValueUtil.NUMBER_PATTERN.matcher(text);
184 if (matcher.find())
185 {
186 int index = matcher.end();
187 String unitString = text.substring(index).trim();
188 String valueString = text.substring(0, index).trim();
189 MagneticFluxDensityUnit unit = MagneticFluxDensityUnit.BASE.getUnitByAbbreviation(unitString);
190 if (unit != null)
191 {
192 double d = Double.parseDouble(valueString);
193 return new MagneticFluxDensity(d, unit);
194 }
195 }
196 throw new IllegalArgumentException("Error parsing MagneticFluxDensity from " + text);
197 }
198
199
200
201
202
203
204
205
206
207 public static MagneticFluxDensity of(final double value, final String unitString)
208 {
209 Throw.whenNull(unitString, "Error parsing MagneticFluxDensity: unitString is null");
210 Throw.when(unitString.length() == 0, IllegalArgumentException.class,
211 "Error parsing MagneticFluxDensity: empty unitString");
212 MagneticFluxDensityUnit unit = MagneticFluxDensityUnit.BASE.getUnitByAbbreviation(unitString);
213 if (unit != null)
214 {
215 return new MagneticFluxDensity(value, unit);
216 }
217 throw new IllegalArgumentException("Error parsing MagneticFluxDensity with unit " + unitString);
218 }
219
220
221
222
223
224
225 public final Dimensionless divide(final MagneticFluxDensity v)
226 {
227 return new Dimensionless(this.si / v.si, DimensionlessUnit.SI);
228 }
229
230
231
232
233
234
235 public final MagneticFlux times(final Area v)
236 {
237 return new MagneticFlux(this.si * v.si, MagneticFluxUnit.SI);
238 }
239
240 }