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