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