/** * Sets the system of units. This must be called before any call to * <code>instance()</code>. * * @param instance * The system of units. * @throws UnitSystemException * <code>instance()</code> was called earlier. */ public static synchronized void setInstance(final UnitSystem instance) throws UnitSystemException { if (instance != null) { throw new UnitSystemException("Unit system already used"); } UnitSystemManager.instance = instance; } }
LOGGER.fine(e1.getLocalizedMessage());
/** * Sets the system of units. This must be called before any call to * <code>instance()</code>. * * @param instance * The system of units. * @throws UnitSystemException * <code>instance()</code> was called earlier. */ public static synchronized void setInstance(final UnitSystem instance) throws UnitSystemException { if (instance != null) { throw new UnitSystemException("Unit system already used"); } UnitSystemManager.instance = instance; } }
/** * Returns an instance of the SI system of units. * * @return An instance of the SI system of units. * @throws UnitSystemException Couldn't create an instance of the SI system of units. */ public static synchronized SI instance() throws UnitSystemException { if (si == null) { try { si = new SI(); } catch (final UnitException e) { throw new UnitSystemException("Couldn't initialize class SI", e); } } return si; }
/** * Returns an instance of the SI system of units. * * @return An instance of the SI system of units. * @throws UnitSystemException * Couldn't create an instance of the SI system of units. */ public static SI instance() throws UnitSystemException { synchronized (SI.class) { if (si == null) { try { si = new SI(); } catch (final UnitException e) { throw new UnitSystemException( "Couldn't initialize class SI", e); } } } return si; }