double (Operation currentOperation) { // marking all operations before this one as completed for (Operation op : Operation.values()) { if (currentOperation.compareTo(op) > 0) { myOperationsProgress.put(op, 1.0); } } // counting progress double totalProgress = 0; for (Object2DoubleMap.Entry<Operation> entry : myOperationsProgress.object2DoubleEntrySet()) { totalProgress += entry.getKey().myFractionInTotal * entry.getDoubleValue(); } return totalProgress; }