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


C++ Water::amount_l方法代码示例

本文整理汇总了C++中Water::amount_l方法的典型用法代码示例。如果您正苦于以下问题:C++ Water::amount_l方法的具体用法?C++ Water::amount_l怎么用?C++ Water::amount_l使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Water的用法示例。


在下文中一共展示了Water::amount_l方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: scale

void ScaleRecipeTool::scale(Equipment* equip, double newEff)
{
    if( recObs == 0 || equip == 0 )
        return;

    int i, size;

    // Calculate volume ratio
    double currentBatchSize_l = recObs->batchSize_l();
    double newBatchSize_l = equip->batchSize_l();
    double volRatio = newBatchSize_l / currentBatchSize_l;

    // Calculate efficiency ratio
    double oldEfficiency = recObs->efficiency_pct();
    double effRatio = oldEfficiency / newEff;

    Database::instance().addToRecipe(recObs, equip);
    recObs->setBatchSize_l(newBatchSize_l);
    recObs->setBoilSize_l(equip->boilSize_l());
    recObs->setEfficiency_pct(newEff);
    recObs->setBoilTime_min(equip->boilTime_min());

    QList<Fermentable*> ferms = recObs->fermentables();
    size = ferms.size();
    for( i = 0; i < size; ++i )
    {
        Fermentable* ferm = ferms[i];
        // NOTE: why the hell do we need this?
        if( ferm == 0 )
            continue;

        if( !ferm->isSugar() && !ferm->isExtract() ) {
            ferm->setAmount_kg(ferm->amount_kg() * effRatio * volRatio);
        } else {
            ferm->setAmount_kg(ferm->amount_kg() * volRatio);
        }
    }

    QList<Hop*> hops = recObs->hops();
    size = hops.size();
    for( i = 0; i < size; ++i )
    {
        Hop* hop = hops[i];
        // NOTE: why the hell do we need this?
        if( hop == 0 )
            continue;

        hop->setAmount_kg(hop->amount_kg() * volRatio);
    }

    QList<Misc*> miscs = recObs->miscs();
    size = miscs.size();
    for( i = 0; i < size; ++i )
    {
        Misc* misc = miscs[i];
        // NOTE: why the hell do we need this?
        if( misc == 0 )
            continue;

        misc->setAmount( misc->amount() * volRatio );
    }

    QList<Water*> waters = recObs->waters();
    size = waters.size();
    for( i = 0; i < size; ++i )
    {
        Water* water = waters[i];
        // NOTE: why the hell do we need this?
        if( water == 0 )
            continue;

        water->setAmount_l(water->amount_l() * volRatio);
    }

    Mash* mash = recObs->mash();
    if( mash == 0 )
        return;

    QList<MashStep*> mashSteps = mash->mashSteps();
    size = mashSteps.size();
    for( i = 0; i < size; ++i )
    {
        MashStep* step = mashSteps[i];
        // NOTE: why the hell do we need this?
        if( step == 0 )
            continue;

        // Reset all these to zero so that the user
        // will know to re-run the mash wizard.
        step->setDecoctionAmount_l(0);
        step->setInfuseAmount_l(0);
    }

    // I don't think I should scale the yeasts.

    // Let the user know what happened.
    QMessageBox::information(this, tr("Recipe Scaled"),
                             tr("The equipment and mash have been reset due to the fact that mash temperatures do not scale easily. Please re-run the mash wizard.") );
}
开发者ID:EvansMike,项目名称:brewtarget,代码行数:99,代码来源:ScaleRecipeTool.cpp


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