本文整理汇总了Java中javax.measure.Quantity.to方法的典型用法代码示例。如果您正苦于以下问题:Java Quantity.to方法的具体用法?Java Quantity.to怎么用?Java Quantity.to使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.measure.Quantity
的用法示例。
在下文中一共展示了Quantity.to方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: rescaleReactionRate
import javax.measure.Quantity; //导入方法依赖的package包/类
/**
* Scales the reaction rate for the use with cellular graph automata. The unscaled quantity is transformed to the
* unit specified by target time and multiplied by the value of the time scale.
*
* @param unscaledQuantity The quantity that is to be scaled.
* @param targetScale The required time step.
* @return The scaled reaction rate.
*/
public static Quantity<Frequency> rescaleReactionRate(Quantity<Frequency> unscaledQuantity,
Quantity<Time> targetScale) {
// transform to specified unit
Quantity<Frequency> scaledQuantity = unscaledQuantity
.to(new ProductUnit<>(ONE.divide(targetScale.getUnit())));
// transform to specified amount
scaledQuantity = scaledQuantity.multiply(targetScale.getValue());
return scaledQuantity;
}
示例2: rescaleDiffusivity
import javax.measure.Quantity; //导入方法依赖的package包/类
/**
* Scales the diffusivity for the use with cellular graph automata. The unscaled quantity is transformed to the
* unit specified by target time and length scales. Further the unscaled quantity is divided by the squared length
* scale and multiplied by the time scale.
*
* @param unscaledQuantity The quantity that is to be scaled.
* @param targetTimeScale The required time step.
* @param targetLengthScale The required spatial step.
* @return The scaled diffusivity.
*/
public static Quantity<Diffusivity> rescaleDiffusivity(Quantity<Diffusivity> unscaledQuantity,
Quantity<Time> targetTimeScale, Quantity<Length> targetLengthScale) {
// transform to specified unit
Quantity<Diffusivity> scaledQuantity = unscaledQuantity
.to(new ProductUnit<>(targetLengthScale.getUnit().pow(2).divide(targetTimeScale.getUnit())));
// transform to specified amount
scaledQuantity = scaledQuantity.divide(targetLengthScale.getValue()).divide(targetLengthScale.getValue())
.multiply(targetTimeScale.getValue());
return scaledQuantity;
}
示例3: setSystemTemperature
import javax.measure.Quantity; //导入方法依赖的package包/类
public void setSystemTemperature(Quantity<Temperature> systemTemperature) {
// always in kelvin
this.systemTemperature = systemTemperature.to(KELVIN);
setChanged();
notifyObservers();
}
示例4: setSystemViscosity
import javax.measure.Quantity; //导入方法依赖的package包/类
public void setSystemViscosity(Quantity<DynamicViscosity> systemViscosity) {
this.systemViscosity = systemViscosity.to(MILLI(PASCAL_SECOND));
setChanged();
notifyObservers();
}