package cloudsimulator.clustersimulator;

import cloudsimulator.clustersimulator.dto.Cluster;
import cloudsimulator.clustersimulator.dto.TCGroup;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.File;
import java.io.IOException;

public class ClusterManager {

    private static final long RPS_FOR_VM = 100;
    private Cluster cluster;

    public ClusterManager() {
        ClassLoader classLoader = getClass().getClassLoader();
        String path = classLoader.getResource("clusterConfiguration.json").getFile();

        ObjectMapper mapper = new ObjectMapper();

        try {
            cluster = mapper.readValue(new File(path), Cluster.class);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public Cluster getCluster() {
        return cluster;
    }

    public long computeMaxRps() {
        return cluster.getCluster()
                .stream()
                .mapToLong(TCGroup::getVmNumber)
                .sum() * RPS_FOR_VM;
    }

}

@@ -242,16 +242,65 @@
 ption;%0A%0A
+/**%0A * Implements operations on the Cluster.%0A */%0A
 public c
@@ -400,16 +400,87 @@
 uster;%0A%0A
+    /**%0A     * Read Cluster configuration date from Json file.%0A     */%0A
     publ
@@ -879,68 +879,399 @@
     
-public Cluster getCluster() %7B%0A        return cluster;%0A    %7D%0A
+/**%0A     * Return the Cluster used by the ClusterManager.%0A     *%0A     * @return Cluster used by the ClusterManager.%0A     */%0A    public Cluster getCluster() %7B%0A        return cluster;%0A    %7D%0A%0A    /**%0A     * Compute the maximum RPS supported by the Cluster managed by the ClusterManager.%0A     *%0A     * @return maximum number of request that can be fulfilled by the Cluster in one second.%0A     */
 %0A   

Add comments for the ClusterManager.