com.hfg.units.ConcentrationUnit Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com_hfg Show documentation
Show all versions of com_hfg Show documentation
com.hfg xml, html, svg, and bioinformatics utility library
package com.hfg.units;
import java.util.HashMap;
import java.util.Map;
//------------------------------------------------------------------------------
/**
Enumeration of concentration types.
@author J. Alex Taylor, hairyfatguy.com
*/
//------------------------------------------------------------------------------
// com.hfg XML/HTML Coding Library
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com
// [email protected]
//------------------------------------------------------------------------------
// https://en.wikipedia.org/wiki/Concentration
public class ConcentrationUnit extends Unit
{
private static Map sInstanceMap = new HashMap<>();
public static final ConcentrationUnit molarity = new ConcentrationUnit(MeasurementSystem.SI, "molarity", "M", new SubUnit(AmountOfSubstanceUnit.mole), new SubUnit(VolumeUnit.liter, -1));
public static final ConcentrationUnit molality = new ConcentrationUnit(MeasurementSystem.SI, "molality", "", new SubUnit(AmountOfSubstanceUnit.mole), new SubUnit(MassUnit.gram, SI_ScalingFactor.kilo, -1));
/** Volume fraction is the volume of a substance divided by the volume of the total mixture */
public static final ConcentrationUnit volume_fraction = new ConcentrationUnit(MeasurementSystem.SI, "volume fraction", "", new SubUnit(VolumeUnit.liter), new SubUnit(VolumeUnit.liter, -1));
/** Mass fraction is the mass of a substance divided by the mass of the total mixture */
public static final ConcentrationUnit mass_fraction = new ConcentrationUnit(MeasurementSystem.SI, "mass fraction", "", new SubUnit(MassUnit.gram, SI_ScalingFactor.kilo), new SubUnit(MassUnit.gram, SI_ScalingFactor.kilo, -1));
//---------------------------------------------------------------------------
private ConcentrationUnit(MeasurementSystem inSystem, String inName, String inAbbrev, SubUnit... inSubUnits)
{
this(inSystem, inName, inAbbrev, null, null, inSubUnits);
}
//---------------------------------------------------------------------------
private ConcentrationUnit(MeasurementSystem inSystem, String inName, String inAbbrev, Integer inPow, BaseSIUnitConverter inConversionToBaseSIUnit, SubUnit[] inSubUnits)
{
super(inSystem, QuantityType.CONCENTRATION, inName, inAbbrev, inPow, inConversionToBaseSIUnit, inSubUnits);
sInstanceMap.put(name(), this);
sInstanceMap.put(getAbbrev(), this);
}
}