当前位置: 首页>>代码示例>>Java>>正文


Java Quantity.to方法代码示例

本文整理汇总了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;
}
 
开发者ID:cleberecht,项目名称:singa,代码行数:18,代码来源:UnitScaler.java

示例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;
}
 
开发者ID:cleberecht,项目名称:singa,代码行数:21,代码来源:UnitScaler.java

示例3: setSystemTemperature

import javax.measure.Quantity; //导入方法依赖的package包/类
public void setSystemTemperature(Quantity<Temperature> systemTemperature) {
    // always in kelvin
    this.systemTemperature = systemTemperature.to(KELVIN);
    setChanged();
    notifyObservers();
}
 
开发者ID:cleberecht,项目名称:singa,代码行数:7,代码来源:EnvironmentalParameters.java

示例4: setSystemViscosity

import javax.measure.Quantity; //导入方法依赖的package包/类
public void setSystemViscosity(Quantity<DynamicViscosity> systemViscosity) {
    this.systemViscosity = systemViscosity.to(MILLI(PASCAL_SECOND));
    setChanged();
    notifyObservers();
}
 
开发者ID:cleberecht,项目名称:singa,代码行数:6,代码来源:EnvironmentalParameters.java


注:本文中的javax.measure.Quantity.to方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。