public void addUnit ( final Unit unit ) throws UnitExistsException , NameException { if ( unit . getName ( ) == null ) { throw new NameException ( "Unit name can't be null" ) ; } addByName ( unit . getName ( ) , unit ) ; addByName ( unit . getPlural ( ) , unit ) ; addBySymbol ( unit . getSymbol ( ) , unit ) ; unitSet . add ( unit ) ; }
Adds a unit to the database .