本文整理汇总了Java中org.jscience.physics.amount.Amount.doubleValue方法的典型用法代码示例。如果您正苦于以下问题:Java Amount.doubleValue方法的具体用法?Java Amount.doubleValue怎么用?Java Amount.doubleValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jscience.physics.amount.Amount
的用法示例。
在下文中一共展示了Amount.doubleValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convert
import org.jscience.physics.amount.Amount; //导入方法依赖的package包/类
@Override
public Double convert(Double value, MassUnit from, MassUnit to) {
if (value == null)
return null;
if (from.equals(UNSUPPORTED) || to.equals(UNSUPPORTED))
return null;
Unit fUnit = get(from);
Unit tUnit = get(to);
if (fUnit == null || tUnit == null)
return null;
Amount<Mass> m = Amount.valueOf(value, fUnit);
return m.doubleValue(tUnit);
}
示例2: convert
import org.jscience.physics.amount.Amount; //导入方法依赖的package包/类
@Override
public Double convert(Double value, DataAmountUnit from, DataAmountUnit to) {
if (value == null)
return null;
if (from.equals(UNSUPPORTED) || to.equals(UNSUPPORTED))
return null;
Unit fUnit = get(from);
Unit tUnit = get(to);
if (fUnit == null || tUnit == null)
return null;
Amount<DataAmount> m = Amount.valueOf(value, fUnit);
return m.doubleValue(tUnit);
}
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:18,代码来源:DefaultDataAmountConverter.java
示例3: convert
import org.jscience.physics.amount.Amount; //导入方法依赖的package包/类
@Override
public Double convert(Double value, LengthUnit from, LengthUnit to) {
if (value == null)
return null;
if (from.equals(UNSUPPORTED) || to.equals(UNSUPPORTED))
return null;
Unit fUnit = get(from);
Unit tUnit = get(to);
if (fUnit == null || tUnit == null)
return null;
Amount<Length> m = Amount.valueOf(value, fUnit);
return m.doubleValue(tUnit);
}
示例4: convertToExponentialString
import org.jscience.physics.amount.Amount; //导入方法依赖的package包/类
private <T extends Quantity> String convertToExponentialString(Amount<T> amount) {
Unit unit = amount.getUnit();
Unit baseUnit = unit.getStandardUnit();
Unit currentUnit = baseUnit;
double currentAmount = amount.doubleValue(currentUnit);
while (Math.abs(currentAmount) >= 1000) {
currentUnit = SI.KILO(currentUnit);
// If next is peta, roll over and play dead
if (SI.PETA(baseUnit).equals(SI.KILO(currentUnit))) {
break;
}
currentAmount = amount.doubleValue(currentUnit);
}
Number value = AmountUtils.getNumericValue(amount.to(currentUnit));
return formatNumber(value) + " " + UNIT_FORMAT.format(currentUnit);
}
示例5: getDurationValue
import org.jscience.physics.amount.Amount; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private Object getDurationValue() {
String duration_formula = activityDef.getDuration();
try {
Amount<Duration> amount = (Amount<Duration>) JSCIENCE_FACTORY.createFromString(JSciencePackage.Literals.EDURATION, duration_formula);
if (amount != null) {
return amount.doubleValue(DURATION_UNITS);
}
} catch (Exception e) {
// all we can do is try
}
return getValue(duration_formula, temporalMember.getStartTime());
}
示例6: normalize
import org.jscience.physics.amount.Amount; //导入方法依赖的package包/类
@Override
protected Double normalize(Object value, AmountExtent extent) {
if (value instanceof String) {
Integer integer = stringCache.get(value);
if (integer == null) {
integer = stringCache.size()+1;
stringCache.put((String) value, integer);
}
Amount delta = extent.getDelta();
return integer / delta.doubleValue(Unit.ONE);
}
return super.normalize(value, extent);
}