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