コード例 #1
0
ファイル: UnitFactory.java プロジェクト: yhuiz/units
 /**
  * Constructs or retrieves an existing quotient SI unit.
  *
  * <p>When a new quotient unit is created the corresponding dimension and SI unit will be created
  * too.
  *
  * <p>The dimension is created (if it doesn't exist yet) by using the provided units dimensions,
  * triggering the creation of the corresponding SI unit.
  *
  * <p>If the default values used to create either the dimension or the SI unit don't reflect the
  * conventions in use then instead of relying on automatic creating one should create the
  * dimension before.
  *
  * @param dividend is the dimension that defines the dividend of the quotient
  * @param divisor is the dimension that defined the divisor of the quotient
  * @param name is the name to be used by this unit.
  * @param symbol is the symbol to be used.
  */
 public static Unit getOrCreateSIQuotient(
     String name, String symbol, Dimension dividend, Dimension divisor) {
   return UnitFactory.getOrCreateQuotient(
       name, symbol, dividend.getSIUnit(), divisor.getSIUnit(), SIUnitConverter.getInstance());
 }
コード例 #2
0
ファイル: UnitFactory.java プロジェクト: yhuiz/units
 /**
  * Constructs or retrieves an existing SI product unit.
  *
  * <p>The dimension is created (if it doesn't exist yet) by using the provided units dimensions,
  * triggering the creation of the corresponding SI unit. See {@link
  * DimensionFactory#getOrCreateProduct(String, String, NamingProvider, Dimension...)} for details
  * on how the SI unit is created.
  *
  * <p>If the default values used to create either the dimension or the SI unit don't reflect the
  * conventions in use then instead of relying on automatic creating one should create the
  * dimension before.
  *
  * @param name is the name to be used by this unit.
  * @param symbol is the symbol to be used.
  * @param units are the factor units that compose the product of this unit.
  */
 public static Unit getOrCreateSIProduct(String name, String symbol, Unit... units) {
   return UnitFactory.getOrCreateProduct(name, symbol, SIUnitConverter.getInstance(), units);
 }