예제 #1
0
 private int calculateCostFactor(DimletKey key) {
   DimletEntry dimletEntry = KnownDimletConfiguration.getEntry(key);
   if (dimletEntry == null) {
     Logging.logError("Something went wrong for key: " + key);
     return 0;
   }
   return (int) (dimletEntry.getRfMaintainCost() * DimletConfiguration.afterCreationCostFactor);
 }
예제 #2
0
  private void addToCost(DimletKey key) {
    DimletEntry dimletEntry = KnownDimletConfiguration.getEntry(key);
    int rfMaintainCost = dimletEntry.getRfMaintainCost();

    if (rfMaintainCost < 0) {
      int nominalCost = descriptor.calculateNominalCost();
      int rfMinimum = Math.max(10, nominalCost * DimletConfiguration.minimumCostPercentage / 100);

      actualRfCost = actualRfCost - (actualRfCost * (-rfMaintainCost) / 100);
      if (actualRfCost < rfMinimum) {
        actualRfCost = rfMinimum; // Never consume less then this
      }
    } else {
      actualRfCost += rfMaintainCost;
    }
  }