Example #1
0
 /**
  * Constructs or retrieves an existing quotient unit using the default name and symbol.
  *
  * <p>The default name is "<i>dividend name</i> per <i>divisor name</i>".
  *
  * <p>The default symbol name is "<i>dividend symbol</i>/<i>divisor symbol</i>".
  *
  * <p>See {@link UnitFactory#getOrCreateQuotient(String, String, Unit, Unit, UnitConverter)} for
  * information on how the unit dimension and SI unit of that dimension are extrapolated.
  *
  * @param dividend is the unit that defines the dividend of the quotient
  * @param divisor is the unit that defined the divisor of the quotient
  * @param converter is the converter that will be used to transform values of the the new unit
  *     into and from the SI unit for the corresponding dimension.
  */
 public static Unit getOrCreateQuotient(Unit dividend, Unit divisor, UnitConverter converter) {
   return UnitFactory.getOrCreateQuotient(
       QuotientUnit.getDefaultName(dividend, divisor),
       QuotientUnit.getDefaultSymbol(dividend, divisor),
       dividend,
       divisor,
       converter);
 }
Example #2
0
 static void addQuotient(QuotientUnit quotient) {
   Map<Unit, QuotientUnit> unitsWithDividend =
       UnitFactory.DIVIDEND_AND_DIVISOR_TO_QUOTIENT.get(quotient.getDividend());
   if (unitsWithDividend == null) {
     unitsWithDividend = new HashMap<Unit, QuotientUnit>();
   }
   unitsWithDividend.put(quotient.getDivisor(), quotient);
   UnitFactory.DIVIDEND_AND_DIVISOR_TO_QUOTIENT.put(quotient.getDividend(), unitsWithDividend);
 }
Example #3
0
 /**
  * Constructs or retrieves an existing SI quotient unit using the default name and symbol.
  *
  * <p>The default name is "<i>dividend SI unit name</i> per <i>divisor SI unit name</i>".
  *
  * <p>The default symbol name is "<i>dividend SI unit symbol</i>/<i>divisor SI unit symbol</i>".
  *
  * <p>See {@link UnitFactory#getOrCreateQuotient(String, String, Unit, Unit, UnitConverter)} for
  * information on how the unit dimension and SI unit of that dimension are extrapolated.
  *
  * @param dividend is the unit that defines the dividend of the quotient
  * @param divisor is the unit that defined the divisor of the quotient
  */
 public static Unit getOrCreateSIQuotient(Dimension dividend, Dimension divisor) {
   Unit dividendUnit = dividend.getSIUnit();
   Unit divisorUnit = divisor.getSIUnit();
   return UnitFactory.getOrCreateSIQuotient(
       QuotientUnit.getDefaultName(dividendUnit, divisorUnit),
       QuotientUnit.getDefaultSymbol(dividendUnit, divisorUnit),
       dividend,
       divisor);
 }