private int sumHardScore(Map<CloudComputer, Integer> cpuPowerUsageMap, Map<CloudComputer, Integer> memoryUsageMap,
Map<CloudComputer, Integer> networkBandwidthUsageMap) {
int hardScore = 0;
for (Map.Entry<CloudComputer, Integer> usageEntry : cpuPowerUsageMap.entrySet()) {
CloudComputer computer = usageEntry.getKey();
int cpuPowerAvailable = computer.getCpuPower() - usageEntry.getValue();
if (cpuPowerAvailable < 0) {
hardScore += cpuPowerAvailable;
}
}
for (Map.Entry<CloudComputer, Integer> usageEntry : memoryUsageMap.entrySet()) {
CloudComputer computer = usageEntry.getKey();
int memoryAvailable = computer.getMemory() - usageEntry.getValue();
if (memoryAvailable < 0) {
hardScore += memoryAvailable;
}
}
for (Map.Entry<CloudComputer, Integer> usageEntry : networkBandwidthUsageMap.entrySet()) {
CloudComputer computer = usageEntry.getKey();
int networkBandwidthAvailable = computer.getNetworkBandwidth() - usageEntry.getValue();
if (networkBandwidthAvailable < 0) {
hardScore += networkBandwidthAvailable;
}
}
return hardScore;