unitsnet-js
Version:
A better way to hold unit variables and easily convert to the destination unit
1,089 lines • 93 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Volume = exports.VolumeUnits = void 0;
const base_unit_1 = require("../base-unit");
/** VolumeUnits enumeration */
var VolumeUnits;
(function (VolumeUnits) {
/** */
VolumeUnits["Liters"] = "Liter";
/** */
VolumeUnits["CubicMeters"] = "CubicMeter";
/** */
VolumeUnits["CubicKilometers"] = "CubicKilometer";
/** */
VolumeUnits["CubicHectometers"] = "CubicHectometer";
/** */
VolumeUnits["CubicDecimeters"] = "CubicDecimeter";
/** */
VolumeUnits["CubicCentimeters"] = "CubicCentimeter";
/** */
VolumeUnits["CubicMillimeters"] = "CubicMillimeter";
/** */
VolumeUnits["CubicMicrometers"] = "CubicMicrometer";
/** A cubic mile (abbreviation: cu mi or mi3) is an imperial and US customary (non-SI non-metric) unit of volume, used in the United States, Canada and the United Kingdom. It is defined as the volume of a cube with sides of 1 mile (63360 inches, 5280 feet, 1760 yards or ~1.609 kilometres) in length. */
VolumeUnits["CubicMiles"] = "CubicMile";
/** A cubic yard is an Imperial / U.S. customary (non-SI non-metric) unit of volume, used in Canada and the United States. It is defined as the volume of a cube with sides of 1 yard (3 feet, 36 inches, 0.9144 meters) in length. */
VolumeUnits["CubicYards"] = "CubicYard";
/** The cubic foot (symbol ft3 or cu ft) is an imperial and US customary (non-metric) unit of volume, used in the United States and the United Kingdom. It is defined as the volume of a cube with sides of one foot (0.3048 m) in length. */
VolumeUnits["CubicFeet"] = "CubicFoot";
/** The cubic inch (symbol in3) is a unit of volume in the Imperial units and United States customary units systems. It is the volume of a cube with each of its three dimensions (length, width, and height) being one inch long which is equivalent to 1/231 of a US gallon. */
VolumeUnits["CubicInches"] = "CubicInch";
/** The British imperial gallon (frequently called simply "gallon") is defined as exactly 4.54609 litres. */
VolumeUnits["ImperialGallons"] = "ImperialGallon";
/** An imperial fluid ounce is 1⁄20 of an imperial pint, 1⁄160 of an imperial gallon or exactly 28.4130625 mL. */
VolumeUnits["ImperialOunces"] = "ImperialOunce";
/** The US liquid gallon (frequently called simply "gallon") is legally defined as 231 cubic inches, which is exactly 3.785411784 litres. */
VolumeUnits["UsGallons"] = "UsGallon";
/** A US customary fluid ounce is 1⁄16 of a US liquid pint and 1⁄128 of a US liquid gallon or exactly 29.5735295625 mL, making it about 4.08% larger than the imperial fluid ounce. */
VolumeUnits["UsOunces"] = "UsOunce";
/** The traditional U.S. interpretation of the tablespoon as a unit of volume is: 1 US tablespoon = 4 fluid drams, or 3 teaspoons or 1/2 US fluid ounce (≈ 14.8 ml) */
VolumeUnits["UsTablespoons"] = "UsTablespoon";
/** In Australia, the definition of the tablespoon is 20 ml (0.70 imp fl oz). */
VolumeUnits["AuTablespoons"] = "AuTablespoon";
/** In nutrition labeling in the U.S. and the U.K., a tablespoon is defined as 15 ml (0.51 US fl oz). In Australia, the definition of the tablespoon is 20 ml (0.70 imp fl oz). */
VolumeUnits["UkTablespoons"] = "UkTablespoon";
/** The metric teaspoon as a unit of culinary measure is 5 ml (0.18 imp fl oz; 0.17 US fl oz),[17] equal to 5 cm3, 1⁄3 UK/Canadian metric tablespoon, or 1⁄4 Australian metric tablespoon. */
VolumeUnits["MetricTeaspoons"] = "MetricTeaspoon";
/** As a unit of culinary measure, one teaspoon in the United States is 1⁄3 tablespoon, exactly 4.92892159375 ml, 1 1⁄3 US fluid drams, 1⁄6 US fl oz, 1⁄48 US cup, 1⁄768 US liquid gallon, or 77⁄256 (0.30078125) cubic inches. */
VolumeUnits["UsTeaspoons"] = "UsTeaspoon";
/** Australia, Canada, New Zealand, and some other members of the Commonwealth of Nations, being former British colonies that have since metricated, employ a metric cup of 250 millilitres. Although derived from the metric system, it is not an SI unit. */
VolumeUnits["MetricCups"] = "MetricCup";
/** In the United States, the customary cup is half of a liquid pint or 1⁄16 US customary gallon which is 236.5882365 milliliters exactly. */
VolumeUnits["UsCustomaryCups"] = "UsCustomaryCup";
/** The cup currently used in the United States for nutrition labelling is defined in United States law as 240 ml. */
VolumeUnits["UsLegalCups"] = "UsLegalCup";
/** In the oil industry, one barrel (unit symbol bbl) is a unit of volume used for measuring oil defined as exactly 42 US gallons, approximately 159 liters, or 35 imperial gallons. */
VolumeUnits["OilBarrels"] = "OilBarrel";
/** Fluid barrels vary depending on what is being measured and where. In the US most fluid barrels (apart from oil) are 31.5 US gallons (26 imp gal; 119 L) (half a hogshead), but a beer barrel is 31 US gallons (26 imp gal; 117 L). */
VolumeUnits["UsBeerBarrels"] = "UsBeerBarrel";
/** Fluid barrels vary depending on what is being measured and where. In the UK a beer barrel is 36 imperial gallons (43 US gal; ~164 L). */
VolumeUnits["ImperialBeerBarrels"] = "ImperialBeerBarrel";
/** The US liquid quart equals 57.75 cubic inches, which is exactly equal to 0.946352946 L. */
VolumeUnits["UsQuarts"] = "UsQuart";
/** The imperial quart, which is used for both liquid and dry capacity, is equal to one quarter of an imperial gallon, or exactly 1.1365225 liters. */
VolumeUnits["ImperialQuarts"] = "ImperialQuart";
/** The pint is a unit of volume or capacity in both the imperial and United States customary measurement systems. In both of those systems it is traditionally one eighth of a gallon. The British imperial pint is about 20% larger than the American pint because the two systems are defined differently. */
VolumeUnits["UsPints"] = "UsPint";
/** An acre-foot is 43,560 cubic feet (~1,233.5 m3). */
VolumeUnits["AcreFeet"] = "AcreFoot";
/** The pint is a unit of volume or capacity in both the imperial and United States customary measurement systems. In both of those systems it is traditionally one eighth of a gallon. The British imperial pint is about 20% larger than the American pint because the two systems are defined differently. */
VolumeUnits["ImperialPints"] = "ImperialPint";
/** The board foot or board-foot is a unit of measurement for the volume of lumber in the United States and Canada. It equals the volume of a board that is one-foot (305 mm) in length, one-foot (305 mm) in width, and one-inch (25.4 mm) in thickness. */
VolumeUnits["BoardFeet"] = "BoardFoot";
/** */
VolumeUnits["Nanoliters"] = "Nanoliter";
/** */
VolumeUnits["Microliters"] = "Microliter";
/** */
VolumeUnits["Milliliters"] = "Milliliter";
/** */
VolumeUnits["Centiliters"] = "Centiliter";
/** */
VolumeUnits["Deciliters"] = "Deciliter";
/** */
VolumeUnits["Decaliters"] = "Decaliter";
/** */
VolumeUnits["Hectoliters"] = "Hectoliter";
/** */
VolumeUnits["Kiloliters"] = "Kiloliter";
/** */
VolumeUnits["Megaliters"] = "Megaliter";
/** */
VolumeUnits["HectocubicMeters"] = "HectocubicMeter";
/** */
VolumeUnits["KilocubicMeters"] = "KilocubicMeter";
/** */
VolumeUnits["HectocubicFeet"] = "HectocubicFoot";
/** */
VolumeUnits["KilocubicFeet"] = "KilocubicFoot";
/** */
VolumeUnits["MegacubicFeet"] = "MegacubicFoot";
/** */
VolumeUnits["KiloimperialGallons"] = "KiloimperialGallon";
/** */
VolumeUnits["MegaimperialGallons"] = "MegaimperialGallon";
/** */
VolumeUnits["DecausGallons"] = "DecausGallon";
/** */
VolumeUnits["DeciusGallons"] = "DeciusGallon";
/** */
VolumeUnits["HectousGallons"] = "HectousGallon";
/** */
VolumeUnits["KilousGallons"] = "KilousGallon";
/** */
VolumeUnits["MegausGallons"] = "MegausGallon";
})(VolumeUnits = exports.VolumeUnits || (exports.VolumeUnits = {}));
/** Volume is the quantity of three-dimensional space enclosed by some closed boundary, for example, the space that a substance (solid, liquid, gas, or plasma) or shape occupies or contains.[1] Volume is often quantified numerically using the SI derived unit, the cubic metre. The volume of a container is generally understood to be the capacity of the container, i. e. the amount of fluid (gas or liquid) that the container could hold, rather than the amount of space the container itself displaces. */
class Volume extends base_unit_1.BaseUnit {
/**
* Create a new Volume.
* @param value The value.
* @param fromUnit The ‘Volume’ unit to create from.
* The default unit is CubicMeters
*/
constructor(value, fromUnit = VolumeUnits.CubicMeters) {
super();
this.litersLazy = null;
this.cubicmetersLazy = null;
this.cubickilometersLazy = null;
this.cubichectometersLazy = null;
this.cubicdecimetersLazy = null;
this.cubiccentimetersLazy = null;
this.cubicmillimetersLazy = null;
this.cubicmicrometersLazy = null;
this.cubicmilesLazy = null;
this.cubicyardsLazy = null;
this.cubicfeetLazy = null;
this.cubicinchesLazy = null;
this.imperialgallonsLazy = null;
this.imperialouncesLazy = null;
this.usgallonsLazy = null;
this.usouncesLazy = null;
this.ustablespoonsLazy = null;
this.autablespoonsLazy = null;
this.uktablespoonsLazy = null;
this.metricteaspoonsLazy = null;
this.usteaspoonsLazy = null;
this.metriccupsLazy = null;
this.uscustomarycupsLazy = null;
this.uslegalcupsLazy = null;
this.oilbarrelsLazy = null;
this.usbeerbarrelsLazy = null;
this.imperialbeerbarrelsLazy = null;
this.usquartsLazy = null;
this.imperialquartsLazy = null;
this.uspintsLazy = null;
this.acrefeetLazy = null;
this.imperialpintsLazy = null;
this.boardfeetLazy = null;
this.nanolitersLazy = null;
this.microlitersLazy = null;
this.millilitersLazy = null;
this.centilitersLazy = null;
this.decilitersLazy = null;
this.decalitersLazy = null;
this.hectolitersLazy = null;
this.kilolitersLazy = null;
this.megalitersLazy = null;
this.hectocubicmetersLazy = null;
this.kilocubicmetersLazy = null;
this.hectocubicfeetLazy = null;
this.kilocubicfeetLazy = null;
this.megacubicfeetLazy = null;
this.kiloimperialgallonsLazy = null;
this.megaimperialgallonsLazy = null;
this.decausgallonsLazy = null;
this.deciusgallonsLazy = null;
this.hectousgallonsLazy = null;
this.kilousgallonsLazy = null;
this.megausgallonsLazy = null;
if (value === undefined || value === null || Number.isNaN(value)) {
throw new TypeError('invalid unit value ‘' + value + '’');
}
this.value = this.convertToBase(value, fromUnit);
}
/**
* The base value of Volume is CubicMeters.
* This accessor used when needs a value for calculations and it's better to use directly the base value
*/
get BaseValue() {
return this.value;
}
/** Gets the default unit used when creating instances of the unit or its DTO */
get baseUnit() {
return VolumeUnits.CubicMeters;
}
/** */
get Liters() {
if (this.litersLazy !== null) {
return this.litersLazy;
}
return this.litersLazy = this.convertFromBase(VolumeUnits.Liters);
}
/** */
get CubicMeters() {
if (this.cubicmetersLazy !== null) {
return this.cubicmetersLazy;
}
return this.cubicmetersLazy = this.convertFromBase(VolumeUnits.CubicMeters);
}
/** */
get CubicKilometers() {
if (this.cubickilometersLazy !== null) {
return this.cubickilometersLazy;
}
return this.cubickilometersLazy = this.convertFromBase(VolumeUnits.CubicKilometers);
}
/** */
get CubicHectometers() {
if (this.cubichectometersLazy !== null) {
return this.cubichectometersLazy;
}
return this.cubichectometersLazy = this.convertFromBase(VolumeUnits.CubicHectometers);
}
/** */
get CubicDecimeters() {
if (this.cubicdecimetersLazy !== null) {
return this.cubicdecimetersLazy;
}
return this.cubicdecimetersLazy = this.convertFromBase(VolumeUnits.CubicDecimeters);
}
/** */
get CubicCentimeters() {
if (this.cubiccentimetersLazy !== null) {
return this.cubiccentimetersLazy;
}
return this.cubiccentimetersLazy = this.convertFromBase(VolumeUnits.CubicCentimeters);
}
/** */
get CubicMillimeters() {
if (this.cubicmillimetersLazy !== null) {
return this.cubicmillimetersLazy;
}
return this.cubicmillimetersLazy = this.convertFromBase(VolumeUnits.CubicMillimeters);
}
/** */
get CubicMicrometers() {
if (this.cubicmicrometersLazy !== null) {
return this.cubicmicrometersLazy;
}
return this.cubicmicrometersLazy = this.convertFromBase(VolumeUnits.CubicMicrometers);
}
/** A cubic mile (abbreviation: cu mi or mi3) is an imperial and US customary (non-SI non-metric) unit of volume, used in the United States, Canada and the United Kingdom. It is defined as the volume of a cube with sides of 1 mile (63360 inches, 5280 feet, 1760 yards or ~1.609 kilometres) in length. */
get CubicMiles() {
if (this.cubicmilesLazy !== null) {
return this.cubicmilesLazy;
}
return this.cubicmilesLazy = this.convertFromBase(VolumeUnits.CubicMiles);
}
/** A cubic yard is an Imperial / U.S. customary (non-SI non-metric) unit of volume, used in Canada and the United States. It is defined as the volume of a cube with sides of 1 yard (3 feet, 36 inches, 0.9144 meters) in length. */
get CubicYards() {
if (this.cubicyardsLazy !== null) {
return this.cubicyardsLazy;
}
return this.cubicyardsLazy = this.convertFromBase(VolumeUnits.CubicYards);
}
/** The cubic foot (symbol ft3 or cu ft) is an imperial and US customary (non-metric) unit of volume, used in the United States and the United Kingdom. It is defined as the volume of a cube with sides of one foot (0.3048 m) in length. */
get CubicFeet() {
if (this.cubicfeetLazy !== null) {
return this.cubicfeetLazy;
}
return this.cubicfeetLazy = this.convertFromBase(VolumeUnits.CubicFeet);
}
/** The cubic inch (symbol in3) is a unit of volume in the Imperial units and United States customary units systems. It is the volume of a cube with each of its three dimensions (length, width, and height) being one inch long which is equivalent to 1/231 of a US gallon. */
get CubicInches() {
if (this.cubicinchesLazy !== null) {
return this.cubicinchesLazy;
}
return this.cubicinchesLazy = this.convertFromBase(VolumeUnits.CubicInches);
}
/** The British imperial gallon (frequently called simply "gallon") is defined as exactly 4.54609 litres. */
get ImperialGallons() {
if (this.imperialgallonsLazy !== null) {
return this.imperialgallonsLazy;
}
return this.imperialgallonsLazy = this.convertFromBase(VolumeUnits.ImperialGallons);
}
/** An imperial fluid ounce is 1⁄20 of an imperial pint, 1⁄160 of an imperial gallon or exactly 28.4130625 mL. */
get ImperialOunces() {
if (this.imperialouncesLazy !== null) {
return this.imperialouncesLazy;
}
return this.imperialouncesLazy = this.convertFromBase(VolumeUnits.ImperialOunces);
}
/** The US liquid gallon (frequently called simply "gallon") is legally defined as 231 cubic inches, which is exactly 3.785411784 litres. */
get UsGallons() {
if (this.usgallonsLazy !== null) {
return this.usgallonsLazy;
}
return this.usgallonsLazy = this.convertFromBase(VolumeUnits.UsGallons);
}
/** A US customary fluid ounce is 1⁄16 of a US liquid pint and 1⁄128 of a US liquid gallon or exactly 29.5735295625 mL, making it about 4.08% larger than the imperial fluid ounce. */
get UsOunces() {
if (this.usouncesLazy !== null) {
return this.usouncesLazy;
}
return this.usouncesLazy = this.convertFromBase(VolumeUnits.UsOunces);
}
/** The traditional U.S. interpretation of the tablespoon as a unit of volume is: 1 US tablespoon = 4 fluid drams, or 3 teaspoons or 1/2 US fluid ounce (≈ 14.8 ml) */
get UsTablespoons() {
if (this.ustablespoonsLazy !== null) {
return this.ustablespoonsLazy;
}
return this.ustablespoonsLazy = this.convertFromBase(VolumeUnits.UsTablespoons);
}
/** In Australia, the definition of the tablespoon is 20 ml (0.70 imp fl oz). */
get AuTablespoons() {
if (this.autablespoonsLazy !== null) {
return this.autablespoonsLazy;
}
return this.autablespoonsLazy = this.convertFromBase(VolumeUnits.AuTablespoons);
}
/** In nutrition labeling in the U.S. and the U.K., a tablespoon is defined as 15 ml (0.51 US fl oz). In Australia, the definition of the tablespoon is 20 ml (0.70 imp fl oz). */
get UkTablespoons() {
if (this.uktablespoonsLazy !== null) {
return this.uktablespoonsLazy;
}
return this.uktablespoonsLazy = this.convertFromBase(VolumeUnits.UkTablespoons);
}
/** The metric teaspoon as a unit of culinary measure is 5 ml (0.18 imp fl oz; 0.17 US fl oz),[17] equal to 5 cm3, 1⁄3 UK/Canadian metric tablespoon, or 1⁄4 Australian metric tablespoon. */
get MetricTeaspoons() {
if (this.metricteaspoonsLazy !== null) {
return this.metricteaspoonsLazy;
}
return this.metricteaspoonsLazy = this.convertFromBase(VolumeUnits.MetricTeaspoons);
}
/** As a unit of culinary measure, one teaspoon in the United States is 1⁄3 tablespoon, exactly 4.92892159375 ml, 1 1⁄3 US fluid drams, 1⁄6 US fl oz, 1⁄48 US cup, 1⁄768 US liquid gallon, or 77⁄256 (0.30078125) cubic inches. */
get UsTeaspoons() {
if (this.usteaspoonsLazy !== null) {
return this.usteaspoonsLazy;
}
return this.usteaspoonsLazy = this.convertFromBase(VolumeUnits.UsTeaspoons);
}
/** Australia, Canada, New Zealand, and some other members of the Commonwealth of Nations, being former British colonies that have since metricated, employ a metric cup of 250 millilitres. Although derived from the metric system, it is not an SI unit. */
get MetricCups() {
if (this.metriccupsLazy !== null) {
return this.metriccupsLazy;
}
return this.metriccupsLazy = this.convertFromBase(VolumeUnits.MetricCups);
}
/** In the United States, the customary cup is half of a liquid pint or 1⁄16 US customary gallon which is 236.5882365 milliliters exactly. */
get UsCustomaryCups() {
if (this.uscustomarycupsLazy !== null) {
return this.uscustomarycupsLazy;
}
return this.uscustomarycupsLazy = this.convertFromBase(VolumeUnits.UsCustomaryCups);
}
/** The cup currently used in the United States for nutrition labelling is defined in United States law as 240 ml. */
get UsLegalCups() {
if (this.uslegalcupsLazy !== null) {
return this.uslegalcupsLazy;
}
return this.uslegalcupsLazy = this.convertFromBase(VolumeUnits.UsLegalCups);
}
/** In the oil industry, one barrel (unit symbol bbl) is a unit of volume used for measuring oil defined as exactly 42 US gallons, approximately 159 liters, or 35 imperial gallons. */
get OilBarrels() {
if (this.oilbarrelsLazy !== null) {
return this.oilbarrelsLazy;
}
return this.oilbarrelsLazy = this.convertFromBase(VolumeUnits.OilBarrels);
}
/** Fluid barrels vary depending on what is being measured and where. In the US most fluid barrels (apart from oil) are 31.5 US gallons (26 imp gal; 119 L) (half a hogshead), but a beer barrel is 31 US gallons (26 imp gal; 117 L). */
get UsBeerBarrels() {
if (this.usbeerbarrelsLazy !== null) {
return this.usbeerbarrelsLazy;
}
return this.usbeerbarrelsLazy = this.convertFromBase(VolumeUnits.UsBeerBarrels);
}
/** Fluid barrels vary depending on what is being measured and where. In the UK a beer barrel is 36 imperial gallons (43 US gal; ~164 L). */
get ImperialBeerBarrels() {
if (this.imperialbeerbarrelsLazy !== null) {
return this.imperialbeerbarrelsLazy;
}
return this.imperialbeerbarrelsLazy = this.convertFromBase(VolumeUnits.ImperialBeerBarrels);
}
/** The US liquid quart equals 57.75 cubic inches, which is exactly equal to 0.946352946 L. */
get UsQuarts() {
if (this.usquartsLazy !== null) {
return this.usquartsLazy;
}
return this.usquartsLazy = this.convertFromBase(VolumeUnits.UsQuarts);
}
/** The imperial quart, which is used for both liquid and dry capacity, is equal to one quarter of an imperial gallon, or exactly 1.1365225 liters. */
get ImperialQuarts() {
if (this.imperialquartsLazy !== null) {
return this.imperialquartsLazy;
}
return this.imperialquartsLazy = this.convertFromBase(VolumeUnits.ImperialQuarts);
}
/** The pint is a unit of volume or capacity in both the imperial and United States customary measurement systems. In both of those systems it is traditionally one eighth of a gallon. The British imperial pint is about 20% larger than the American pint because the two systems are defined differently. */
get UsPints() {
if (this.uspintsLazy !== null) {
return this.uspintsLazy;
}
return this.uspintsLazy = this.convertFromBase(VolumeUnits.UsPints);
}
/** An acre-foot is 43,560 cubic feet (~1,233.5 m3). */
get AcreFeet() {
if (this.acrefeetLazy !== null) {
return this.acrefeetLazy;
}
return this.acrefeetLazy = this.convertFromBase(VolumeUnits.AcreFeet);
}
/** The pint is a unit of volume or capacity in both the imperial and United States customary measurement systems. In both of those systems it is traditionally one eighth of a gallon. The British imperial pint is about 20% larger than the American pint because the two systems are defined differently. */
get ImperialPints() {
if (this.imperialpintsLazy !== null) {
return this.imperialpintsLazy;
}
return this.imperialpintsLazy = this.convertFromBase(VolumeUnits.ImperialPints);
}
/** The board foot or board-foot is a unit of measurement for the volume of lumber in the United States and Canada. It equals the volume of a board that is one-foot (305 mm) in length, one-foot (305 mm) in width, and one-inch (25.4 mm) in thickness. */
get BoardFeet() {
if (this.boardfeetLazy !== null) {
return this.boardfeetLazy;
}
return this.boardfeetLazy = this.convertFromBase(VolumeUnits.BoardFeet);
}
/** */
get Nanoliters() {
if (this.nanolitersLazy !== null) {
return this.nanolitersLazy;
}
return this.nanolitersLazy = this.convertFromBase(VolumeUnits.Nanoliters);
}
/** */
get Microliters() {
if (this.microlitersLazy !== null) {
return this.microlitersLazy;
}
return this.microlitersLazy = this.convertFromBase(VolumeUnits.Microliters);
}
/** */
get Milliliters() {
if (this.millilitersLazy !== null) {
return this.millilitersLazy;
}
return this.millilitersLazy = this.convertFromBase(VolumeUnits.Milliliters);
}
/** */
get Centiliters() {
if (this.centilitersLazy !== null) {
return this.centilitersLazy;
}
return this.centilitersLazy = this.convertFromBase(VolumeUnits.Centiliters);
}
/** */
get Deciliters() {
if (this.decilitersLazy !== null) {
return this.decilitersLazy;
}
return this.decilitersLazy = this.convertFromBase(VolumeUnits.Deciliters);
}
/** */
get Decaliters() {
if (this.decalitersLazy !== null) {
return this.decalitersLazy;
}
return this.decalitersLazy = this.convertFromBase(VolumeUnits.Decaliters);
}
/** */
get Hectoliters() {
if (this.hectolitersLazy !== null) {
return this.hectolitersLazy;
}
return this.hectolitersLazy = this.convertFromBase(VolumeUnits.Hectoliters);
}
/** */
get Kiloliters() {
if (this.kilolitersLazy !== null) {
return this.kilolitersLazy;
}
return this.kilolitersLazy = this.convertFromBase(VolumeUnits.Kiloliters);
}
/** */
get Megaliters() {
if (this.megalitersLazy !== null) {
return this.megalitersLazy;
}
return this.megalitersLazy = this.convertFromBase(VolumeUnits.Megaliters);
}
/** */
get HectocubicMeters() {
if (this.hectocubicmetersLazy !== null) {
return this.hectocubicmetersLazy;
}
return this.hectocubicmetersLazy = this.convertFromBase(VolumeUnits.HectocubicMeters);
}
/** */
get KilocubicMeters() {
if (this.kilocubicmetersLazy !== null) {
return this.kilocubicmetersLazy;
}
return this.kilocubicmetersLazy = this.convertFromBase(VolumeUnits.KilocubicMeters);
}
/** */
get HectocubicFeet() {
if (this.hectocubicfeetLazy !== null) {
return this.hectocubicfeetLazy;
}
return this.hectocubicfeetLazy = this.convertFromBase(VolumeUnits.HectocubicFeet);
}
/** */
get KilocubicFeet() {
if (this.kilocubicfeetLazy !== null) {
return this.kilocubicfeetLazy;
}
return this.kilocubicfeetLazy = this.convertFromBase(VolumeUnits.KilocubicFeet);
}
/** */
get MegacubicFeet() {
if (this.megacubicfeetLazy !== null) {
return this.megacubicfeetLazy;
}
return this.megacubicfeetLazy = this.convertFromBase(VolumeUnits.MegacubicFeet);
}
/** */
get KiloimperialGallons() {
if (this.kiloimperialgallonsLazy !== null) {
return this.kiloimperialgallonsLazy;
}
return this.kiloimperialgallonsLazy = this.convertFromBase(VolumeUnits.KiloimperialGallons);
}
/** */
get MegaimperialGallons() {
if (this.megaimperialgallonsLazy !== null) {
return this.megaimperialgallonsLazy;
}
return this.megaimperialgallonsLazy = this.convertFromBase(VolumeUnits.MegaimperialGallons);
}
/** */
get DecausGallons() {
if (this.decausgallonsLazy !== null) {
return this.decausgallonsLazy;
}
return this.decausgallonsLazy = this.convertFromBase(VolumeUnits.DecausGallons);
}
/** */
get DeciusGallons() {
if (this.deciusgallonsLazy !== null) {
return this.deciusgallonsLazy;
}
return this.deciusgallonsLazy = this.convertFromBase(VolumeUnits.DeciusGallons);
}
/** */
get HectousGallons() {
if (this.hectousgallonsLazy !== null) {
return this.hectousgallonsLazy;
}
return this.hectousgallonsLazy = this.convertFromBase(VolumeUnits.HectousGallons);
}
/** */
get KilousGallons() {
if (this.kilousgallonsLazy !== null) {
return this.kilousgallonsLazy;
}
return this.kilousgallonsLazy = this.convertFromBase(VolumeUnits.KilousGallons);
}
/** */
get MegausGallons() {
if (this.megausgallonsLazy !== null) {
return this.megausgallonsLazy;
}
return this.megausgallonsLazy = this.convertFromBase(VolumeUnits.MegausGallons);
}
/**
* Create a new Volume instance from a Liters
*
* @param value The unit as Liters to create a new Volume from.
* @returns The new Volume instance.
*/
static FromLiters(value) {
return new Volume(value, VolumeUnits.Liters);
}
/**
* Create a new Volume instance from a CubicMeters
*
* @param value The unit as CubicMeters to create a new Volume from.
* @returns The new Volume instance.
*/
static FromCubicMeters(value) {
return new Volume(value, VolumeUnits.CubicMeters);
}
/**
* Create a new Volume instance from a CubicKilometers
*
* @param value The unit as CubicKilometers to create a new Volume from.
* @returns The new Volume instance.
*/
static FromCubicKilometers(value) {
return new Volume(value, VolumeUnits.CubicKilometers);
}
/**
* Create a new Volume instance from a CubicHectometers
*
* @param value The unit as CubicHectometers to create a new Volume from.
* @returns The new Volume instance.
*/
static FromCubicHectometers(value) {
return new Volume(value, VolumeUnits.CubicHectometers);
}
/**
* Create a new Volume instance from a CubicDecimeters
*
* @param value The unit as CubicDecimeters to create a new Volume from.
* @returns The new Volume instance.
*/
static FromCubicDecimeters(value) {
return new Volume(value, VolumeUnits.CubicDecimeters);
}
/**
* Create a new Volume instance from a CubicCentimeters
*
* @param value The unit as CubicCentimeters to create a new Volume from.
* @returns The new Volume instance.
*/
static FromCubicCentimeters(value) {
return new Volume(value, VolumeUnits.CubicCentimeters);
}
/**
* Create a new Volume instance from a CubicMillimeters
*
* @param value The unit as CubicMillimeters to create a new Volume from.
* @returns The new Volume instance.
*/
static FromCubicMillimeters(value) {
return new Volume(value, VolumeUnits.CubicMillimeters);
}
/**
* Create a new Volume instance from a CubicMicrometers
*
* @param value The unit as CubicMicrometers to create a new Volume from.
* @returns The new Volume instance.
*/
static FromCubicMicrometers(value) {
return new Volume(value, VolumeUnits.CubicMicrometers);
}
/**
* Create a new Volume instance from a CubicMiles
* A cubic mile (abbreviation: cu mi or mi3) is an imperial and US customary (non-SI non-metric) unit of volume, used in the United States, Canada and the United Kingdom. It is defined as the volume of a cube with sides of 1 mile (63360 inches, 5280 feet, 1760 yards or ~1.609 kilometres) in length.
* @param value The unit as CubicMiles to create a new Volume from.
* @returns The new Volume instance.
*/
static FromCubicMiles(value) {
return new Volume(value, VolumeUnits.CubicMiles);
}
/**
* Create a new Volume instance from a CubicYards
* A cubic yard is an Imperial / U.S. customary (non-SI non-metric) unit of volume, used in Canada and the United States. It is defined as the volume of a cube with sides of 1 yard (3 feet, 36 inches, 0.9144 meters) in length.
* @param value The unit as CubicYards to create a new Volume from.
* @returns The new Volume instance.
*/
static FromCubicYards(value) {
return new Volume(value, VolumeUnits.CubicYards);
}
/**
* Create a new Volume instance from a CubicFeet
* The cubic foot (symbol ft3 or cu ft) is an imperial and US customary (non-metric) unit of volume, used in the United States and the United Kingdom. It is defined as the volume of a cube with sides of one foot (0.3048 m) in length.
* @param value The unit as CubicFeet to create a new Volume from.
* @returns The new Volume instance.
*/
static FromCubicFeet(value) {
return new Volume(value, VolumeUnits.CubicFeet);
}
/**
* Create a new Volume instance from a CubicInches
* The cubic inch (symbol in3) is a unit of volume in the Imperial units and United States customary units systems. It is the volume of a cube with each of its three dimensions (length, width, and height) being one inch long which is equivalent to 1/231 of a US gallon.
* @param value The unit as CubicInches to create a new Volume from.
* @returns The new Volume instance.
*/
static FromCubicInches(value) {
return new Volume(value, VolumeUnits.CubicInches);
}
/**
* Create a new Volume instance from a ImperialGallons
* The British imperial gallon (frequently called simply "gallon") is defined as exactly 4.54609 litres.
* @param value The unit as ImperialGallons to create a new Volume from.
* @returns The new Volume instance.
*/
static FromImperialGallons(value) {
return new Volume(value, VolumeUnits.ImperialGallons);
}
/**
* Create a new Volume instance from a ImperialOunces
* An imperial fluid ounce is 1⁄20 of an imperial pint, 1⁄160 of an imperial gallon or exactly 28.4130625 mL.
* @param value The unit as ImperialOunces to create a new Volume from.
* @returns The new Volume instance.
*/
static FromImperialOunces(value) {
return new Volume(value, VolumeUnits.ImperialOunces);
}
/**
* Create a new Volume instance from a UsGallons
* The US liquid gallon (frequently called simply "gallon") is legally defined as 231 cubic inches, which is exactly 3.785411784 litres.
* @param value The unit as UsGallons to create a new Volume from.
* @returns The new Volume instance.
*/
static FromUsGallons(value) {
return new Volume(value, VolumeUnits.UsGallons);
}
/**
* Create a new Volume instance from a UsOunces
* A US customary fluid ounce is 1⁄16 of a US liquid pint and 1⁄128 of a US liquid gallon or exactly 29.5735295625 mL, making it about 4.08% larger than the imperial fluid ounce.
* @param value The unit as UsOunces to create a new Volume from.
* @returns The new Volume instance.
*/
static FromUsOunces(value) {
return new Volume(value, VolumeUnits.UsOunces);
}
/**
* Create a new Volume instance from a UsTablespoons
* The traditional U.S. interpretation of the tablespoon as a unit of volume is: 1 US tablespoon = 4 fluid drams, or 3 teaspoons or 1/2 US fluid ounce (≈ 14.8 ml)
* @param value The unit as UsTablespoons to create a new Volume from.
* @returns The new Volume instance.
*/
static FromUsTablespoons(value) {
return new Volume(value, VolumeUnits.UsTablespoons);
}
/**
* Create a new Volume instance from a AuTablespoons
* In Australia, the definition of the tablespoon is 20 ml (0.70 imp fl oz).
* @param value The unit as AuTablespoons to create a new Volume from.
* @returns The new Volume instance.
*/
static FromAuTablespoons(value) {
return new Volume(value, VolumeUnits.AuTablespoons);
}
/**
* Create a new Volume instance from a UkTablespoons
* In nutrition labeling in the U.S. and the U.K., a tablespoon is defined as 15 ml (0.51 US fl oz). In Australia, the definition of the tablespoon is 20 ml (0.70 imp fl oz).
* @param value The unit as UkTablespoons to create a new Volume from.
* @returns The new Volume instance.
*/
static FromUkTablespoons(value) {
return new Volume(value, VolumeUnits.UkTablespoons);
}
/**
* Create a new Volume instance from a MetricTeaspoons
* The metric teaspoon as a unit of culinary measure is 5 ml (0.18 imp fl oz; 0.17 US fl oz),[17] equal to 5 cm3, 1⁄3 UK/Canadian metric tablespoon, or 1⁄4 Australian metric tablespoon.
* @param value The unit as MetricTeaspoons to create a new Volume from.
* @returns The new Volume instance.
*/
static FromMetricTeaspoons(value) {
return new Volume(value, VolumeUnits.MetricTeaspoons);
}
/**
* Create a new Volume instance from a UsTeaspoons
* As a unit of culinary measure, one teaspoon in the United States is 1⁄3 tablespoon, exactly 4.92892159375 ml, 1 1⁄3 US fluid drams, 1⁄6 US fl oz, 1⁄48 US cup, 1⁄768 US liquid gallon, or 77⁄256 (0.30078125) cubic inches.
* @param value The unit as UsTeaspoons to create a new Volume from.
* @returns The new Volume instance.
*/
static FromUsTeaspoons(value) {
return new Volume(value, VolumeUnits.UsTeaspoons);
}
/**
* Create a new Volume instance from a MetricCups
* Australia, Canada, New Zealand, and some other members of the Commonwealth of Nations, being former British colonies that have since metricated, employ a metric cup of 250 millilitres. Although derived from the metric system, it is not an SI unit.
* @param value The unit as MetricCups to create a new Volume from.
* @returns The new Volume instance.
*/
static FromMetricCups(value) {
return new Volume(value, VolumeUnits.MetricCups);
}
/**
* Create a new Volume instance from a UsCustomaryCups
* In the United States, the customary cup is half of a liquid pint or 1⁄16 US customary gallon which is 236.5882365 milliliters exactly.
* @param value The unit as UsCustomaryCups to create a new Volume from.
* @returns The new Volume instance.
*/
static FromUsCustomaryCups(value) {
return new Volume(value, VolumeUnits.UsCustomaryCups);
}
/**
* Create a new Volume instance from a UsLegalCups
* The cup currently used in the United States for nutrition labelling is defined in United States law as 240 ml.
* @param value The unit as UsLegalCups to create a new Volume from.
* @returns The new Volume instance.
*/
static FromUsLegalCups(value) {
return new Volume(value, VolumeUnits.UsLegalCups);
}
/**
* Create a new Volume instance from a OilBarrels
* In the oil industry, one barrel (unit symbol bbl) is a unit of volume used for measuring oil defined as exactly 42 US gallons, approximately 159 liters, or 35 imperial gallons.
* @param value The unit as OilBarrels to create a new Volume from.
* @returns The new Volume instance.
*/
static FromOilBarrels(value) {
return new Volume(value, VolumeUnits.OilBarrels);
}
/**
* Create a new Volume instance from a UsBeerBarrels
* Fluid barrels vary depending on what is being measured and where. In the US most fluid barrels (apart from oil) are 31.5 US gallons (26 imp gal; 119 L) (half a hogshead), but a beer barrel is 31 US gallons (26 imp gal; 117 L).
* @param value The unit as UsBeerBarrels to create a new Volume from.
* @returns The new Volume instance.
*/
static FromUsBeerBarrels(value) {
return new Volume(value, VolumeUnits.UsBeerBarrels);
}
/**
* Create a new Volume instance from a ImperialBeerBarrels
* Fluid barrels vary depending on what is being measured and where. In the UK a beer barrel is 36 imperial gallons (43 US gal; ~164 L).
* @param value The unit as ImperialBeerBarrels to create a new Volume from.
* @returns The new Volume instance.
*/
static FromImperialBeerBarrels(value) {
return new Volume(value, VolumeUnits.ImperialBeerBarrels);
}
/**
* Create a new Volume instance from a UsQuarts
* The US liquid quart equals 57.75 cubic inches, which is exactly equal to 0.946352946 L.
* @param value The unit as UsQuarts to create a new Volume from.
* @returns The new Volume instance.
*/
static FromUsQuarts(value) {
return new Volume(value, VolumeUnits.UsQuarts);
}
/**
* Create a new Volume instance from a ImperialQuarts
* The imperial quart, which is used for both liquid and dry capacity, is equal to one quarter of an imperial gallon, or exactly 1.1365225 liters.
* @param value The unit as ImperialQuarts to create a new Volume from.
* @returns The new Volume instance.
*/
static FromImperialQuarts(value) {
return new Volume(value, VolumeUnits.ImperialQuarts);
}
/**
* Create a new Volume instance from a UsPints
* The pint is a unit of volume or capacity in both the imperial and United States customary measurement systems. In both of those systems it is traditionally one eighth of a gallon. The British imperial pint is about 20% larger than the American pint because the two systems are defined differently.
* @param value The unit as UsPints to create a new Volume from.
* @returns The new Volume instance.
*/
static FromUsPints(value) {
return new Volume(value, VolumeUnits.UsPints);
}
/**
* Create a new Volume instance from a AcreFeet
* An acre-foot is 43,560 cubic feet (~1,233.5 m3).
* @param value The unit as AcreFeet to create a new Volume from.
* @returns The new Volume instance.
*/
static FromAcreFeet(value) {
return new Volume(value, VolumeUnits.AcreFeet);
}
/**
* Create a new Volume instance from a ImperialPints
* The pint is a unit of volume or capacity in both the imperial and United States customary measurement systems. In both of those systems it is traditionally one eighth of a gallon. The British imperial pint is about 20% larger than the American pint because the two systems are defined differently.
* @param value The unit as ImperialPints to create a new Volume from.
* @returns The new Volume instance.
*/
static FromImperialPints(value) {
return new Volume(value, VolumeUnits.ImperialPints);
}
/**
* Create a new Volume instance from a BoardFeet
* The board foot or board-foot is a unit of measurement for the volume of lumber in the United States and Canada. It equals the volume of a board that is one-foot (305 mm) in length, one-foot (305 mm) in width, and one-inch (25.4 mm) in thickness.
* @param value The unit as BoardFeet to create a new Volume from.
* @returns The new Volume instance.
*/
static FromBoardFeet(value) {
return new Volume(value, VolumeUnits.BoardFeet);
}
/**
* Create a new Volume instance from a Nanoliters
*
* @param value The unit as Nanoliters to create a new Volume from.
* @returns The new Volume instance.
*/
static FromNanoliters(value) {
return new Volume(value, VolumeUnits.Nanoliters);
}
/**
* Create a new Volume instance from a Microliters
*
* @param value The unit as Microliters to create a new Volume from.
* @returns The new Volume instance.
*/
static FromMicroliters(value) {
return new Volume(value, VolumeUnits.Microliters);
}
/**
* Create a new Volume instance from a Milliliters
*
* @param value The unit as Milliliters to create a new Volume from.
* @returns The new Volume instance.
*/
static FromMilliliters(value) {
return new Volume(value, VolumeUnits.Milliliters);
}
/**
* Create a new Volume instance from a Centiliters
*
* @param value The unit as Centiliters to create a new Volume from.
* @returns The new Volume instance.
*/
static FromCentiliters(value) {
return new Volume(value, VolumeUnits.Centiliters);
}
/**
* Create a new Volume instance from a Deciliters
*
* @param value The unit as Deciliters to create a new Volume from.
* @returns The new Volume instance.
*/
static FromDeciliters(value) {
return new Volume(value, VolumeUnits.Deciliters);
}
/**
* Create a new Volume instance from a Decaliters
*
* @param value The unit as Decaliters to create a new Volume from.
* @returns The new Volume instance.
*/
static FromDecaliters(value) {
return new Volume(value, VolumeUnits.Decaliters);
}
/**
* Create a new Volume instance from a Hectoliters
*
* @param value The unit as Hectoliters to create a new Volume from.
* @returns The new Volume instance.
*/
static FromHectoliters(value) {
return new Volume(value, VolumeUnits.Hectoliters);
}
/**
* Create a new Volume instance from a Kiloliters
*
* @param value The unit as Kiloliters to create a new Volume from.
* @returns The new Volume instance.
*/
static FromKiloliters(value) {
return new Volume(value, VolumeUnits.Kiloliters);
}
/**
* Create a new Volume instance from a Megaliters
*
* @param value The unit as Megaliters to create a new Volume from.
* @returns The new Volume instance.
*/
static FromMegaliters(value) {
return new Volume(value, VolumeUnits.Megaliters);
}
/**
* Create a new Volume instance from a HectocubicMeters
*
* @param value The unit as HectocubicMeters to create a new Volume from.
* @returns The new Volume instance.
*/
static FromHectocubicMeters(value) {
return new Volume(value, VolumeUnits.HectocubicMeters);
}
/**
* Create a new Volume instance from a KilocubicMeters
*
* @param value The unit as KilocubicMeters to create a new Volume from.
* @returns The new Volume instance.
*/
static FromKilocubicMeters(value) {
return new Volume(value, VolumeUnits.KilocubicMeters);
}
/**
* Create a new Volume instance from a HectocubicFeet
*
* @param value The unit as HectocubicFeet to create a new Volume from.
* @returns The new Volume instance.
*/
static FromHectocubicFeet(value) {
return new Volume(value, VolumeUnits.HectocubicFeet);
}
/**
* Create a new Volume instance from a KilocubicFeet
*
* @param value The unit as KilocubicFeet to create a new Volume from.
* @returns The new Volume instance.
*/
static FromKilocubicFeet(value) {
return new Volume(value, VolumeUnits.KilocubicFeet);
}
/**
* Create a new Volume instance from a MegacubicFeet
*
* @param value The unit as MegacubicFeet to create a new Volume from.
* @returns The new Volume instance.
*/
static FromMegacubicFeet(value) {
return new Volume(value, VolumeUnits.MegacubicFeet);
}
/**
* Create a new Volume instance from a KiloimperialGallons
*
* @param value The unit as KiloimperialGallons to create a new Volume from.
* @returns The new Volume instance.
*/
static FromKiloimperialGallons(value) {
return new Volume(value, VolumeUnits.KiloimperialGallons);
}
/**
* Create a new Volume instance from a MegaimperialGallons
*
* @param value The unit as MegaimperialGallons to create a new Volume from.
* @returns The new Volume instance.
*/
static FromMegaimperialGallons(value) {
return new Volume(value, VolumeUnits.MegaimperialGallons);
}
/**
* Create a new Volume instance from a DecausGallons
*
* @param value The unit as DecausGallons to create a new Volume from.
* @returns The new Volume instance.
*/
static FromDecausGallons(value) {
return new Volume(value, VolumeUnits.DecausGallons);
}
/**
* Create a new Volume instance from a DeciusGallons
*
* @param value The unit as DeciusGallons to create a new Volume from.
* @returns The new Volume instance.
*/
static FromDeciusGallons(value) {
return new Volume(value, VolumeUnits.DeciusGallons);
}
/**
* Create a new Volume instance from a HectousGallons
*
* @param value The unit as HectousGallons to create a new Volume from.
* @returns The new Volume instance.
*/
static FromHectousGallons(value) {
return new Volume(value, VolumeUnits.HectousGallons);
}
/**
* Create a new Volume instance from a KilousGallons
*
* @param value The unit as KilousGallons to create a new Volume from.
* @returns The new Volume instance.
*/
static FromKilousGallons(value) {
return new Volume(value, VolumeUnits.KilousGallons);
}
/**
* Create a new Volume instance from a MegausGallons
*
* @param value The unit as MegausGallons to create a new Volume from.
* @returns The new Volume instance.
*/
static FromMegausGallons(value) {
return new Volume(value, VolumeUnits.MegausGallons);
}
/**
* Gets the base unit enumeration associated with Volume
* @returns The unit enumeration that can be used to interact with this type
*/
static getUnitEnum() {
return VolumeUnits;
}
/**
* Gets the default unit used when creating instances of the unit or its DTO
* @returns The unit enumeration value used as a default parameter in constructor and DTO methods
*/
static getBaseUnit() {
return VolumeUnits.CubicMeters;
}
/**
* Create API DTO represent a Volume unit.
* @param holdInUnit The specific Volume unit to be used in the unit representation at the DTO
*/
toDto(holdInUnit = VolumeUnits.CubicMeters) {
return {
value: this.convert(holdInUnit),
unit: holdInUnit
};
}
/**
* Create a Volume unit from an API DTO representation.
* @param dtoVolume The Volume API DTO representation
*/
st