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