<div dir="ltr"><div>I&#39;m trying to understand when is proccess assigned to a computer by that java example.<br><br>----------------<br>    public HardAndSoftScore calculateScore(CloudBalance cloudBalance) {<br>        int hardScore = 0;<br>
        int softScore = 0;<br>        for (CloudComputer computer : cloudBalance.getComputerList()) {<br>            int cpuPowerUsage = 0;<br>            int memoryUsage = 0;<br>            int networkBandwidthUsage = 0;<br>
            boolean used = false;<br><br>            // Calculate usage<br>            for (CloudProcess process : cloudBalance.getProcessList()) {<br>                if (computer.equals(process.getComputer())) {<br>                    cpuPowerUsage += process.getRequiredCpuPower();<br>
                    memoryUsage += process.getRequiredMemory();<br>                    networkBandwidthUsage += process.getRequiredNetworkBandwidth();<br>                    used = true;<br>                }<br>            }<br>
<br>            // Hard constraints<br>            int cpuPowerAvailable = computer.getCpuPower() - cpuPowerUsage;<br>            if (cpuPowerAvailable &lt; 0) {<br>                hardScore += cpuPowerAvailable;<br>            }<br>
            int memoryAvailable = computer.getMemory() - memoryUsage;<br>            if (memoryAvailable &lt; 0) {<br>                hardScore += memoryAvailable;<br>            }<br>            int networkBandwidthAvailable = computer.getNetworkBandwidth() - networkBandwidthUsage;<br>
            if (networkBandwidthAvailable &lt; 0) {<br>                hardScore += networkBandwidthAvailable;<br>            }<br><br>            // Soft constraints<br>            if (used) {<br>                softScore -= computer.getCost();<br>
            }<br>        }<br>        return DefaultHardAndSoftScore.valueOf(hardScore, softScore);<br>    }<br>--------------------<br><br></div>I didn&#39;t understand how the cloudcomputers received it<br></div>