/** * Constructs the unit dimension corresponding to a base unit. * @param baseUnit A base unit. */ public UnitDimension(BaseUnit baseUnit) { super(new Factor(baseUnit)); }
/** * Constructs from a base quantity. * @param baseQuantity The base quantity constituting the dimension. */ public QuantityDimension(BaseQuantity baseQuantity) { super(new Factor(baseQuantity)); }
/** * Constructs the unit dimension corresponding to a base unit. * @param baseUnit A base unit. */ public UnitDimension(BaseUnit baseUnit) { super(new Factor(baseUnit)); }
/** * Constructs from a base quantity. * @param baseQuantity The base quantity constituting the dimension. */ public QuantityDimension(BaseQuantity baseQuantity) { super(new Factor(baseQuantity)); }
/** * Raises this Factor to a power. * * @param power * The power by which to raise this Factor. * @return The Factor resulting from raising this Factor to the given power. */ public Factor pow(final int power) { return new Factor(getBase(), getExponent() * power); }
/** * Raises this Factor to a power. * * @param power * The power by which to raise this Factor. * @return The Factor resulting from raising this Factor to the given power. */ public Factor pow(final int power) { return new Factor(getBase(), getExponent() * power); }
final int exponent = f1.getExponent() + f2.getExponent(); if (exponent != 0) { newFactors[k++] = new Factor(f1, exponent);
final int exponent = f1.getExponent() + f2.getExponent(); if (exponent != 0) { newFactors[k++] = new Factor(f1, exponent);
/** * Returns the corresponding quantity dimension. * @return The quantity dimension corresponding to this * unit dimension. */ public QuantityDimension getQuantityDimension() { Factor[] factors = getFactors(); for (int i = factors.length; --i >= 0; ) { Factor factor = factors[i]; factors[i] = new Factor( ((BaseUnit)factor.getBase()).getBaseQuantity(), factor.getExponent()); } return new QuantityDimension(factors); }
/** * Returns the corresponding quantity dimension. * @return The quantity dimension corresponding to this * unit dimension. */ public QuantityDimension getQuantityDimension() { Factor[] factors = getFactors(); for (int i = factors.length; --i >= 0; ) { Factor factor = factors[i]; factors[i] = new Factor( ((BaseUnit)factor.getBase()).getBaseQuantity(), factor.getExponent()); } return new QuantityDimension(factors); }