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