001package com.hfg.units;
002
003
004import java.util.HashMap;
005import java.util.Map;
006
007//------------------------------------------------------------------------------
008/**
009 International System of Units.
010 <div>
011 @author J. Alex Taylor, hairyfatguy.com
012 </div>
013 */
014//------------------------------------------------------------------------------
015// com.hfg XML/HTML Coding Library
016//
017// This library is free software; you can redistribute it and/or
018// modify it under the terms of the GNU Lesser General Public
019// License as published by the Free Software Foundation; either
020// version 2.1 of the License, or (at your option) any later version.
021//
022// This library is distributed in the hope that it will be useful,
023// but WITHOUT ANY WARRANTY; without even the implied warranty of
024// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
025// Lesser General Public License for more details.
026//
027// You should have received a copy of the GNU Lesser General Public
028// License along with this library; if not, write to the Free Software
029// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
030//
031// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com
032// jataylor@hairyfatguy.com
033//------------------------------------------------------------------------------
034
035public class SI_System extends MeasurementSystem
036{
037   private Map<QuantityType, Unit> mBaseUnitMap;
038
039   private static SI_System sInstance;
040
041   //###########################################################################
042   // CONSTRUCTORS
043   //###########################################################################
044
045   //---------------------------------------------------------------------------
046   protected SI_System()
047   {
048      super("International system",    "SI");
049   }
050
051   //###########################################################################
052   // PUBLIC METHODS
053   //###########################################################################
054
055   //---------------------------------------------------------------------------
056   public static synchronized SI_System getInstance()
057   {
058      if (null == sInstance)
059      {
060         sInstance = new SI_System();
061      }
062
063      return sInstance;
064   }
065
066   //###########################################################################
067   // PROTECTED METHODS
068   //###########################################################################
069
070   //---------------------------------------------------------------------------
071   protected synchronized Map<QuantityType, Unit> getBaseUnitMap()
072   {
073      if (null == mBaseUnitMap)
074      {
075         mBaseUnitMap = new HashMap<>();
076         mBaseUnitMap.put(QuantityType.LENGTH, LengthUnit.meter);
077         mBaseUnitMap.put(QuantityType.TIME, TimeUnit.second);
078         mBaseUnitMap.put(QuantityType.MASS, new Unit(new SubUnit(MassUnit.gram, SI_ScalingFactor.kilo)));
079         mBaseUnitMap.put(QuantityType.TIME, TimeUnit.second);
080         mBaseUnitMap.put(QuantityType.TEMPERATURE, TemperatureUnit.Celcius);
081         mBaseUnitMap.put(QuantityType.AMOUNT_OF_SUBSTANCE, AmountOfSubstanceUnit.mole);
082         mBaseUnitMap.put(QuantityType.ELECTRIC_CURRENT, ElectricCurrentUnit.ampere);
083         mBaseUnitMap.put(QuantityType.LUMINOUS_INTENSITY, LuminousIntensityUnit.candela);
084         mBaseUnitMap.put(QuantityType.CATALYTIC_ACTIVITY, CatalyticActivityUnit.katal);
085/*
086      mBaseUnitMap.put(BaseQuantity.AMOUNT_OF_SUBSTANCE, SubstanceUnit.mole);
087      mBaseUnitMap.put(BaseQuantity.ELECTRIC_CURRENT, CurrentUnit.ampere);
088*/
089         mBaseUnitMap.put(QuantityType.AREA, AreaUnit.sq_meter);
090      }
091
092      return mBaseUnitMap;
093   }
094
095}