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