Skip to content

Commit 31f6335

Browse files
author
Erik Ovegard
committed
Now calls "base" function instead of using constants when creating values from nullable doubles
1 parent 7a61bc5 commit 31f6335

35 files changed

+346
-346
lines changed

UnitsNet/GeneratedCode/UnitClasses/Acceleration.g.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public static Acceleration FromNanometerPerSecondSquared(double nanometerperseco
183183
{
184184
if (centimeterpersecondsquared.HasValue)
185185
{
186-
return new Acceleration((centimeterpersecondsquared.Value) * 1e-2d);
186+
return FromCentimeterPerSecondSquared(centimeterpersecondsquared.Value);
187187
}
188188
else
189189
{
@@ -198,7 +198,7 @@ public static Acceleration FromNanometerPerSecondSquared(double nanometerperseco
198198
{
199199
if (decimeterpersecondsquared.HasValue)
200200
{
201-
return new Acceleration((decimeterpersecondsquared.Value) * 1e-1d);
201+
return FromDecimeterPerSecondSquared(decimeterpersecondsquared.Value);
202202
}
203203
else
204204
{
@@ -213,7 +213,7 @@ public static Acceleration FromNanometerPerSecondSquared(double nanometerperseco
213213
{
214214
if (kilometerpersecondsquared.HasValue)
215215
{
216-
return new Acceleration((kilometerpersecondsquared.Value) * 1e3d);
216+
return FromKilometerPerSecondSquared(kilometerpersecondsquared.Value);
217217
}
218218
else
219219
{
@@ -228,7 +228,7 @@ public static Acceleration FromNanometerPerSecondSquared(double nanometerperseco
228228
{
229229
if (meterpersecondsquared.HasValue)
230230
{
231-
return new Acceleration(meterpersecondsquared.Value);
231+
return FromMeterPerSecondSquared(meterpersecondsquared.Value);
232232
}
233233
else
234234
{
@@ -243,7 +243,7 @@ public static Acceleration FromNanometerPerSecondSquared(double nanometerperseco
243243
{
244244
if (micrometerpersecondsquared.HasValue)
245245
{
246-
return new Acceleration((micrometerpersecondsquared.Value) * 1e-6d);
246+
return FromMicrometerPerSecondSquared(micrometerpersecondsquared.Value);
247247
}
248248
else
249249
{
@@ -258,7 +258,7 @@ public static Acceleration FromNanometerPerSecondSquared(double nanometerperseco
258258
{
259259
if (millimeterpersecondsquared.HasValue)
260260
{
261-
return new Acceleration((millimeterpersecondsquared.Value) * 1e-3d);
261+
return FromMillimeterPerSecondSquared(millimeterpersecondsquared.Value);
262262
}
263263
else
264264
{
@@ -273,7 +273,7 @@ public static Acceleration FromNanometerPerSecondSquared(double nanometerperseco
273273
{
274274
if (nanometerpersecondsquared.HasValue)
275275
{
276-
return new Acceleration((nanometerpersecondsquared.Value) * 1e-9d);
276+
return FromNanometerPerSecondSquared(nanometerpersecondsquared.Value);
277277
}
278278
else
279279
{

UnitsNet/GeneratedCode/UnitClasses/AmplitudeRatio.g.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public static AmplitudeRatio FromDecibelVolts(double decibelvolts)
119119
{
120120
if (decibelmicrovolts.HasValue)
121121
{
122-
return new AmplitudeRatio(decibelmicrovolts.Value - 120);
122+
return FromDecibelMicrovolts(decibelmicrovolts.Value);
123123
}
124124
else
125125
{
@@ -134,7 +134,7 @@ public static AmplitudeRatio FromDecibelVolts(double decibelvolts)
134134
{
135135
if (decibelmillivolts.HasValue)
136136
{
137-
return new AmplitudeRatio(decibelmillivolts.Value - 60);
137+
return FromDecibelMillivolts(decibelmillivolts.Value);
138138
}
139139
else
140140
{
@@ -149,7 +149,7 @@ public static AmplitudeRatio FromDecibelVolts(double decibelvolts)
149149
{
150150
if (decibelvolts.HasValue)
151151
{
152-
return new AmplitudeRatio(decibelvolts.Value);
152+
return FromDecibelVolts(decibelvolts.Value);
153153
}
154154
else
155155
{

UnitsNet/GeneratedCode/UnitClasses/Angle.g.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public static Angle FromRadians(double radians)
231231
{
232232
if (arcminutes.HasValue)
233233
{
234-
return new Angle(arcminutes.Value/60);
234+
return FromArcminutes(arcminutes.Value);
235235
}
236236
else
237237
{
@@ -246,7 +246,7 @@ public static Angle FromRadians(double radians)
246246
{
247247
if (arcseconds.HasValue)
248248
{
249-
return new Angle(arcseconds.Value/3600);
249+
return FromArcseconds(arcseconds.Value);
250250
}
251251
else
252252
{
@@ -261,7 +261,7 @@ public static Angle FromRadians(double radians)
261261
{
262262
if (centiradians.HasValue)
263263
{
264-
return new Angle((centiradians.Value*180/Math.PI) * 1e-2d);
264+
return FromCentiradians(centiradians.Value);
265265
}
266266
else
267267
{
@@ -276,7 +276,7 @@ public static Angle FromRadians(double radians)
276276
{
277277
if (deciradians.HasValue)
278278
{
279-
return new Angle((deciradians.Value*180/Math.PI) * 1e-1d);
279+
return FromDeciradians(deciradians.Value);
280280
}
281281
else
282282
{
@@ -291,7 +291,7 @@ public static Angle FromRadians(double radians)
291291
{
292292
if (degrees.HasValue)
293293
{
294-
return new Angle(degrees.Value);
294+
return FromDegrees(degrees.Value);
295295
}
296296
else
297297
{
@@ -306,7 +306,7 @@ public static Angle FromRadians(double radians)
306306
{
307307
if (gradians.HasValue)
308308
{
309-
return new Angle(gradians.Value*0.9);
309+
return FromGradians(gradians.Value);
310310
}
311311
else
312312
{
@@ -321,7 +321,7 @@ public static Angle FromRadians(double radians)
321321
{
322322
if (microradians.HasValue)
323323
{
324-
return new Angle((microradians.Value*180/Math.PI) * 1e-6d);
324+
return FromMicroradians(microradians.Value);
325325
}
326326
else
327327
{
@@ -336,7 +336,7 @@ public static Angle FromRadians(double radians)
336336
{
337337
if (milliradians.HasValue)
338338
{
339-
return new Angle((milliradians.Value*180/Math.PI) * 1e-3d);
339+
return FromMilliradians(milliradians.Value);
340340
}
341341
else
342342
{
@@ -351,7 +351,7 @@ public static Angle FromRadians(double radians)
351351
{
352352
if (nanoradians.HasValue)
353353
{
354-
return new Angle((nanoradians.Value*180/Math.PI) * 1e-9d);
354+
return FromNanoradians(nanoradians.Value);
355355
}
356356
else
357357
{
@@ -366,7 +366,7 @@ public static Angle FromRadians(double radians)
366366
{
367367
if (radians.HasValue)
368368
{
369-
return new Angle(radians.Value*180/Math.PI);
369+
return FromRadians(radians.Value);
370370
}
371371
else
372372
{

UnitsNet/GeneratedCode/UnitClasses/Area.g.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public static Area FromSquareYards(double squareyards)
231231
{
232232
if (squarecentimeters.HasValue)
233233
{
234-
return new Area(squarecentimeters.Value*1e-4);
234+
return FromSquareCentimeters(squarecentimeters.Value);
235235
}
236236
else
237237
{
@@ -246,7 +246,7 @@ public static Area FromSquareYards(double squareyards)
246246
{
247247
if (squaredecimeters.HasValue)
248248
{
249-
return new Area(squaredecimeters.Value*1e-2);
249+
return FromSquareDecimeters(squaredecimeters.Value);
250250
}
251251
else
252252
{
@@ -261,7 +261,7 @@ public static Area FromSquareYards(double squareyards)
261261
{
262262
if (squarefeet.HasValue)
263263
{
264-
return new Area(squarefeet.Value*0.092903);
264+
return FromSquareFeet(squarefeet.Value);
265265
}
266266
else
267267
{
@@ -276,7 +276,7 @@ public static Area FromSquareYards(double squareyards)
276276
{
277277
if (squareinches.HasValue)
278278
{
279-
return new Area(squareinches.Value*0.00064516);
279+
return FromSquareInches(squareinches.Value);
280280
}
281281
else
282282
{
@@ -291,7 +291,7 @@ public static Area FromSquareYards(double squareyards)
291291
{
292292
if (squarekilometers.HasValue)
293293
{
294-
return new Area(squarekilometers.Value*1e6);
294+
return FromSquareKilometers(squarekilometers.Value);
295295
}
296296
else
297297
{
@@ -306,7 +306,7 @@ public static Area FromSquareYards(double squareyards)
306306
{
307307
if (squaremeters.HasValue)
308308
{
309-
return new Area(squaremeters.Value);
309+
return FromSquareMeters(squaremeters.Value);
310310
}
311311
else
312312
{
@@ -321,7 +321,7 @@ public static Area FromSquareYards(double squareyards)
321321
{
322322
if (squaremicrometers.HasValue)
323323
{
324-
return new Area(squaremicrometers.Value*1e-12);
324+
return FromSquareMicrometers(squaremicrometers.Value);
325325
}
326326
else
327327
{
@@ -336,7 +336,7 @@ public static Area FromSquareYards(double squareyards)
336336
{
337337
if (squaremiles.HasValue)
338338
{
339-
return new Area(squaremiles.Value*2.59e6);
339+
return FromSquareMiles(squaremiles.Value);
340340
}
341341
else
342342
{
@@ -351,7 +351,7 @@ public static Area FromSquareYards(double squareyards)
351351
{
352352
if (squaremillimeters.HasValue)
353353
{
354-
return new Area(squaremillimeters.Value*1e-6);
354+
return FromSquareMillimeters(squaremillimeters.Value);
355355
}
356356
else
357357
{
@@ -366,7 +366,7 @@ public static Area FromSquareYards(double squareyards)
366366
{
367367
if (squareyards.HasValue)
368368
{
369-
return new Area(squareyards.Value*0.836127);
369+
return FromSquareYards(squareyards.Value);
370370
}
371371
else
372372
{

UnitsNet/GeneratedCode/UnitClasses/Density.g.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public static Density FromTonnesPerCubicMillimeter(double tonnespercubicmillimet
231231
{
232232
if (kilogramspercubiccentimeter.HasValue)
233233
{
234-
return new Density(kilogramspercubiccentimeter.Value*100000000);
234+
return FromKilogramsPerCubicCentimeter(kilogramspercubiccentimeter.Value);
235235
}
236236
else
237237
{
@@ -246,7 +246,7 @@ public static Density FromTonnesPerCubicMillimeter(double tonnespercubicmillimet
246246
{
247247
if (kilogramspercubicmeter.HasValue)
248248
{
249-
return new Density(kilogramspercubicmeter.Value);
249+
return FromKilogramsPerCubicMeter(kilogramspercubicmeter.Value);
250250
}
251251
else
252252
{
@@ -261,7 +261,7 @@ public static Density FromTonnesPerCubicMillimeter(double tonnespercubicmillimet
261261
{
262262
if (kilogramspercubicmillimeter.HasValue)
263263
{
264-
return new Density(kilogramspercubicmillimeter.Value*1000000000000);
264+
return FromKilogramsPerCubicMillimeter(kilogramspercubicmillimeter.Value);
265265
}
266266
else
267267
{
@@ -276,7 +276,7 @@ public static Density FromTonnesPerCubicMillimeter(double tonnespercubicmillimet
276276
{
277277
if (kilopoundspercubicfoot.HasValue)
278278
{
279-
return new Density((kilopoundspercubicfoot.Value/0.062427961) * 1e3d);
279+
return FromKilopoundsPerCubicFoot(kilopoundspercubicfoot.Value);
280280
}
281281
else
282282
{
@@ -291,7 +291,7 @@ public static Density FromTonnesPerCubicMillimeter(double tonnespercubicmillimet
291291
{
292292
if (kilopoundspercubicinch.HasValue)
293293
{
294-
return new Density((kilopoundspercubicinch.Value*27679.904710191) * 1e3d);
294+
return FromKilopoundsPerCubicInch(kilopoundspercubicinch.Value);
295295
}
296296
else
297297
{
@@ -306,7 +306,7 @@ public static Density FromTonnesPerCubicMillimeter(double tonnespercubicmillimet
306306
{
307307
if (poundspercubicfoot.HasValue)
308308
{
309-
return new Density(poundspercubicfoot.Value/0.062427961);
309+
return FromPoundsPerCubicFoot(poundspercubicfoot.Value);
310310
}
311311
else
312312
{
@@ -321,7 +321,7 @@ public static Density FromTonnesPerCubicMillimeter(double tonnespercubicmillimet
321321
{
322322
if (poundspercubicinch.HasValue)
323323
{
324-
return new Density(poundspercubicinch.Value*27679.904710191);
324+
return FromPoundsPerCubicInch(poundspercubicinch.Value);
325325
}
326326
else
327327
{
@@ -336,7 +336,7 @@ public static Density FromTonnesPerCubicMillimeter(double tonnespercubicmillimet
336336
{
337337
if (tonnespercubiccentimeter.HasValue)
338338
{
339-
return new Density(tonnespercubiccentimeter.Value*100000000000);
339+
return FromTonnesPerCubicCentimeter(tonnespercubiccentimeter.Value);
340340
}
341341
else
342342
{
@@ -351,7 +351,7 @@ public static Density FromTonnesPerCubicMillimeter(double tonnespercubicmillimet
351351
{
352352
if (tonnespercubicmeter.HasValue)
353353
{
354-
return new Density(tonnespercubicmeter.Value*1000);
354+
return FromTonnesPerCubicMeter(tonnespercubicmeter.Value);
355355
}
356356
else
357357
{
@@ -366,7 +366,7 @@ public static Density FromTonnesPerCubicMillimeter(double tonnespercubicmillimet
366366
{
367367
if (tonnespercubicmillimeter.HasValue)
368368
{
369-
return new Density(tonnespercubicmillimeter.Value*1000000000000000);
369+
return FromTonnesPerCubicMillimeter(tonnespercubicmillimeter.Value);
370370
}
371371
else
372372
{

0 commit comments

Comments
 (0)