예제 #1
0
  // returns the quality regarding the cooking-time conditioning given Recipe
  public int getCookingQuality(BRecipe recipe, boolean distilled) {
    if (!recipe.needsDistilling() == distilled) {
      return -1;
    }
    int quality =
        10
            - (int)
                Math.round(
                    ((float) Math.abs(cookedTime - recipe.getCookingTime())
                            / recipe.allowedTimeDiff(recipe.getCookingTime()))
                        * 10.0);

    if (quality >= 0) {
      if (cookedTime <= 1) {
        return 0;
      }
      return quality;
    }
    return -1;
  }