diff --git a/src/main/java/org/cloudbus/cloudsim/examples/network/NetworkExample1.java b/src/main/java/org/cloudbus/cloudsim/examples/network/NetworkExample1.java index 8712d30..0c8d7fb 100755 --- a/src/main/java/org/cloudbus/cloudsim/examples/network/NetworkExample1.java +++ b/src/main/java/org/cloudbus/cloudsim/examples/network/NetworkExample1.java @@ -101,7 +101,7 @@ private void createAndSubmitCloudlets(DatacenterBroker broker) { final var utilizationModel = new UtilizationModelFull(); final var cloudlet1 = - new CloudletSimple(length, VM_CORES) + CloudletSimple.of(length, VM_CORES) .setFileSize(fileSize) .setOutputSize(outputSize) .setUtilizationModel(utilizationModel); @@ -118,7 +118,7 @@ private void createAndSubmitVms(DatacenterBroker broker) { final long size = 10000; //image size (Megabyte) final int ram = 512; //vm memory (Megabyte) final long bw = 1000; //in Megabits/s - final Vm vm1 = new VmSimple(new CoreCapacity(VM_CORES, mips)) + final Vm vm1 = VmSimple.of(new CoreCapacity(VM_CORES, mips)) .setRam(ram).setBw(bw).setSize(size) .setCloudletScheduler(new CloudletSchedulerTimeShared()); @@ -136,9 +136,9 @@ private Datacenter createDatacenter() { final long storage = 1000000; // in Megabytes final long bw = 10000; //in Megabits/s - final var host = new HostSimple(ram, bw, storage, cpuCapacity); + final var host = HostSimple.of(ram, bw, storage, cpuCapacity); hostList.add(host); - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } } diff --git a/src/main/java/org/cloudbus/cloudsim/examples/network/NetworkExample2.java b/src/main/java/org/cloudbus/cloudsim/examples/network/NetworkExample2.java index 43755df..5687458 100755 --- a/src/main/java/org/cloudbus/cloudsim/examples/network/NetworkExample2.java +++ b/src/main/java/org/cloudbus/cloudsim/examples/network/NetworkExample2.java @@ -97,13 +97,13 @@ private void createAndSubmitCloudlets() { final var utilizationModel = new UtilizationModelFull(); final var cloudlet1 = - new CloudletSimple(length, VM_CORES) + CloudletSimple.of(length, VM_CORES) .setFileSize(fileSize) .setOutputSize(outputSize) .setUtilizationModel(utilizationModel); final var cloudlet2 = - new CloudletSimple(length, VM_CORES) + CloudletSimple.of(length, VM_CORES) .setFileSize(fileSize) .setOutputSize(outputSize) .setUtilizationModel(utilizationModel); @@ -122,10 +122,10 @@ private void createAndSubmitVms() { final int ram = 512; //vm memory (Megabyte) final long bw = 1000; - final Vm vm1 = new VmSimple(new CoreCapacity(VM_CORES, mips)) + final Vm vm1 = VmSimple.of(new CoreCapacity(VM_CORES, mips)) .setRam(ram).setBw(bw).setSize(size); - final Vm vm2 = new VmSimple(new CoreCapacity(VM_CORES, mips)) + final Vm vm2 = VmSimple.of(new CoreCapacity(VM_CORES, mips)) .setRam(ram).setBw(bw).setSize(size); vmlist.add(vm1); @@ -144,9 +144,9 @@ private Datacenter createDatacenter() { final long storage = 1000000; //host storage final long bw = 10000; - final Host host = new HostSimple(ram, bw, storage, cpuCapacity); + final Host host = HostSimple.of(ram, bw, storage, cpuCapacity); hostList.add(host); - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } } diff --git a/src/main/java/org/cloudbus/cloudsim/examples/network/NetworkExample3.java b/src/main/java/org/cloudbus/cloudsim/examples/network/NetworkExample3.java index 824443b..a517722 100755 --- a/src/main/java/org/cloudbus/cloudsim/examples/network/NetworkExample3.java +++ b/src/main/java/org/cloudbus/cloudsim/examples/network/NetworkExample3.java @@ -95,13 +95,13 @@ private void createAndSubmitCloudlets() { final var utilizationModel = new UtilizationModelFull(); final var cloudlet1 = - new CloudletSimple(length, VM_CORES) + CloudletSimple.of(length, VM_CORES) .setFileSize(fileSize) .setOutputSize(outputSize) .setUtilizationModel(utilizationModel); final var cloudlet2 = - new CloudletSimple(length, VM_CORES) + CloudletSimple.of(length, VM_CORES) .setFileSize(fileSize) .setOutputSize(outputSize) .setUtilizationModel(utilizationModel); @@ -119,10 +119,10 @@ private void createAndSubmitVms() { final int ram = 512; //vm memory (Megabyte) final long bw = 1000; - final Vm vm1 = new VmSimple(new CoreCapacity(VM_CORES, mips)) + final Vm vm1 = VmSimple.of(new CoreCapacity(VM_CORES, mips)) .setRam(ram).setBw(bw).setSize(size); - final Vm vm2 = new VmSimple(new CoreCapacity(VM_CORES, mips)) + final Vm vm2 = VmSimple.of(new CoreCapacity(VM_CORES, mips)) .setRam(ram).setBw(bw).setSize(size); vmList1.add(vm1); @@ -166,9 +166,9 @@ private Datacenter createDatacenter() { final long storage = 1000000; // in Megabytes final long bw = 10000; //in Megabits/s - final Host host = new HostSimple(ram, bw, storage, cpuCapacity); + final Host host = HostSimple.of(ram, bw, storage, cpuCapacity); hostList.add(host); - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } } diff --git a/src/main/java/org/cloudbus/cloudsim/examples/network/NetworkExample4.java b/src/main/java/org/cloudbus/cloudsim/examples/network/NetworkExample4.java index e4ec75e..6c393e3 100755 --- a/src/main/java/org/cloudbus/cloudsim/examples/network/NetworkExample4.java +++ b/src/main/java/org/cloudbus/cloudsim/examples/network/NetworkExample4.java @@ -97,7 +97,7 @@ private void createAndSubmitCloudlets() { final var utilizationModel = new UtilizationModelFull(); final var cloudlet1 = - new CloudletSimple(length, VM_CORES) + CloudletSimple.of(length, VM_CORES) .setFileSize(fileSize) .setOutputSize(outputSize) .setUtilizationModel(utilizationModel); @@ -112,7 +112,7 @@ private void createAndSubmitVms() { final int ram = 512; //vm memory (Megabyte) final long bw = 1000; - final Vm vm1 = new VmSimple(new CoreCapacity(VM_CORES, mips)) + final Vm vm1 = VmSimple.of(new CoreCapacity(VM_CORES, mips)) .setRam(ram).setBw(bw).setSize(size); vmList.add(vm1); @@ -129,13 +129,13 @@ private Datacenter createDatacenter() { long storage = 1000000; //host storage (Megabyte) long bw = 10000; //Megabits/s - final Host host = new HostSimple(ram, bw, storage, cpuCapacity) + final Host host = HostSimple.of(ram, bw, storage, cpuCapacity) .setRamAllocator(new ResourceAllocatorSimple()) .setBwAllocator(new ResourceAllocatorSimple()) .setVmScheduler(new VmSchedulerTimeShared()); hostList.add(host); - final var dc = new DatacenterSimple(simulation, hostList); + final var dc = DatacenterSimple.of(simulation, hostList); dc.setCharacteristics(new DatacenterCharacteristicsSimple(3.0, 0.05, 0.1, 0.1)); return dc; } diff --git a/src/main/java/org/cloudbus/cloudsim/examples/network/applications/NetworkVmExampleAbstract.java b/src/main/java/org/cloudbus/cloudsim/examples/network/applications/NetworkVmExampleAbstract.java index 06907ba..3c2ad84 100755 --- a/src/main/java/org/cloudbus/cloudsim/examples/network/applications/NetworkVmExampleAbstract.java +++ b/src/main/java/org/cloudbus/cloudsim/examples/network/applications/NetworkVmExampleAbstract.java @@ -169,7 +169,7 @@ protected final NetworkDatacenter createDatacenter() { final var netHostList = new ArrayList(hostsNumber); for (int i = 0; i < hostsNumber; i++) { final CoreCapacity cpuCapacity = HOST_CAPACITY; - final var host = new NetworkHost(HOST_RAM, HOST_BW, HOST_STORAGE, cpuCapacity); + final var host = NetworkHost.of(HOST_RAM, HOST_BW, HOST_STORAGE, cpuCapacity); host .setRamAllocator(new ResourceAllocatorSimple()) .setBwAllocator(new ResourceAllocatorSimple()) @@ -177,7 +177,7 @@ protected final NetworkDatacenter createDatacenter() { netHostList.add(host); } - final var dc = new NetworkDatacenter(simulation, netHostList); + final var dc = NetworkDatacenter.of(simulation, netHostList); dc.setSchedulingInterval(SCHEDULING_INTERVAL); dc.getCharacteristics() .setCostPerSecond(COST_PER_CPU_SEC) @@ -229,7 +229,7 @@ protected final List createAndSubmitVMs(DatacenterBroker broker) { final int vmsNumber = getDatacenterHostList().size() * MAX_VMS_PER_HOST; final var netVmList = new ArrayList(); for (int i = 0; i < vmsNumber; i++) { - final var vm = new NetworkVm(i, VM_CAPACITY); + final var vm = NetworkVm.of(i, VM_CAPACITY); vm.setRam(VM_RAM) .setBw(VM_BW) .setSize(VM_SIZE) diff --git a/src/main/java/org/cloudbus/cloudsim/examples/network/applications/NetworkVmsExampleBagOfTasksApp.java b/src/main/java/org/cloudbus/cloudsim/examples/network/applications/NetworkVmsExampleBagOfTasksApp.java index 3e7d26a..27cde63 100755 --- a/src/main/java/org/cloudbus/cloudsim/examples/network/applications/NetworkVmsExampleBagOfTasksApp.java +++ b/src/main/java/org/cloudbus/cloudsim/examples/network/applications/NetworkVmsExampleBagOfTasksApp.java @@ -36,7 +36,7 @@ public List createNetworkCloudlets(DatacenterBroker broker){ for(int i = 0; i < CLOUDLETS_BY_APP; i++){ final var utilizationModel = new UtilizationModelFull(); - final var cloudlet = new NetworkCloudlet(i, CLOUDLET_CORES); + final var cloudlet = NetworkCloudlet.of(i, CLOUDLET_CORES); final NetworkVm vm = getVmList().get(i); cloudlet .setFileSize(CLOUDLET_FILE_SIZE) diff --git a/src/main/java/org/cloudbus/cloudsim/examples/network/applications/NetworkVmsExampleSimpleApp.java b/src/main/java/org/cloudbus/cloudsim/examples/network/applications/NetworkVmsExampleSimpleApp.java index 4832a9f..882da77 100755 --- a/src/main/java/org/cloudbus/cloudsim/examples/network/applications/NetworkVmsExampleSimpleApp.java +++ b/src/main/java/org/cloudbus/cloudsim/examples/network/applications/NetworkVmsExampleSimpleApp.java @@ -106,7 +106,7 @@ private NetworkDatacenter createDatacenter() { netHostList.add(host); } - final var dc = new NetworkDatacenter(simulation, netHostList); + final var dc = NetworkDatacenter.of(simulation, netHostList); dc.setSchedulingInterval(5); createNetwork(dc); @@ -114,7 +114,7 @@ private NetworkDatacenter createDatacenter() { } private NetworkHost createHost() { - final var host = new NetworkHost(HOST_RAM, HOST_BW, HOST_STORAGE, HOST_CAPACITY); + final var host = NetworkHost.of(HOST_RAM, HOST_BW, HOST_STORAGE, HOST_CAPACITY); host .setRamAllocator(new ResourceAllocatorSimple()) .setBwAllocator(new ResourceAllocatorSimple()) @@ -156,7 +156,7 @@ private List createAndSubmitVMs(DatacenterBroker broker) { } private NetworkVm createVm(int id) { - final var vm = new NetworkVm(id, HOST_CAPACITY); + final var vm = NetworkVm.of(id, HOST_CAPACITY); vm .setRam(HOST_RAM) .setBw(HOST_BW) @@ -193,7 +193,7 @@ private List createNetworkCloudlets() { /// @param vm the VM that will run the created [NetworkCloudlet] /// @return private NetworkCloudlet createNetworkCloudlet(NetworkVm vm) { - final var netCloudlet = new NetworkCloudlet(HOST_CORES); + final var netCloudlet = NetworkCloudlet.of(HOST_CORES); netCloudlet .setFileSize(CLOUDLET_FILE_SIZE) .setOutputSize(CLOUDLET_OUTPUT_SIZE) diff --git a/src/main/java/org/cloudbus/cloudsim/examples/network/applications/NetworkVmsExampleWorkflowApp.java b/src/main/java/org/cloudbus/cloudsim/examples/network/applications/NetworkVmsExampleWorkflowApp.java index 8882da0..1e239b8 100755 --- a/src/main/java/org/cloudbus/cloudsim/examples/network/applications/NetworkVmsExampleWorkflowApp.java +++ b/src/main/java/org/cloudbus/cloudsim/examples/network/applications/NetworkVmsExampleWorkflowApp.java @@ -59,7 +59,7 @@ public List createNetworkCloudlets(final DatacenterBroker broke /// @return private NetworkCloudlet createNetworkCloudlet(final int id, final NetworkVm vm) { final var utilizationModel = new UtilizationModelFull(); - final var cloudlet = new NetworkCloudlet(id, CLOUDLET_CORES); + final var cloudlet = NetworkCloudlet.of(id, CLOUDLET_CORES); cloudlet .setFileSize(CLOUDLET_FILE_SIZE) .setOutputSize(CLOUDLET_OUTPUT_SIZE) diff --git a/src/main/java/org/cloudsimplus/examples/BasicFirstExample.java b/src/main/java/org/cloudsimplus/examples/BasicFirstExample.java index cb18ccf..8f1e098 100755 --- a/src/main/java/org/cloudsimplus/examples/BasicFirstExample.java +++ b/src/main/java/org/cloudsimplus/examples/BasicFirstExample.java @@ -121,7 +121,7 @@ private Datacenter createDatacenter() { } //Uses a VmPlacementPolicySimple by default to place VMs - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } private Host createHost() { @@ -129,7 +129,7 @@ private Host createHost() { Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ - return new HostSimple(HOST_RAM, HOST_BW, HOST_STORAGE, HOST_CAPACITY); + return HostSimple.of(HOST_RAM, HOST_BW, HOST_STORAGE, HOST_CAPACITY); } /// Creates a list of VMs. @@ -137,7 +137,7 @@ private List createVms() { final var vmList = new ArrayList(VMS); for (int i = 0; i < VMS; i++) { //Uses a CloudletSchedulerTimeShared by default to schedule Cloudlets - final var vm = new VmSimple(VM_CAPACITY); + final var vm = VmSimple.of(VM_CAPACITY); vm.setRam(512).setBw(1000).setSize(10_000); vmList.add(vm); } @@ -153,7 +153,7 @@ private List createCloudlets() { final var utilizationModel = new UtilizationModelDynamic(0.5); for (int i = 0; i < CLOUDLETS; i++) { - final var cloudlet = new CloudletSimple(CLOUDLET_LENGTH, CLOUDLET_CORES, utilizationModel); + final var cloudlet = CloudletSimple.of(CLOUDLET_LENGTH, CLOUDLET_CORES, utilizationModel); cloudlet.setSizes(1024); cloudletList.add(cloudlet); } diff --git a/src/main/java/org/cloudsimplus/examples/CloudletAndVmLifeTimeExample.java b/src/main/java/org/cloudsimplus/examples/CloudletAndVmLifeTimeExample.java index 49ce525..ec1e57c 100644 --- a/src/main/java/org/cloudsimplus/examples/CloudletAndVmLifeTimeExample.java +++ b/src/main/java/org/cloudsimplus/examples/CloudletAndVmLifeTimeExample.java @@ -167,7 +167,7 @@ private Datacenter createDatacenter() { hostList.add(host); } - final var datacenter = new DatacenterSimple(simulation, hostList); + final var datacenter = DatacenterSimple.of(simulation, hostList); datacenter.setSchedulingInterval(SCHEDULING_INTERVAL); return datacenter; } @@ -176,7 +176,7 @@ private Host createHost() { final long ram = 2048; //in Megabytes final long bw = 10000; //in Megabits/s final long storage = 1000000; //in Megabytes - final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); + final var host = HostSimple.of(ram, bw, storage, HOST_CAPACITY); host.setVmScheduler(new VmSchedulerTimeShared()); return host; } @@ -184,7 +184,7 @@ private Host createHost() { private List createVms() { final var vmList = new ArrayList(VMS); for (int i = 0; i < VMS; i++) { - final var vm = new VmSimple(i, VM_CAPACITY); + final var vm = VmSimple.of(i, VM_CAPACITY); vmList.add(vm); } @@ -194,7 +194,7 @@ private List createVms() { private List createCloudlets() { final var cloudletList = new ArrayList(CLOUDLETS); for (int i = 0; i < CLOUDLETS; i++) { - final var cloudlet = new CloudletSimple(i, CLOUDLET_LENGTH, CLOUDLET_CORES); + final var cloudlet = CloudletSimple.of(i, CLOUDLET_LENGTH, CLOUDLET_CORES); cloudlet .setFileSize(1024) .setOutputSize(1024) diff --git a/src/main/java/org/cloudsimplus/examples/CloudletCancellationExample.java b/src/main/java/org/cloudsimplus/examples/CloudletCancellationExample.java index 638c0b1..64fd655 100755 --- a/src/main/java/org/cloudsimplus/examples/CloudletCancellationExample.java +++ b/src/main/java/org/cloudsimplus/examples/CloudletCancellationExample.java @@ -148,7 +148,7 @@ private Datacenter createDatacenter() { hostList.add(host); } - final var dc = new DatacenterSimple(simulation, hostList); + final var dc = DatacenterSimple.of(simulation, hostList); dc.setSchedulingInterval(SCHEDULING_INTERVAL); return dc; } @@ -160,7 +160,7 @@ private Host createHost() { final var ramAllocator = new ResourceAllocatorSimple(); final var bwAllocator = new ResourceAllocatorSimple(); final var vmScheduler = new VmSchedulerTimeShared(); - final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); + final var host = HostSimple.of(ram, bw, storage, HOST_CAPACITY); host .setRamAllocator(ramAllocator) .setBwAllocator(bwAllocator) @@ -173,7 +173,7 @@ private List createVms() { final var list = new ArrayList(VMS); for (int i = 0; i < VMS; i++) { Vm vm = - new VmSimple(i, VM_CAPACITY) + VmSimple.of(i, VM_CAPACITY) .setRam(512).setBw(1000).setSize(10000) .setCloudletScheduler(new CloudletSchedulerTimeShared()); @@ -188,7 +188,7 @@ private List createCloudlets() { final var list = new ArrayList(CLOUDLETS); for (int i = 0; i < CLOUDLETS; i++) { final var cloudlet = - new CloudletSimple(i, CLOUDLET_LENGTH, CLOUDLET_CORES) + CloudletSimple.of(i, CLOUDLET_LENGTH, CLOUDLET_CORES) .setFileSize(1024) .setOutputSize(1024) .setUtilizationModelCpu(new UtilizationModelFull()) diff --git a/src/main/java/org/cloudsimplus/examples/CloudletLifeTimeExample.java b/src/main/java/org/cloudsimplus/examples/CloudletLifeTimeExample.java index 52492fd..1e7a4e2 100644 --- a/src/main/java/org/cloudsimplus/examples/CloudletLifeTimeExample.java +++ b/src/main/java/org/cloudsimplus/examples/CloudletLifeTimeExample.java @@ -131,7 +131,7 @@ private Datacenter createDatacenter() { hostList.add(host); } - final var datacenter = new DatacenterSimple(simulation, hostList); + final var datacenter = DatacenterSimple.of(simulation, hostList); datacenter.setSchedulingInterval(SCHEDULING_INTERVAL); return datacenter; } @@ -140,7 +140,7 @@ private Host createHost() { final long ram = 2048; //in Megabytes final long bw = 10000; //in Megabits/s final long storage = 1000000; //in Megabytes - final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); + final var host = HostSimple.of(ram, bw, storage, HOST_CAPACITY); host.setVmScheduler(new VmSchedulerTimeShared()); return host; } @@ -148,7 +148,7 @@ private Host createHost() { private List createVms() { final var vmList = new ArrayList(VMS); for (int i = 0; i < VMS; i++) { - final var vm = new VmSimple(i, VM_CAPACITY); + final var vm = VmSimple.of(i, VM_CAPACITY); vmList.add(vm); } @@ -158,7 +158,7 @@ private List createVms() { private List createCloudlets() { final var cloudletList = new ArrayList(CLOUDLETS); for (int i = 0; i < CLOUDLETS; i++) { - final var cloudlet = new CloudletSimple(i, CLOUDLET_LENGTH, CLOUDLET_CORES); + final var cloudlet = CloudletSimple.of(i, CLOUDLET_LENGTH, CLOUDLET_CORES); cloudlet .setFileSize(1024) .setOutputSize(1024) diff --git a/src/main/java/org/cloudsimplus/examples/CloudletsTableBuilderFormattingExample.java b/src/main/java/org/cloudsimplus/examples/CloudletsTableBuilderFormattingExample.java index 7458135..e3980dd 100644 --- a/src/main/java/org/cloudsimplus/examples/CloudletsTableBuilderFormattingExample.java +++ b/src/main/java/org/cloudsimplus/examples/CloudletsTableBuilderFormattingExample.java @@ -158,7 +158,7 @@ private Datacenter createDatacenter() { } //Uses a VmPlacementPolicySimple by default to place VMs - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } private Host createHost() { @@ -166,7 +166,7 @@ private Host createHost() { Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ - return new HostSimple(HOST_RAM, HOST_BW, HOST_STORAGE, HOST_CAPACITY); + return HostSimple.of(HOST_RAM, HOST_BW, HOST_STORAGE, HOST_CAPACITY); } /// Creates a list of VMs. @@ -174,7 +174,7 @@ private List createVms() { final var vmList = new ArrayList(VMS); for (int i = 0; i < VMS; i++) { //Uses a CloudletSchedulerTimeShared by default to schedule Cloudlets - final var vm = new VmSimple(VM_CAPACITY); + final var vm = VmSimple.of(VM_CAPACITY); vm.setRam(512).setBw(1000).setSize(10_000); vmList.add(vm); } @@ -192,12 +192,12 @@ private List createCloudlets() { for (int i = 0; i < CLOUDLETS; i++) { if(i % 2 == 0) { - final var cloudlet = new CloudletSimple(CLOUDLET_LENGTH_SHORT, CLOUDLET_CORES, utilizationModel); + final var cloudlet = CloudletSimple.of(CLOUDLET_LENGTH_SHORT, CLOUDLET_CORES, utilizationModel); cloudlet.setSizes(1024); cloudlet.setSubmissionDelay(0.7); cloudletList.add(cloudlet); }else { - final var cloudlet = new CloudletSimple(CLOUDLET_LENGTH_LONG, CLOUDLET_CORES, utilizationModel); + final var cloudlet = CloudletSimple.of(CLOUDLET_LENGTH_LONG, CLOUDLET_CORES, utilizationModel); cloudlet.setSizes(2048); cloudlet.setSubmissionDelay(1.2); cloudletList.add(cloudlet); diff --git a/src/main/java/org/cloudsimplus/examples/HostFaultInjectionExample1.java b/src/main/java/org/cloudsimplus/examples/HostFaultInjectionExample1.java index b6e6618..58d2477 100755 --- a/src/main/java/org/cloudsimplus/examples/HostFaultInjectionExample1.java +++ b/src/main/java/org/cloudsimplus/examples/HostFaultInjectionExample1.java @@ -194,7 +194,7 @@ public void createAndSubmitVms(final DatacenterBroker broker) { } public Vm createVm() { - final Vm vm = new VmSimple(++createdVms, VM_CAPACITY); + final Vm vm = VmSimple.of(++createdVms, VM_CAPACITY); vm .setRam(VM_RAM).setBw(VM_BW).setSize(VM_SIZE) .setCloudletScheduler(new CloudletSchedulerTimeShared()); @@ -210,7 +210,7 @@ public void createAndSubmitCloudlets(final DatacenterBroker broker) { final var utilizationModelFull = new UtilizationModelFull(); for (int i = 0; i < CLOUDLETS_BY_BROKER; i++) { Cloudlet c - = new CloudletSimple(++createdCloudlets, CLOUDLET_LENGTH, CLOUDLET_CORES) + = CloudletSimple.of(++createdCloudlets, CLOUDLET_LENGTH, CLOUDLET_CORES) .setFileSize(CLOUDLET_FILESIZE) .setOutputSize(CLOUDLET_OUTPUT_SIZE) .setUtilizationModelCpu(utilizationModelFull) @@ -228,7 +228,7 @@ private Datacenter createDatacenter() { } System.out.println(); - final var dc = new DatacenterSimple(simulation, hostList); + final var dc = DatacenterSimple.of(simulation, hostList); dc.setSchedulingInterval(SCHEDULE_TIME_TO_PROCESS_DATACENTER_EVENTS); return dc; } @@ -237,7 +237,7 @@ public Host createHost(final int id) { final var ramAllocator = new ResourceAllocatorSimple(); final var bwAllocator = new ResourceAllocatorSimple(); final var vmScheduler = new VmSchedulerTimeShared(); - final var host = new HostSimple(HOST_RAM, HOST_BW, HOST_STORAGE, HOST_CAPACITY); + final var host = HostSimple.of(HOST_RAM, HOST_BW, HOST_STORAGE, HOST_CAPACITY); host .setRamAllocator(ramAllocator) .setBwAllocator(bwAllocator) @@ -275,7 +275,7 @@ private HostFaultInjection createFaultInjectionForHosts(final Datacenter datacen /// /// @see #createFaultInjectionForHosts(Datacenter) private Vm cloneVm(final Vm vm) { - final Vm clone = new VmSimple(new CoreCapacity(vm.getProcessor().getCores(), vm.getProcessor().getMips())); + final Vm clone = VmSimple.of(new CoreCapacity(vm.getProcessor().getCores(), vm.getProcessor().getMips())); /*It' not required to set an ID for the clone. It is being set here just to make it easy to relate the ID of the vm to its clone, @@ -325,7 +325,7 @@ private List cloneCloudlets(final Vm sourceVm) { /// @param source the Cloudlet to be cloned. /// @return the cloned (new) cloudlet private Cloudlet cloneCloudlet(Cloudlet source) { - final var clone = new CloudletSimple(source.getLength(), source.getRequiredCores()); + final var clone = CloudletSimple.of(source.getLength(), source.getRequiredCores()); /*It' not required to set an ID for the clone. It is being set here just to make it easy to relate the ID of the cloudlet to its clone, diff --git a/src/main/java/org/cloudsimplus/examples/LargeScaleExample.java b/src/main/java/org/cloudsimplus/examples/LargeScaleExample.java index 35c8786..142f5c9 100755 --- a/src/main/java/org/cloudsimplus/examples/LargeScaleExample.java +++ b/src/main/java/org/cloudsimplus/examples/LargeScaleExample.java @@ -165,7 +165,7 @@ private Datacenter createDatacenter() { hostList.add(host); } - var dc = new DatacenterSimple(simulation, hostList, new VmPlacementPolicyFirstFit()); + var dc = DatacenterSimple.of(simulation, hostList, new VmPlacementPolicyFirstFit()); dc.setSchedulingInterval(SCHEDULING_INTERVAL); return dc; } @@ -175,7 +175,7 @@ private Host createHost() { Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ - return new HostSimple(HOST_RAM, HOST_BW, HOST_STORAGE, HOST_CAPACITY); + return HostSimple.of(HOST_RAM, HOST_BW, HOST_STORAGE, HOST_CAPACITY); } /// Creates a list of VMs. @@ -184,7 +184,7 @@ private List createVms() { System.out.printf("Creating %,d VMs%n", VMS); for (int i = 0; i < VMS; i++) { //Uses a CloudletSchedulerTimeShared by default to schedule Cloudlets - final var vm = new VmSimple(VM_CAPACITY); + final var vm = VmSimple.of(VM_CAPACITY); vm.setRam(512).setBw(1000).setSize(10_000); vmList.add(vm); } @@ -201,7 +201,7 @@ private List createCloudlets() { System.out.printf("Creating %,d Cloudlets%n", CLOUDLETS); for (int i = 0; i < CLOUDLETS; i++) { - final var cloudlet = new CloudletSimple(CLOUDLET_LENGTH, CLOUDLET_CORES, utilizationModel); + final var cloudlet = CloudletSimple.of(CLOUDLET_LENGTH, CLOUDLET_CORES, utilizationModel); cloudlet.setSizes(1024); cloudletList.add(cloudlet); } diff --git a/src/main/java/org/cloudsimplus/examples/LoggingExample.java b/src/main/java/org/cloudsimplus/examples/LoggingExample.java index 0dfa62f..05a0d8a 100755 --- a/src/main/java/org/cloudsimplus/examples/LoggingExample.java +++ b/src/main/java/org/cloudsimplus/examples/LoggingExample.java @@ -162,7 +162,7 @@ private Datacenter createDatacenter() { final var vmPlacementPolicy = new VmPlacementPolicyMigrationStaticThreshold( new VmSelectionPolicyRandomSelection(), HOST_OVER_UTILIZATION_MIGRATION_THRESHOLD); - final var dc = new DatacenterSimple(simulation, hostList, vmPlacementPolicy); + final var dc = DatacenterSimple.of(simulation, hostList, vmPlacementPolicy); dc.setSchedulingInterval(SCHEDULING_INTERVAL_SECS); if(DISABLE_MIGRATIONS) { dc.disableMigrations(); @@ -178,7 +178,7 @@ private Host createHost(final int pes) { Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ - return new HostSimple(HOST_RAM, HOST_BW, HOST_STORAGE, cpuCapacity); + return HostSimple.of(HOST_RAM, HOST_BW, HOST_STORAGE, cpuCapacity); } /// Creates a list of VMs. @@ -186,7 +186,7 @@ private List createVms() { final var list = new ArrayList(VMS); for (int i = 0; i < VMS; i++) { //Uses a CloudletSchedulerTimeShared by default to schedule Cloudlets - final Vm vm = new VmSimple(VM_CAPACITY); + final Vm vm = VmSimple.of(VM_CAPACITY); vm.setRam(VM_RAM).setBw(VM_BW).setSize(VM_SIZE); list.add(vm); } @@ -207,7 +207,7 @@ private List createCloudlets(final UtilizationModel utilizationModel, final var list = new ArrayList(CLOUDLETS); for (int i = 0; i < CLOUDLETS; i++) { - final var cloudlet = new CloudletSimple(CLOUDLET_LENGTH, CLOUDLET_CORES, utilizationModel); + final var cloudlet = CloudletSimple.of(CLOUDLET_LENGTH, CLOUDLET_CORES, utilizationModel); cloudlet.setSubmissionDelay(submissionDelay); cloudlet.setSizes(1024); list.add(cloudlet); diff --git a/src/main/java/org/cloudsimplus/examples/MinTimeBetweenEventsExample.java b/src/main/java/org/cloudsimplus/examples/MinTimeBetweenEventsExample.java index a81940a..cf96927 100755 --- a/src/main/java/org/cloudsimplus/examples/MinTimeBetweenEventsExample.java +++ b/src/main/java/org/cloudsimplus/examples/MinTimeBetweenEventsExample.java @@ -142,7 +142,7 @@ private MinTimeBetweenEventsExample() { private Datacenter createDatacenter() { hostList.add(createHost()); - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } private Host createHost() { @@ -150,7 +150,7 @@ private Host createHost() { final long storage = 1000000; // host storage (Megabyte) final long bw = 10000; //Megabits/s - return new HostSimple(ram, bw, storage, HOST_CAPACITY) + return HostSimple.of(ram, bw, storage, HOST_CAPACITY) .setRamAllocator(new ResourceAllocatorSimple()) .setBwAllocator(new ResourceAllocatorSimple()) .setVmScheduler(new VmSchedulerSpaceShared()); @@ -173,7 +173,7 @@ private Vm createVm(final int id) { final long bw = 1000; //It uses a CloudletSchedulerTimeShared by default - final Vm vm = new VmSimple(id, VM_CAPACITY); + final Vm vm = VmSimple.of(id, VM_CAPACITY); vm.setRam(ram).setBw(bw).setSize(size); return vm; } @@ -199,7 +199,7 @@ private Cloudlet createCloudlet(final Vm vm) { final long outputSize = 300; //in bytes final var utilizationModel = new UtilizationModelDynamic(0.1); - final var cloudlet = new CloudletSimple(CLOUDLET_LENGTH, CLOUDLET_CORES) + final var cloudlet = CloudletSimple.of(CLOUDLET_LENGTH, CLOUDLET_CORES) .setFileSize(fileSize) .setOutputSize(outputSize) .setUtilizationModelCpu(new UtilizationModelFull()) diff --git a/src/main/java/org/cloudsimplus/examples/ParallelSimulationsExample.java b/src/main/java/org/cloudsimplus/examples/ParallelSimulationsExample.java index 4adbed8..d6c0a52 100755 --- a/src/main/java/org/cloudsimplus/examples/ParallelSimulationsExample.java +++ b/src/main/java/org/cloudsimplus/examples/ParallelSimulationsExample.java @@ -156,7 +156,7 @@ private Host createHost() { final var cpuCapacity = new CoreCapacity(pesNumber, mips); - return new HostSimple(ram, bw, storage, cpuCapacity).setVmScheduler(new VmSchedulerTimeShared()); + return HostSimple.of(ram, bw, storage, cpuCapacity).setVmScheduler(new VmSchedulerTimeShared()); } private void createVms() { @@ -178,7 +178,7 @@ private Vm createVm(final int id) { final long bw = 1000; // vm bandwidth (Megabits/s) final int pesNumber = 2; // number of CPU cores - return new VmSimple(id, new CoreCapacity(pesNumber, mips)) + return VmSimple.of(id, new CoreCapacity(pesNumber, mips)) .setRam(ram) .setBw(bw) .setSize(storage); @@ -205,7 +205,7 @@ private Cloudlet createCloudlet(final int id) { * If there are 10 cloudlets for a VM, each Cloudlet will use 10% (0.1) of the VM resource capacity. */ final var utilizationModelDynamic = new UtilizationModelDynamic(1.0/cloudletsNumber); - return new CloudletSimple(id, length, pesNumber) + return CloudletSimple.of(id, length, pesNumber) .setFileSize(fileSize) .setOutputSize(outputSize) .setUtilizationModelCpu(utilizationModelFull) @@ -216,7 +216,7 @@ private Cloudlet createCloudlet(final int id) { /// Builds the simulation scenario and starts the simulation. @Override public void run() { - final var datacenter0 = new DatacenterSimple(simulation, createHosts()); + final var datacenter0 = DatacenterSimple.of(simulation, createHosts()); /* Creates a Broker accountable for submission of VMs and Cloudlets on behalf of a given cloud user (customer). */ diff --git a/src/main/java/org/cloudsimplus/examples/RandomVmPlacementPolicyExample.java b/src/main/java/org/cloudsimplus/examples/RandomVmPlacementPolicyExample.java index f5b68ab..1b74091 100755 --- a/src/main/java/org/cloudsimplus/examples/RandomVmPlacementPolicyExample.java +++ b/src/main/java/org/cloudsimplus/examples/RandomVmPlacementPolicyExample.java @@ -146,7 +146,7 @@ private Datacenter createDatacenter() { //Replaces the default method that allocates Hosts to VMs by our own implementation vmPlacementPolicy.setFindHostForVmFunction(this::findRandomSuitableHostForVm); - return new DatacenterSimple(simulation, hostList, vmPlacementPolicy); + return DatacenterSimple.of(simulation, hostList, vmPlacementPolicy); } /// Define a specific policy to randomly select a suitable Host to place a given VM. @@ -178,7 +178,7 @@ private Host createHost() { final long ram = 2048; //in Megabytes final long bw = 10000; //in Megabits/s final long storage = 1000000; //in Megabytes - final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); + final var host = HostSimple.of(ram, bw, storage, HOST_CAPACITY); host .setRamAllocator(new ResourceAllocatorSimple()) .setBwAllocator(new ResourceAllocatorSimple()) @@ -191,7 +191,7 @@ private List createVms() { final var list = new ArrayList(VMS); for (int i = 0; i < VMS; i++) { Vm vm = - new VmSimple(i, VM_CAPACITY) + VmSimple.of(i, VM_CAPACITY) .setRam(512).setBw(1000).setSize(10000) .setCloudletScheduler(new CloudletSchedulerTimeShared()); @@ -207,7 +207,7 @@ private List createCloudlets() { final var utilization = new UtilizationModelDynamic(0.2); for (int i = 0; i < CLOUDLETS; i++) { final var cloudlet = - new CloudletSimple(i, CLOUDLET_LENGTH, CLOUDLET_CORES) + CloudletSimple.of(i, CLOUDLET_LENGTH, CLOUDLET_CORES) .setFileSize(1024) .setOutputSize(1024) .setUtilizationModelBw(utilization) diff --git a/src/main/java/org/cloudsimplus/examples/ReducedExample.java b/src/main/java/org/cloudsimplus/examples/ReducedExample.java index 25cfd03..30e8eec 100755 --- a/src/main/java/org/cloudsimplus/examples/ReducedExample.java +++ b/src/main/java/org/cloudsimplus/examples/ReducedExample.java @@ -68,23 +68,23 @@ void main() { //Creates one Hosts with a specific list of CPU cores (PEs). //Uses ResourceAllocatorSimple by default for RAM and BW allocation //Uses VmSchedulerSpaceShared by default for VM scheduling - final var host0 = new HostSimple(ram, bw, storage, new CoreCapacity(20000)); + final var host0 = HostSimple.of(ram, bw, storage, new CoreCapacity(20000)); //Creates one Datacenter with a list of Hosts //Uses a VmPlacementPolicySimple by default to place VMs - final var dc0 = new DatacenterSimple(simulation, List.of(host0)); + final var dc0 = DatacenterSimple.of(simulation, List.of(host0)); //Creates one Vm to run applications (Cloudlets). //Uses a CloudletSchedulerTimeShared by default to schedule Cloudlets. - final var vm0 = new VmSimple(new CoreCapacity(1, 1000)); + final var vm0 = VmSimple.of(new CoreCapacity(1, 1000)); vm0.setRam(1000).setBw(1000).setSize(1000); final var vmList = List.of(vm0); //Creates two Cloudlets that represent applications to be run inside a Vm. //UtilizationModel defining the Cloudlets use only 50% of any resource all the time final var utilizationModel = new UtilizationModelDynamic(0.5); - final var cloudlet0 = new CloudletSimple(10000, 1, utilizationModel); - final var cloudlet1 = new CloudletSimple(10000, 1, utilizationModel); + final var cloudlet0 = CloudletSimple.of(10000, 1, utilizationModel); + final var cloudlet1 = CloudletSimple.of(10000, 1, utilizationModel); final var cloudletList = List.of(cloudlet0, cloudlet1); /*Requests the broker to create the Vms and Cloudlets. diff --git a/src/main/java/org/cloudsimplus/examples/StorageAreaNetworkExample1.java b/src/main/java/org/cloudsimplus/examples/StorageAreaNetworkExample1.java index c827a0c..92be91b 100755 --- a/src/main/java/org/cloudsimplus/examples/StorageAreaNetworkExample1.java +++ b/src/main/java/org/cloudsimplus/examples/StorageAreaNetworkExample1.java @@ -184,7 +184,7 @@ private Datacenter createDatacenter() { hostList.add(host); } - return new DatacenterSimple(simulation, hostList, new VmPlacementPolicySimple(), createSanArray()); + return DatacenterSimple.of(simulation, hostList, new VmPlacementPolicySimple(), createSanArray()); } private Host createHost() { @@ -192,7 +192,7 @@ private Host createHost() { final long bw = 10000; //in Megabits/s final long storage = 1000000; //in Megabytes final var vmScheduler = new VmSchedulerTimeShared(); - final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); + final var host = HostSimple.of(ram, bw, storage, HOST_CAPACITY); host.setVmScheduler(vmScheduler); return host; } @@ -202,7 +202,7 @@ private List createVms() { final var list = new ArrayList(VMS); for (int i = 0; i < VMS; i++) { Vm vm = - new VmSimple(i, VM_CAPACITY) + VmSimple.of(i, VM_CAPACITY) .setRam(512).setBw(1000).setSize(10000) .setCloudletScheduler(new CloudletSchedulerTimeShared()); @@ -220,7 +220,7 @@ private List createCloudlets() { final var utilization = new UtilizationModelFull(); for (int i = 0; i < CLOUDLETS; i++) { final var cloudlet = - new CloudletSimple(i, CLOUDLET_LENGTH, CLOUDLET_CORES) + CloudletSimple.of(i, CLOUDLET_LENGTH, CLOUDLET_CORES) .setFileSize(1024) .setOutputSize(1024) .setUtilizationModel(utilization); diff --git a/src/main/java/org/cloudsimplus/examples/VmBootTimeAndOverheadExample.java b/src/main/java/org/cloudsimplus/examples/VmBootTimeAndOverheadExample.java index ba7e2f0..1eb947d 100755 --- a/src/main/java/org/cloudsimplus/examples/VmBootTimeAndOverheadExample.java +++ b/src/main/java/org/cloudsimplus/examples/VmBootTimeAndOverheadExample.java @@ -143,7 +143,7 @@ private Datacenter createDatacenter() { } //Uses a VmPlacementPolicySimple by default to place VMs - return new DatacenterSimple(simulation, hostList).setSchedulingInterval(SCHEDULING_INTERVAL); + return DatacenterSimple.of(simulation, hostList).setSchedulingInterval(SCHEDULING_INTERVAL); } private Host createHost() { @@ -151,7 +151,7 @@ private Host createHost() { Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ - return new HostSimple(HOST_RAM, HOST_BW, HOST_STORAGE, HOST_CAPACITY); + return HostSimple.of(HOST_RAM, HOST_BW, HOST_STORAGE, HOST_CAPACITY); } /// Creates a list of VMs setting a [BootModel] @@ -163,7 +163,7 @@ private List createVms() { final var bootModelRam = new UtilizationModelDynamic(0.3); for (int i = 0; i < VMS; i++) { //Uses a CloudletSchedulerTimeShared by default to schedule Cloudlets - final var vm = new VmSimple(VM_CAPACITY); + final var vm = VmSimple.of(VM_CAPACITY); vm.setRam(512) .setBw(1000) .setSize(10_000) @@ -184,7 +184,7 @@ private List createCloudlets() { final var utilizationModel = new UtilizationModelDynamic(0.5); for (int i = 0; i < CLOUDLETS; i++) { - final var cloudlet = new CloudletSimple(CLOUDLET_LENGTH, CLOUDLET_CORES, utilizationModel); + final var cloudlet = CloudletSimple.of(CLOUDLET_LENGTH, CLOUDLET_CORES, utilizationModel); cloudlet.setSizes(1024); cloudletList.add(cloudlet); } diff --git a/src/main/java/org/cloudsimplus/examples/VmDestructionExample.java b/src/main/java/org/cloudsimplus/examples/VmDestructionExample.java index 28e9c68..056951b 100755 --- a/src/main/java/org/cloudsimplus/examples/VmDestructionExample.java +++ b/src/main/java/org/cloudsimplus/examples/VmDestructionExample.java @@ -170,7 +170,7 @@ private Datacenter createDatacenter() { hostList.add(host); } - final var dc = new DatacenterSimple(simulation, hostList); + final var dc = DatacenterSimple.of(simulation, hostList); dc.setSchedulingInterval(SCHEDULING_INTERVAL); return dc; } @@ -182,7 +182,7 @@ private Host createHost() { final var ramAllocator = new ResourceAllocatorSimple(); final var bwAllocator = new ResourceAllocatorSimple(); final var vmScheduler = new VmSchedulerTimeShared(); - final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); + final var host = HostSimple.of(ram, bw, storage, HOST_CAPACITY); host .setRamAllocator(ramAllocator) .setBwAllocator(bwAllocator) @@ -195,7 +195,7 @@ private List createVms() { final var list = new ArrayList(VMS); for (int i = 0; i < VMS; i++) { Vm vm = - new VmSimple(i, VM_CAPACITY) + VmSimple.of(i, VM_CAPACITY) .setRam(512).setBw(1000).setSize(10000) .setCloudletScheduler(new CloudletSchedulerTimeShared()); @@ -220,7 +220,7 @@ private List createCloudlets() { for (int i = 0; i < CLOUDLETS; i++) { final var cloudlet = - new CloudletSimple(i, CLOUDLET_LENGTH, CLOUDLET_CORES) + CloudletSimple.of(i, CLOUDLET_LENGTH, CLOUDLET_CORES) .setFileSize(1024) .setOutputSize(1024) .setUtilizationModelRam(utilization) diff --git a/src/main/java/org/cloudsimplus/examples/VmGroupPlacementExample1.java b/src/main/java/org/cloudsimplus/examples/VmGroupPlacementExample1.java index 834491a..0b9111d 100755 --- a/src/main/java/org/cloudsimplus/examples/VmGroupPlacementExample1.java +++ b/src/main/java/org/cloudsimplus/examples/VmGroupPlacementExample1.java @@ -133,7 +133,7 @@ private Datacenter createDatacenter() { } //Uses a VmPlacementPolicySimple by default to place VMs - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } private Host createHost(final long id, final int pes) { @@ -148,7 +148,7 @@ private Host createHost(final long id, final int pes) { Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ - final Host host = new HostSimple(ram, bw, storage, cpuCapacity); + final Host host = HostSimple.of(ram, bw, storage, cpuCapacity); host.setId(id); return host; } @@ -158,7 +158,7 @@ private Host createHost(final long id, final int pes) { private List createVmGroupList() { final var vmGroupList = new ArrayList(GROUPS); for (int i = 0; i < GROUPS; i++) { - vmGroupList.add(new VmGroup(createVms())); + vmGroupList.add(VmGroup.of(createVms())); } return vmGroupList; @@ -168,7 +168,7 @@ private List createVms() { final var vmList = new ArrayList(VMS_BY_GROUP); for (int i = 0; i < VMS_BY_GROUP; i++) { //Uses a CloudletSchedulerTimeShared by default to schedule Cloudlets - final Vm vm = new VmSimple(VM_CAPACITY); + final Vm vm = VmSimple.of(VM_CAPACITY); vm.setRam(VM_RAM).setBw(VM_BW).setSize(VM_STORAGE); vmList.add(vm); } @@ -184,7 +184,7 @@ private void createCloudlets(final VmGroup group) { final var utilizationModelCpu = new UtilizationModelFull(); for (Vm vm : group.getVmList()) { - final var cloudlet = new CloudletSimple(CLOUDLET_LENGTH, VM_CORES); + final var cloudlet = CloudletSimple.of(CLOUDLET_LENGTH, VM_CORES); cloudlet.setSizes(1024) .setUtilizationModelCpu(utilizationModelCpu) .setUtilizationModelRam(utilizationModelRamBw) diff --git a/src/main/java/org/cloudsimplus/examples/VmPlacementPolicyRoundRobinExample.java b/src/main/java/org/cloudsimplus/examples/VmPlacementPolicyRoundRobinExample.java index e62dc4f..d60c112 100755 --- a/src/main/java/org/cloudsimplus/examples/VmPlacementPolicyRoundRobinExample.java +++ b/src/main/java/org/cloudsimplus/examples/VmPlacementPolicyRoundRobinExample.java @@ -120,7 +120,7 @@ private Datacenter createDatacenter() { hostList.add(host); } - return new DatacenterSimple(simulation, hostList, new VmPlacementPolicyRoundRobin()); + return DatacenterSimple.of(simulation, hostList, new VmPlacementPolicyRoundRobin()); } private Host createHost() { @@ -132,7 +132,7 @@ private Host createHost() { Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ - return new HostSimple(ram, bw, storage, HOST_CAPACITY, false); + return HostSimple.of(ram, bw, storage, HOST_CAPACITY, false); } /// Creates a list of VMs. @@ -140,7 +140,7 @@ private List createVms() { final var list = new ArrayList(VMS); for (int i = 0; i < VMS; i++) { //Uses a CloudletSchedulerTimeShared by default to schedule Cloudlets - final Vm vm = new VmSimple(VM_CAPACITY); + final Vm vm = VmSimple.of(VM_CAPACITY); vm.setRam(512).setBw(1000).setSize(10000); list.add(vm); } @@ -156,7 +156,7 @@ private List createCloudlets() { final var utilizationModel = new UtilizationModelDynamic(0.5); for (int i = 0; i < CLOUDLETS; i++) { - final var cloudlet = new CloudletSimple(CLOUDLET_LENGTH, CLOUDLET_CORES, utilizationModel); + final var cloudlet = CloudletSimple.of(CLOUDLET_LENGTH, CLOUDLET_CORES, utilizationModel); cloudlet.setSizes(1024); list.add(cloudlet); } diff --git a/src/main/java/org/cloudsimplus/examples/autoscaling/LoadBalancerByHorizontalVmScalingExample.java b/src/main/java/org/cloudsimplus/examples/autoscaling/LoadBalancerByHorizontalVmScalingExample.java index 54437af..e968853 100755 --- a/src/main/java/org/cloudsimplus/examples/autoscaling/LoadBalancerByHorizontalVmScalingExample.java +++ b/src/main/java/org/cloudsimplus/examples/autoscaling/LoadBalancerByHorizontalVmScalingExample.java @@ -222,14 +222,14 @@ private Datacenter createDatacenter() { hostList.add(createHost()); } - return new DatacenterSimple(simulation, hostList).setSchedulingInterval(SCHEDULING_INTERVAL); + return DatacenterSimple.of(simulation, hostList).setSchedulingInterval(SCHEDULING_INTERVAL); } private Host createHost() { final long ram = 2048; // in Megabytes final long storage = 1000000; // in Megabytes final long bw = 10000; //in Megabits/s - return new HostSimple(ram, bw, storage, HOST_CAPACITY) + return HostSimple.of(ram, bw, storage, HOST_CAPACITY) .setRamAllocator(new ResourceAllocatorSimple()) .setBwAllocator(new ResourceAllocatorSimple()) .setVmScheduler(new VmSchedulerTimeShared()); @@ -280,7 +280,7 @@ private boolean isVmOverloaded(final Vm vm) { /// @return the created Vm private Vm createVm() { final int id = createsVms++; - return new VmSimple(id, VM_CAPACITY) + return VmSimple.of(id, VM_CAPACITY) .setRam(512).setBw(1000).setSize(10000) .setCloudletScheduler(new CloudletSchedulerTimeShared()); } @@ -291,7 +291,7 @@ private Cloudlet createCloudlet() { //randomly selects a length for the cloudlet final long length = CLOUDLET_LENGTHS[(int) rand.sample()]; - return new CloudletSimple(id, length, 2) + return CloudletSimple.of(id, length, 2) .setFileSize(1024) .setOutputSize(1024) .setUtilizationModelBw(utilizadionModelDynamic) diff --git a/src/main/java/org/cloudsimplus/examples/autoscaling/VerticalVmCpuScalingDynamicThreshold.java b/src/main/java/org/cloudsimplus/examples/autoscaling/VerticalVmCpuScalingDynamicThreshold.java index 0853235..4742014 100755 --- a/src/main/java/org/cloudsimplus/examples/autoscaling/VerticalVmCpuScalingDynamicThreshold.java +++ b/src/main/java/org/cloudsimplus/examples/autoscaling/VerticalVmCpuScalingDynamicThreshold.java @@ -186,7 +186,7 @@ private void createDatacenter() { hostList.add(createHost()); } - Datacenter dc0 = new DatacenterSimple(simulation, hostList); + Datacenter dc0 = DatacenterSimple.of(simulation, hostList); dc0.setSchedulingInterval(SCHEDULING_INTERVAL); } @@ -195,7 +195,7 @@ private Host createHost() { final long bw = 100000; //in Megabytes final long storage = 10000000; //in Megabytes final int id = hostList.size(); - return new HostSimple(ram, bw, storage, HOST_CAPACITY) + return HostSimple.of(ram, bw, storage, HOST_CAPACITY) .setRamAllocator(new ResourceAllocatorSimple()) .setBwAllocator(new ResourceAllocatorSimple()) .setVmScheduler(new VmSchedulerTimeShared()); @@ -226,7 +226,7 @@ private List createListOfScalableVms(final int numberOfVms) { private Vm createVm() { final int id = createsVms++; - final Vm vm = new VmSimple(id, VM_CAPACITY) + final Vm vm = VmSimple.of(id, VM_CAPACITY) .setRam(VM_RAM).setBw(1000).setSize(10000) .setCloudletScheduler(new CloudletSchedulerTimeShared()); return vm; @@ -378,7 +378,7 @@ private Cloudlet createCloudlet(final long length, final int pesNumber, final do /// use a [UtilizationModelStochastic] to define resource usage randomly, /// or use any other [UtilizationModel] implementation. final var utilizationModelDynamic = new UtilizationModelDynamic(1.0/CLOUDLETS); - final var cl = new CloudletSimple(length, pesNumber); + final var cl = CloudletSimple.of(length, pesNumber); cl.setFileSize(1024) .setOutputSize(1024) .setUtilizationModelBw(utilizationModelDynamic) diff --git a/src/main/java/org/cloudsimplus/examples/autoscaling/VerticalVmCpuScalingExample.java b/src/main/java/org/cloudsimplus/examples/autoscaling/VerticalVmCpuScalingExample.java index 3e5973c..236cf4f 100755 --- a/src/main/java/org/cloudsimplus/examples/autoscaling/VerticalVmCpuScalingExample.java +++ b/src/main/java/org/cloudsimplus/examples/autoscaling/VerticalVmCpuScalingExample.java @@ -181,7 +181,7 @@ private void createDatacenter() { hostList.add(createHost()); } - final var dc0 = new DatacenterSimple(simulation, hostList); + final var dc0 = DatacenterSimple.of(simulation, hostList); dc0.setSchedulingInterval(SCHEDULING_INTERVAL); } @@ -189,7 +189,7 @@ private Host createHost() { final long ram = 20000; //in Megabytes final long bw = 100000; //in Megabytes final long storage = 10000000; //in Megabytes - return new HostSimple(ram, bw, storage, HOST_CAPACITY).setVmScheduler(new VmSchedulerTimeShared()); + return HostSimple.of(ram, bw, storage, HOST_CAPACITY).setVmScheduler(new VmSchedulerTimeShared()); } /// Creates a list of initial VMs in which each VM is able to scale vertically @@ -212,7 +212,7 @@ private List createListOfScalableVms(final int vmsNumber) { private Vm createVm() { final int id = createsVms++; - return new VmSimple(id, VM_CAPACITY).setRam(VM_RAM).setBw(1000).setSize(10000); + return VmSimple.of(id, VM_CAPACITY).setRam(VM_RAM).setBw(1000).setSize(10000); } /// Creates a [VerticalVmScaling] for scaling VM's CPU when it is under or overloaded. @@ -333,7 +333,7 @@ to share the same VM PE (vPE) between multiple Cloudlets, //Each Cloudlet will use 1% of RAM and BW final var utilizationModelDynamic = new UtilizationModelDynamic(0.01); - final var cl = new CloudletSimple(length, pesNumber); + final var cl = CloudletSimple.of(length, pesNumber); cl .setUtilizationModelBw(utilizationModelDynamic) .setUtilizationModelRam(utilizationModelDynamic) diff --git a/src/main/java/org/cloudsimplus/examples/autoscaling/VerticalVmRamScalingExample.java b/src/main/java/org/cloudsimplus/examples/autoscaling/VerticalVmRamScalingExample.java index 95fd808..d2e8039 100755 --- a/src/main/java/org/cloudsimplus/examples/autoscaling/VerticalVmRamScalingExample.java +++ b/src/main/java/org/cloudsimplus/examples/autoscaling/VerticalVmRamScalingExample.java @@ -202,14 +202,14 @@ private void createDatacenter() { hostList.add(createHost()); } - final var dc0 = new DatacenterSimple(simulation, hostList); + final var dc0 = DatacenterSimple.of(simulation, hostList); dc0.setSchedulingInterval(SCHEDULING_INTERVAL); } private Host createHost() { final long bw = 100000; //in Megabytes final long storage = 10000000; //in Megabytes - return new HostSimple(HOST_RAM, bw, storage, HOST_CAPACITY).setVmScheduler(new VmSchedulerTimeShared()); + return HostSimple.of(HOST_RAM, bw, storage, HOST_CAPACITY).setVmScheduler(new VmSchedulerTimeShared()); } /// Creates a list of initial VMs in which each one is able to scale horizontally @@ -232,7 +232,7 @@ private List createListOfScalableVms(final int vmsNumber) { private Vm createVm() { final int id = createsVms++; - return new VmSimple(id, VM_CAPACITY) + return VmSimple.of(id, VM_CAPACITY) .setRam(VM_RAM).setBw(1000).setSize(10000); } @@ -309,7 +309,7 @@ private void createCloudletList() { private Cloudlet createCloudlet(final UtilizationModel ramUtilizationModel, final long length) { final int id = createdCloudlets++; final double initialBwUtilizationPercent = 0.1; - return new CloudletSimple(id, length, CLOUDLET_CORES) + return CloudletSimple.of(id, length, CLOUDLET_CORES) .setUtilizationModelCpu(new UtilizationModelFull()) .setUtilizationModelBw(new UtilizationModelDynamic(initialBwUtilizationPercent)) .setUtilizationModelRam(ramUtilizationModel); diff --git a/src/main/java/org/cloudsimplus/examples/brokers/BrokerTargetDatacenterExample.java b/src/main/java/org/cloudsimplus/examples/brokers/BrokerTargetDatacenterExample.java index 71d5367..cbd629c 100755 --- a/src/main/java/org/cloudsimplus/examples/brokers/BrokerTargetDatacenterExample.java +++ b/src/main/java/org/cloudsimplus/examples/brokers/BrokerTargetDatacenterExample.java @@ -154,7 +154,7 @@ private Datacenter createDatacenter() { .toList(); //Uses a VmPlacementPolicySimple by default to place VMs - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } private Host createHost() { @@ -166,7 +166,7 @@ private Host createHost() { Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ - final Host host = new HostSimple(ram, bw, storage, HOST_CAPACITY); + final Host host = HostSimple.of(ram, bw, storage, HOST_CAPACITY); host.setId(lastHostId++); return host; } @@ -176,7 +176,7 @@ private List createVms(final int vmsNumber) { final var vms = new ArrayList(vmsNumber); for (int i = 0; i < vmsNumber; i++) { //Uses a CloudletSchedulerTimeShared by default to schedule Cloudlets - final Vm vm = new VmSimple(lastVmId++, VM_CAPACITY); + final Vm vm = VmSimple.of(lastVmId++, VM_CAPACITY); vm.setRam(512).setBw(1000).setSize(10000); vms.add(vm); } @@ -192,7 +192,7 @@ private List createCloudlets(int cloudletsNumber) { final var utilizationModel = new UtilizationModelDynamic(0.5); for (int i = 0; i < cloudletsNumber; i++) { - final var cloudlet = new CloudletSimple(lastCloudletId++, CLOUDLET_LENGTH, CLOUDLET_CORES); + final var cloudlet = CloudletSimple.of(lastCloudletId++, CLOUDLET_LENGTH, CLOUDLET_CORES); cloudlet.setUtilizationModel(utilizationModel); cloudlets.add(cloudlet); } diff --git a/src/main/java/org/cloudsimplus/examples/brokers/CloudletToVmMappingBestFit.java b/src/main/java/org/cloudsimplus/examples/brokers/CloudletToVmMappingBestFit.java index 9468bbc..1ed043f 100755 --- a/src/main/java/org/cloudsimplus/examples/brokers/CloudletToVmMappingBestFit.java +++ b/src/main/java/org/cloudsimplus/examples/brokers/CloudletToVmMappingBestFit.java @@ -114,7 +114,7 @@ private Datacenter createDatacenter() { hostList.add(host); } - final var dc = new DatacenterSimple(simulation, hostList); + final var dc = DatacenterSimple.of(simulation, hostList); return dc; } @@ -123,7 +123,7 @@ private Host createHost() { final long bw = 10000; //in Megabits/s final long storage = 1000000; //in Megabytes final var vmScheduler = new VmSchedulerTimeShared(); - final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); + final var host = HostSimple.of(ram, bw, storage, HOST_CAPACITY); host.setVmScheduler(vmScheduler); return host; } @@ -135,7 +135,7 @@ private List createVms() { final var vmList = new ArrayList(VMS); for (int i = VMS-1; i >= 0; i--) { final Vm vm = - new VmSimple(new CoreCapacity(i+1, 1000)) + VmSimple.of(new CoreCapacity(i+1, 1000)) .setRam(512).setBw(1000).setSize(10000) .setCloudletScheduler(new CloudletSchedulerTimeShared()); @@ -153,7 +153,7 @@ private List createCloudlets() { final var utilization = new UtilizationModelFull(); for (int i = 0; i < CLOUDLETS; i++) { final var cloudlet = - new CloudletSimple(CLOUDLET_LENGTH, i+1) + CloudletSimple.of(CLOUDLET_LENGTH, i+1) .setFileSize(1024) .setOutputSize(1024) .setUtilizationModel(utilization); diff --git a/src/main/java/org/cloudsimplus/examples/brokers/DatacenterBrokerBatchVmCreationRequestExample.java b/src/main/java/org/cloudsimplus/examples/brokers/DatacenterBrokerBatchVmCreationRequestExample.java index 285e2e5..5fe2261 100755 --- a/src/main/java/org/cloudsimplus/examples/brokers/DatacenterBrokerBatchVmCreationRequestExample.java +++ b/src/main/java/org/cloudsimplus/examples/brokers/DatacenterBrokerBatchVmCreationRequestExample.java @@ -161,7 +161,7 @@ private Datacenter createDatacenter() { } final var vmPlacementPolicy = new VmPlacementPolicyBatchUnderloadedHosts(new VmSelectionPolicyMinimumUtilization()); - final var dc = new DatacenterSimple(simulation, hostList, vmPlacementPolicy); + final var dc = DatacenterSimple.of(simulation, hostList, vmPlacementPolicy); dc.setSchedulingInterval(SCHEDULING_INTERVAL); return dc; } @@ -171,14 +171,14 @@ private Host createHost() { Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ - return new HostSimple(HOST_RAM, HOST_BW, HOST_STORAGE, HOST_CAPACITY); + return HostSimple.of(HOST_RAM, HOST_BW, HOST_STORAGE, HOST_CAPACITY); } private ArrayList createAndSubmitVms() { final var newVms = new ArrayList(VMS); for (int i = 0; i < VMS; i++) { //Uses a CloudletSchedulerTimeShared by default to schedule Cloudlets - final var vm = new VmSimple(VM_CAPACITY); + final var vm = VmSimple.of(VM_CAPACITY); vm.setRam(512).setBw(1000).setSize(10_000); newVms.add(vm); } @@ -195,7 +195,7 @@ private List createAndSubmitCloudlets(final List vms) { final var utilizationModel = new UtilizationModelDynamic(0.5); for (final var vm : vms) { - final var cloudlet = new CloudletSimple(CLOUDLET_LENGTH, CLOUDLET_CORES, utilizationModel); + final var cloudlet = CloudletSimple.of(CLOUDLET_LENGTH, CLOUDLET_CORES, utilizationModel); cloudlet.setSizes(1024); broker0.bindCloudletToVm(cloudlet, vm); newCloulets.add(cloudlet); diff --git a/src/main/java/org/cloudsimplus/examples/brokers/DatacenterBrokerHeuristicExample.java b/src/main/java/org/cloudsimplus/examples/brokers/DatacenterBrokerHeuristicExample.java index 7c1ce54..53dd862 100755 --- a/src/main/java/org/cloudsimplus/examples/brokers/DatacenterBrokerHeuristicExample.java +++ b/src/main/java/org/cloudsimplus/examples/brokers/DatacenterBrokerHeuristicExample.java @@ -30,6 +30,7 @@ import org.cloudsimplus.cloudlets.Cloudlet; import org.cloudsimplus.cloudlets.CloudletSimple; import org.cloudsimplus.core.CloudSimPlus; +import org.cloudsimplus.datacenters.Datacenter; import org.cloudsimplus.datacenters.DatacenterSimple; import org.cloudsimplus.distributions.UniformDistr; import org.cloudsimplus.heuristics.CloudletToVmMappingHeuristic; @@ -176,13 +177,13 @@ private int getRandomPesNumber(final int maxPesNumber) { return heuristic.getRandomValue(maxPesNumber)+1; } - private DatacenterSimple createDatacenter() { + private Datacenter createDatacenter() { final var hostList = new ArrayList(); for(int i = 0; i < HOSTS_TO_CREATE; i++) { hostList.add(createHost()); } - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } private Host createHost() { @@ -194,7 +195,7 @@ private Host createHost() { //Defines the number of Host CPU cores and the MIPS capacity of each core final var cpuCapacity = new CoreCapacity(8, mips); - return new HostSimple(ram, bw, storage, cpuCapacity) + return HostSimple.of(ram, bw, storage, cpuCapacity) .setRamAllocator(new ResourceAllocatorSimple()) .setBwAllocator(new ResourceAllocatorSimple()) .setVmScheduler(new VmSchedulerTimeShared()); @@ -206,7 +207,7 @@ private Vm createVm(final DatacenterBroker broker, final int pesNumber) { final int ram = 512; // vm memory (Megabyte) final long bw = 1000; // vm bandwidth - return new VmSimple(createdVms++, new CoreCapacity(pesNumber, mips)) + return VmSimple.of(createdVms++, new CoreCapacity(pesNumber, mips)) .setRam(ram).setBw(bw).setSize(storage) .setCloudletScheduler(new CloudletSchedulerTimeShared()); } @@ -219,7 +220,7 @@ private Cloudlet createCloudlet(final DatacenterBroker broker, final int pesNumb final var utilizationFull = new UtilizationModelFull(); final var utilizationDynamic = new UtilizationModelDynamic(0.1); - return new CloudletSimple(createdCloudlets++, length, pesNumber) + return CloudletSimple.of(createdCloudlets++, length, pesNumber) .setFileSize(fileSize) .setOutputSize(outputSize) .setUtilizationModelCpu(utilizationFull) diff --git a/src/main/java/org/cloudsimplus/examples/brokers/DatacenterBrokersMappingComparison.java b/src/main/java/org/cloudsimplus/examples/brokers/DatacenterBrokersMappingComparison.java index 2bb98c0..1996e2b 100755 --- a/src/main/java/org/cloudsimplus/examples/brokers/DatacenterBrokersMappingComparison.java +++ b/src/main/java/org/cloudsimplus/examples/brokers/DatacenterBrokersMappingComparison.java @@ -34,6 +34,7 @@ import org.cloudsimplus.cloudlets.CloudletSimple; import org.cloudsimplus.core.CloudSimPlus; import org.cloudsimplus.core.Simulation; +import org.cloudsimplus.datacenters.Datacenter; import org.cloudsimplus.datacenters.DatacenterSimple; import org.cloudsimplus.distributions.ContinuousDistribution; import org.cloudsimplus.distributions.UniformDistr; @@ -202,13 +203,13 @@ private int getRandomPesNumber(final int maxPesNumber, final ContinuousDistribut return (int) (uniform >= 1 ? uniform % maxPesNumber : uniform * maxPesNumber) + 1; } - private DatacenterSimple createDatacenter(final Simulation sim) { + private Datacenter createDatacenter(final Simulation sim) { final var hostList = new ArrayList(); for (int i = 0; i < HOSTS_TO_CREATE; i++) { hostList.add(createHost()); } - return new DatacenterSimple(sim, hostList, new VmPlacementPolicySimple()); + return DatacenterSimple.of(sim, hostList, new VmPlacementPolicySimple()); } private Host createHost() { @@ -220,7 +221,7 @@ private Host createHost() { //Defines the number of Host CPU cores and the MIPS capacity of each core final var cpuCapacity = new CoreCapacity(8, mips); - return new HostSimple(ram, bw, storage, cpuCapacity) + return HostSimple.of(ram, bw, storage, cpuCapacity) .setRamAllocator(new ResourceAllocatorSimple()) .setBwAllocator(new ResourceAllocatorSimple()) .setVmScheduler(new VmSchedulerTimeShared()); @@ -232,7 +233,7 @@ private Vm createVm(final long id, final int pesNumber) { final int ram = 512; // vm memory (Megabyte) final long bw = 1000; // vm bandwidth - return new VmSimple(id, new CoreCapacity(pesNumber, mips)) + return VmSimple.of(id, new CoreCapacity(pesNumber, mips)) .setRam(ram).setBw(bw).setSize(storage) .setCloudletScheduler(new CloudletSchedulerTimeShared()); } @@ -245,7 +246,7 @@ private Cloudlet createCloudlet(final long id, final int pesNumber) { //Defines how RAM and Bandwidth resources are used final var ramAndBwUtilizationModel = new UtilizationModelDynamic(0.1); - return new CloudletSimple(id, length, pesNumber) + return CloudletSimple.of(id, length, pesNumber) .setFileSize(fileSize) .setOutputSize(outputSize) .setUtilizationModelCpu(new UtilizationModelFull()) diff --git a/src/main/java/org/cloudsimplus/examples/brokers/DatacenterSelectionByTimeZoneExample.java b/src/main/java/org/cloudsimplus/examples/brokers/DatacenterSelectionByTimeZoneExample.java index 7d02570..f0520a2 100755 --- a/src/main/java/org/cloudsimplus/examples/brokers/DatacenterSelectionByTimeZoneExample.java +++ b/src/main/java/org/cloudsimplus/examples/brokers/DatacenterSelectionByTimeZoneExample.java @@ -175,7 +175,7 @@ private Datacenter createDatacenter(final double timeZone) { } //Uses a VmPlacementPolicySimple by default to place VMs - final var dc = new DatacenterSimple(simulation, hostList); + final var dc = DatacenterSimple.of(simulation, hostList); dc.setTimeZone(timeZone); return dc; } @@ -189,7 +189,7 @@ private Host createHost() { Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ - final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); + final var host = HostSimple.of(ram, bw, storage, HOST_CAPACITY); host.setId(++lastHostId); return host; } @@ -201,7 +201,7 @@ private List createVms() { final var vmList = new ArrayList(VMS_TIMEZONES.length); for (final double timezone : VMS_TIMEZONES) { //Uses a CloudletSchedulerTimeShared by default to schedule Cloudlets - final Vm vm = new VmSimple(VM_CAPACITY); + final Vm vm = VmSimple.of(VM_CAPACITY); vm.setRam(512).setBw(1000).setSize(10000).setTimeZone(timezone); vmList.add(vm); } @@ -217,7 +217,7 @@ private List createCloudlets() { final var utilizationModel = new UtilizationModelDynamic(0.5); for (int i = 0; i < CLOUDLETS; i++) { - final var cloudlet = new CloudletSimple(CLOUDLET_LENGTH, CLOUDLET_CORES, utilizationModel); + final var cloudlet = CloudletSimple.of(CLOUDLET_LENGTH, CLOUDLET_CORES, utilizationModel); cloudlet.setSizes(1024); cloudletList.add(cloudlet); } diff --git a/src/main/java/org/cloudsimplus/examples/brokers/MultipleBrokers1.java b/src/main/java/org/cloudsimplus/examples/brokers/MultipleBrokers1.java index e0e654a..879b663 100755 --- a/src/main/java/org/cloudsimplus/examples/brokers/MultipleBrokers1.java +++ b/src/main/java/org/cloudsimplus/examples/brokers/MultipleBrokers1.java @@ -182,7 +182,7 @@ private Datacenter createDatacenter() { hostList.add(host); } - final var dc = new DatacenterSimple(simulation, hostList); + final var dc = DatacenterSimple.of(simulation, hostList); dc.setSchedulingInterval(SCHEDULING_INTERVAL); return dc; } @@ -194,7 +194,7 @@ private Host createHost() { final var ramAllocator = new ResourceAllocatorSimple(); final var bwAllocator = new ResourceAllocatorSimple(); final var vmScheduler = new VmSchedulerTimeShared(); - final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); + final var host = HostSimple.of(ram, bw, storage, HOST_CAPACITY); host .setRamAllocator(ramAllocator) .setBwAllocator(bwAllocator) @@ -207,7 +207,7 @@ private List createAndSubmitVms(DatacenterBroker broker) { final var vmList = new ArrayList(VMS); for (int i = 0; i < VMS; i++) { final Vm vm = - new VmSimple(this.vmList.size()+i, VM_CAPACITY) + VmSimple.of(this.vmList.size()+i, VM_CAPACITY) .setRam(512).setBw(1000).setSize(10000) .setCloudletScheduler(new CloudletSchedulerTimeShared()); @@ -234,7 +234,7 @@ private List createAndSubmitCloudlets(DatacenterBroker broker, final i private Cloudlet createCloudlet(final int id, final int length) { final var utilization = new UtilizationModelFull(); - final var cloudlet = new CloudletSimple(id, length, CLOUDLET_CORES); + final var cloudlet = CloudletSimple.of(id, length, CLOUDLET_CORES); cloudlet .setFileSize(1024) .setOutputSize(1024) diff --git a/src/main/java/org/cloudsimplus/examples/brokers/MultipleBrokers2.java b/src/main/java/org/cloudsimplus/examples/brokers/MultipleBrokers2.java index f3baaab..f735fbc 100755 --- a/src/main/java/org/cloudsimplus/examples/brokers/MultipleBrokers2.java +++ b/src/main/java/org/cloudsimplus/examples/brokers/MultipleBrokers2.java @@ -236,7 +236,7 @@ private Datacenter createDatacenter() { hostList.add(host); } - final var dc = new DatacenterSimple(simulation, hostList); + final var dc = DatacenterSimple.of(simulation, hostList); dc.setSchedulingInterval(SCHEDULING_INTERVAL); return dc; } @@ -248,7 +248,7 @@ private Host createHost() { final var ramAllocator = new ResourceAllocatorSimple(); final var bwAllocator = new ResourceAllocatorSimple(); final var vmScheduler = new VmSchedulerTimeShared(); - final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); + final var host = HostSimple.of(ram, bw, storage, HOST_CAPACITY); host .setRamAllocator(ramAllocator) .setBwAllocator(bwAllocator) @@ -261,7 +261,7 @@ private List createAndSubmitVms(DatacenterBroker broker) { final var vmList = new ArrayList(VMS); for (int i = 0; i < VMS; i++) { final var vm = - new VmSimple(this.vmList.size()+i, VM_CAPACITY) + VmSimple.of(this.vmList.size()+i, VM_CAPACITY) .setRam(512).setBw(1000).setSize(10000) .setCloudletScheduler(new CloudletSchedulerTimeShared()); @@ -288,7 +288,7 @@ private List createAndSubmitCloudlets(DatacenterBroker broker, final i private Cloudlet createCloudlet(final int id, final int length) { final var utilization = new UtilizationModelFull(); - final var cloudlet = new CloudletSimple(id, length, CLOUDLET_CORES); + final var cloudlet = CloudletSimple.of(id, length, CLOUDLET_CORES); cloudlet .setFileSize(1024) .setOutputSize(1024) diff --git a/src/main/java/org/cloudsimplus/examples/brokers/MultipleBrokers3.java b/src/main/java/org/cloudsimplus/examples/brokers/MultipleBrokers3.java index 25ded71..5bad69a 100755 --- a/src/main/java/org/cloudsimplus/examples/brokers/MultipleBrokers3.java +++ b/src/main/java/org/cloudsimplus/examples/brokers/MultipleBrokers3.java @@ -145,14 +145,14 @@ private Datacenter createDatacenter() { hostList.add(createHost()); } - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } private Host createHost() { final long ram = 2048; //in Megabytes final long bw = 10000; //in Megabits/s final long storage = 1000000; //in Megabytes - final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); + final var host = HostSimple.of(ram, bw, storage, HOST_CAPACITY); host .setRamAllocator(new ResourceAllocatorSimple()) .setBwAllocator(new ResourceAllocatorSimple()) @@ -164,7 +164,7 @@ private List createAndSubmitVms(DatacenterBroker broker) { final var vmList = new ArrayList(VMS); for (int i = 0; i < VMS; i++) { final var vm = - new VmSimple(VM_CAPACITY) + VmSimple.of(VM_CAPACITY) .setRam(512).setBw(1000).setSize(10000) .setCloudletScheduler(new CloudletSchedulerTimeShared()); @@ -180,7 +180,7 @@ private List createAndSubmitCloudlets(DatacenterBroker broker) { final var cloudletList = new ArrayList(CLOUDLETS); for (int i = 1; i <= CLOUDLETS; i++) { final var utilizationModel = new UtilizationModelFull(); - final var cloudlet = new CloudletSimple(CLOUDLET_LENGTH, CLOUDLET_CORES); + final var cloudlet = CloudletSimple.of(CLOUDLET_LENGTH, CLOUDLET_CORES); cloudlet .setFileSize(1024) .setOutputSize(1024) diff --git a/src/main/java/org/cloudsimplus/examples/brokers/SelectNextDatacenterExample.java b/src/main/java/org/cloudsimplus/examples/brokers/SelectNextDatacenterExample.java index 0d77656..7caa44b 100755 --- a/src/main/java/org/cloudsimplus/examples/brokers/SelectNextDatacenterExample.java +++ b/src/main/java/org/cloudsimplus/examples/brokers/SelectNextDatacenterExample.java @@ -125,7 +125,7 @@ private Datacenter createDatacenter(final int hostsPes) { } //Uses a VmPlacementPolicySimple by default to place VMs - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } private Host createHost(final int pes) { @@ -139,7 +139,7 @@ private Host createHost(final int pes) { Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ - final var host = new HostSimple(ram, bw, storage, cpuCapacity); + final var host = HostSimple.of(ram, bw, storage, cpuCapacity); host.setId(++lastHostId); return host; } @@ -149,7 +149,7 @@ private List createVms() { final var vmList = new ArrayList(VMS); for (int i = 0; i < VMS; i++) { //Uses a CloudletSchedulerTimeShared by default to schedule Cloudlets - final Vm vm = new VmSimple(VM_CAPACITY); + final Vm vm = VmSimple.of(VM_CAPACITY); vm.setRam(512).setBw(1000).setSize(10000); vmList.add(vm); } @@ -165,7 +165,7 @@ private List createCloudlets() { final var utilizationModel = new UtilizationModelDynamic(0.5); for (int i = 0; i < CLOUDLETS; i++) { - final var cloudlet = new CloudletSimple(CLOUDLET_LENGTH, CLOUDLET_CORES, utilizationModel); + final var cloudlet = CloudletSimple.of(CLOUDLET_LENGTH, CLOUDLET_CORES, utilizationModel); cloudlet.setSizes(1024); cloudletList.add(cloudlet); } diff --git a/src/main/java/org/cloudsimplus/examples/costs/CostsExample1.java b/src/main/java/org/cloudsimplus/examples/costs/CostsExample1.java index 614c253..9666a1c 100755 --- a/src/main/java/org/cloudsimplus/examples/costs/CostsExample1.java +++ b/src/main/java/org/cloudsimplus/examples/costs/CostsExample1.java @@ -144,7 +144,7 @@ private Datacenter createDatacenter() { } //Uses a VmPlacementPolicySimple by default to place VMs - final var dc = new DatacenterSimple(simulation, hostList).setSchedulingInterval(SCHEDULING_INTERVAL); + final var dc = DatacenterSimple.of(simulation, hostList).setSchedulingInterval(SCHEDULING_INTERVAL); // Those are monetary values. Consider any currency you want (such as Dollar) dc.setCharacteristics(new DatacenterCharacteristicsSimple(0.01, 0.02, 0.001, 0.005)); @@ -160,7 +160,7 @@ private Host createHost() { Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ - return new HostSimple(ram, bw, storage, HOST_CAPACITY); + return HostSimple.of(ram, bw, storage, HOST_CAPACITY); } /// Creates a list of VMs. @@ -168,7 +168,7 @@ private List createVms() { final var vmList = new ArrayList(VMS); for (int id = 0; id < VMS; id++) { //Uses a CloudletSchedulerTimeShared by default to schedule Cloudlets - final Vm vm = new VmSimple(id, VM_CAPACITY); + final Vm vm = VmSimple.of(id, VM_CAPACITY); vm.setRam(VM_RAM).setBw(VM_BW).setSize(VM_SIZE); vmList.add(vm); } @@ -187,7 +187,7 @@ private List createCloudlets() { for (int i = 1; i <= VMS/3; i++) { final Vm vm = vmList.get(i-1); for (int j = 0; j < CLOUDLET_BY_VM; j++) { - final var cloudlet = new CloudletSimple(cloudletId, (cloudletId+1) * CLOUDLET_LENGTH, CLOUDLET_CORES); + final var cloudlet = CloudletSimple.of(cloudletId, (cloudletId+1) * CLOUDLET_LENGTH, CLOUDLET_CORES); cloudlet.setSizes(1024).setUtilizationModel(utilizationModel); cloudlet.setVm(vm); newCloudletList.add(cloudlet); diff --git a/src/main/java/org/cloudsimplus/examples/dynamic/CreateCloudletAfterLastFinishedOne.java b/src/main/java/org/cloudsimplus/examples/dynamic/CreateCloudletAfterLastFinishedOne.java index 1d420d6..dcdaace 100755 --- a/src/main/java/org/cloudsimplus/examples/dynamic/CreateCloudletAfterLastFinishedOne.java +++ b/src/main/java/org/cloudsimplus/examples/dynamic/CreateCloudletAfterLastFinishedOne.java @@ -123,7 +123,7 @@ private List createAndSubmitVms() { private Vm createVm() { final int mips = 1000; - return new VmSimple(new CoreCapacity(VM_PES_NUMBER, mips)) + return VmSimple.of(new CoreCapacity(VM_PES_NUMBER, mips)) .setRam(512).setBw(1000).setSize(10000) .setCloudletScheduler(new CloudletSchedulerTimeShared()); } @@ -137,7 +137,7 @@ private void createAndSubmitOneCloudlet() { final int id = cloudletList.size(); final long length = 10000; //in number of Million Instructions (MI) final int pesNumber = 1; - final var cloudlet = new CloudletSimple(id, length, pesNumber) + final var cloudlet = CloudletSimple.of(id, length, pesNumber) .setFileSize(300) .setOutputSize(300) .setUtilizationModel(new UtilizationModelFull()); @@ -166,7 +166,7 @@ private Datacenter createDatacenter() { hostList.add(createHost(i)); } - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } /// Creates a host with pre-defined configuration. @@ -180,7 +180,7 @@ private Host createHost(int id) { long storage = 1000000; // host storage (Megabyte) long bw = 10000; //Megabits/s - return new HostSimple(ram, bw, storage, cpuCapacity) + return HostSimple.of(ram, bw, storage, cpuCapacity) .setRamAllocator(new ResourceAllocatorSimple()) .setBwAllocator(new ResourceAllocatorSimple()) .setVmScheduler(new VmSchedulerSpaceShared()); diff --git a/src/main/java/org/cloudsimplus/examples/dynamic/DynamicCloudletsArrival1.java b/src/main/java/org/cloudsimplus/examples/dynamic/DynamicCloudletsArrival1.java index 8c82d90..0d397d7 100755 --- a/src/main/java/org/cloudsimplus/examples/dynamic/DynamicCloudletsArrival1.java +++ b/src/main/java/org/cloudsimplus/examples/dynamic/DynamicCloudletsArrival1.java @@ -160,7 +160,7 @@ private Vm createVm() { final int ram = 512; // vm memory (Megabyte) final long bw = 1000; - return new VmSimple(new CoreCapacity(VM_PES_NUMBER, mips)) + return VmSimple.of(new CoreCapacity(VM_PES_NUMBER, mips)) .setRam(ram).setBw(bw).setSize(size) .setCloudletScheduler(new CloudletSchedulerTimeShared()); } @@ -177,7 +177,7 @@ private Cloudlet createCloudlet(Vm vm) { final var utilizationModel = new UtilizationModelFull(); final var utilizationModelDynamic = new UtilizationModelDynamic(0.05); - final var cloudlet = new CloudletSimple(length, pesNumber) + final var cloudlet = CloudletSimple.of(length, pesNumber) .setFileSize(fileSize) .setOutputSize(outputSize) .setUtilizationModelCpu(utilizationModel) @@ -194,7 +194,7 @@ private Cloudlet createCloudlet(Vm vm) { private Datacenter createDatacenter() { final var host = createHost(0); hostList.add(host); - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } /// Creates a host with pre-defined configuration. @@ -209,6 +209,6 @@ private Host createHost(int id) { final long storage = 1000000; // host storage (Megabyte) final long bw = 10000; //Megabits/s - return new HostSimple(ram, bw, storage, cpuCapacity).setVmScheduler(new VmSchedulerSpaceShared()); + return HostSimple.of(ram, bw, storage, cpuCapacity).setVmScheduler(new VmSchedulerSpaceShared()); } } diff --git a/src/main/java/org/cloudsimplus/examples/dynamic/DynamicCloudletsArrival2.java b/src/main/java/org/cloudsimplus/examples/dynamic/DynamicCloudletsArrival2.java index e906b19..b99634a 100755 --- a/src/main/java/org/cloudsimplus/examples/dynamic/DynamicCloudletsArrival2.java +++ b/src/main/java/org/cloudsimplus/examples/dynamic/DynamicCloudletsArrival2.java @@ -157,7 +157,7 @@ private Vm createVm(int id, DatacenterBroker broker) { final int ram = 512; // vm memory (Megabyte) final long bw = 1000; - return new VmSimple(id, new CoreCapacity(VM_PES_NUMBER, mips)) + return VmSimple.of(id, new CoreCapacity(VM_PES_NUMBER, mips)) .setRam(ram).setBw(bw).setSize(size) .setCloudletScheduler(new CloudletSchedulerTimeShared()); } @@ -174,7 +174,7 @@ private Cloudlet createCloudlet(int id, Vm vm, DatacenterBroker broker) { final long length = 10000; //in number of Million Instructions (MI) final int pesNumber = 1; - return new CloudletSimple(id, length, pesNumber) + return CloudletSimple.of(id, length, pesNumber) .setFileSize(fileSize) .setOutputSize(outputSize) .setUtilizationModelCpu(new UtilizationModelFull()) @@ -190,7 +190,7 @@ private Datacenter createDatacenter() { final var host = createHost(0); hostList.add(host); - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } /// Creates a host with pre-defined configuration. @@ -206,6 +206,6 @@ private Host createHost(int id) { final long storage = 1000000; // in Megabytes final long bw = 10000; //in Megabits/s - return new HostSimple(ram, bw, storage, cpuCapacity).setVmScheduler(new VmSchedulerSpaceShared()); + return HostSimple.of(ram, bw, storage, cpuCapacity).setVmScheduler(new VmSchedulerSpaceShared()); } } diff --git a/src/main/java/org/cloudsimplus/examples/dynamic/DynamicCreationOfVmsAndCloudletsExample.java b/src/main/java/org/cloudsimplus/examples/dynamic/DynamicCreationOfVmsAndCloudletsExample.java index 22aedf4..53f2161 100755 --- a/src/main/java/org/cloudsimplus/examples/dynamic/DynamicCreationOfVmsAndCloudletsExample.java +++ b/src/main/java/org/cloudsimplus/examples/dynamic/DynamicCreationOfVmsAndCloudletsExample.java @@ -29,6 +29,7 @@ import org.cloudsimplus.cloudlets.Cloudlet; import org.cloudsimplus.cloudlets.CloudletSimple; import org.cloudsimplus.core.CloudSimPlus; +import org.cloudsimplus.datacenters.Datacenter; import org.cloudsimplus.datacenters.DatacenterSimple; import org.cloudsimplus.hosts.Host; import org.cloudsimplus.hosts.HostSimple; @@ -141,7 +142,7 @@ private void submitNewVmsAndCloudletsToBroker(CloudletVmEventInfo eventInfo) { } - private DatacenterSimple createDatacenter() { + private Datacenter createDatacenter() { final int numberOfHosts = 1; final var hostList = new ArrayList(numberOfHosts); for (int i = 0; i < numberOfHosts; i++) { @@ -149,7 +150,7 @@ private DatacenterSimple createDatacenter() { hostList.add(host); } - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } private Host createHost() { @@ -161,7 +162,7 @@ private Host createHost() { final int pesNumber = 8; final var cpuCapacity = new CoreCapacity(pesNumber, mips); - return new HostSimple(ram, bw, storage, cpuCapacity).setVmScheduler(new VmSchedulerTimeShared()); + return HostSimple.of(ram, bw, storage, cpuCapacity).setVmScheduler(new VmSchedulerTimeShared()); } private Vm createVm(DatacenterBroker broker) { @@ -171,7 +172,7 @@ private Vm createVm(DatacenterBroker broker) { final long bw = 1000; // vm bandwidth (Megabits/s) final int pesNumber = 1; // number of CPU cores - return new VmSimple(createVmsNumber++, new CoreCapacity(pesNumber, mips)) + return VmSimple.of(createVmsNumber++, new CoreCapacity(pesNumber, mips)) .setRam(ram) .setBw(bw) .setSize(storage) @@ -188,7 +189,7 @@ private Cloudlet createCloudlet(DatacenterBroker broker, Vm vm) { //Sets the same utilization model for all these resources. final var utilization = new UtilizationModelFull(); - return new CloudletSimple(createdCloudletsNumber++, length, numberOfCpuCores) + return CloudletSimple.of(createdCloudletsNumber++, length, numberOfCpuCores) .setFileSize(fileSize) .setOutputSize(outputSize) .setUtilizationModel(utilization) diff --git a/src/main/java/org/cloudsimplus/examples/dynamic/DynamicHostCreation.java b/src/main/java/org/cloudsimplus/examples/dynamic/DynamicHostCreation.java index 62f0dfa..92215e0 100755 --- a/src/main/java/org/cloudsimplus/examples/dynamic/DynamicHostCreation.java +++ b/src/main/java/org/cloudsimplus/examples/dynamic/DynamicHostCreation.java @@ -185,7 +185,7 @@ private Datacenter createDatacenter() { hostList.add(host); } - final var dc = new DatacenterSimple(simulation, hostList); + final var dc = DatacenterSimple.of(simulation, hostList); dc.setSchedulingInterval(SCHEDULING_INTERVAL); return dc; } @@ -195,7 +195,7 @@ private Host createHost() { final long bw = 10000; //in Megabits/s final long storage = 1000000; //in Megabytes final var vmScheduler = new VmSchedulerTimeShared(); - final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); + final var host = HostSimple.of(ram, bw, storage, HOST_CAPACITY); host.setVmScheduler(vmScheduler); return host; } @@ -211,7 +211,7 @@ private List createVms(final int count) { } private Vm createVm(final int id) { - return new VmSimple(id, VM_CAPACITY) + return VmSimple.of(id, VM_CAPACITY) .setRam(512).setBw(1000).setSize(10000) .setCloudletScheduler(new CloudletSchedulerTimeShared()); } @@ -221,7 +221,7 @@ private List createCloudlets(final int count) { final var utilization = new UtilizationModelFull(); for (int i = 0; i < count; i++) { final var cloudlet = - new CloudletSimple(CLOUDLET_LENGTH, CLOUDLET_CORES) + CloudletSimple.of(CLOUDLET_LENGTH, CLOUDLET_CORES) .setFileSize(1024) .setOutputSize(1024) .setUtilizationModelCpu(new UtilizationModelFull()) diff --git a/src/main/java/org/cloudsimplus/examples/dynamic/DynamicVmPlacementPolicyBestFitExample.java b/src/main/java/org/cloudsimplus/examples/dynamic/DynamicVmPlacementPolicyBestFitExample.java index c7e5734..091f529 100755 --- a/src/main/java/org/cloudsimplus/examples/dynamic/DynamicVmPlacementPolicyBestFitExample.java +++ b/src/main/java/org/cloudsimplus/examples/dynamic/DynamicVmPlacementPolicyBestFitExample.java @@ -190,7 +190,7 @@ public void createAndSubmitCloudlets(DatacenterBroker broker) { /// @return the created Cloudlets public Cloudlet createCloudlet(Vm vm, DatacenterBroker broker) { final var cloudlet = - new CloudletSimple(CLOUDLET_LENGHT, (int)vm.getProcessor().getCores()) + CloudletSimple.of(CLOUDLET_LENGHT, (int)vm.getProcessor().getCores()) .setFileSize(CLOUDLET_FILESIZE) .setOutputSize(CLOUDLET_OUTPUTSIZE) .setUtilizationModel(new UtilizationModelFull()); @@ -210,7 +210,7 @@ public void createAndSubmitVms(DatacenterBroker broker) { } public Vm createVm(int pes) { - final var vm = new VmSimple(new CoreCapacity(pes, VM_MIPS)); + final var vm = VmSimple.of(new CoreCapacity(pes, VM_MIPS)); vm .setRam(VM_RAM).setBw((long)VM_BW).setSize(VM_SIZE) .setCloudletScheduler(new CloudletSchedulerTimeShared()); @@ -232,7 +232,7 @@ private Datacenter createDatacenter() { /*Creates a VmPlacementPolicy and changes, at runtime, the policy used to select a Host for a VM.*/ final var allocationPolicy = new VmPlacementPolicySimple(this::bestFitHostSelectionPolicy); - final var dc = new DatacenterSimple(simulation, hostList, allocationPolicy); + final var dc = DatacenterSimple.of(simulation, hostList, allocationPolicy); hostList.forEach(host -> System.out.printf("#Created %s with %d PEs%n", host, host.getProcessor().getCores())); System.out.println(); @@ -243,7 +243,7 @@ private Datacenter createDatacenter() { public Host createHost(int pesNumber, long mipsByPe) { final var cpuCapacity = new CoreCapacity(pesNumber, mipsByPe); - final var host = new HostSimple(HOST_RAM, HOST_BW, HOST_STORAGE, cpuCapacity); + final var host = HostSimple.of(HOST_RAM, HOST_BW, HOST_STORAGE, cpuCapacity); host.setVmScheduler(new VmSchedulerTimeShared()); return host; } diff --git a/src/main/java/org/cloudsimplus/examples/dynamic/DynamicVmsArrival.java b/src/main/java/org/cloudsimplus/examples/dynamic/DynamicVmsArrival.java index a381398..5595a0f 100755 --- a/src/main/java/org/cloudsimplus/examples/dynamic/DynamicVmsArrival.java +++ b/src/main/java/org/cloudsimplus/examples/dynamic/DynamicVmsArrival.java @@ -186,7 +186,7 @@ private Vm createVm(final double submissionDelay) { final int ram = 512; // vm memory (Megabyte) final long bw = 1000; - final var vm = new VmSimple(new CoreCapacity(VM_CORES, mips)); + final var vm = VmSimple.of(new CoreCapacity(VM_CORES, mips)); vm.setRam(ram) .setBw(bw) .setSize(size) @@ -216,7 +216,7 @@ private Cloudlet createCloudlet(final Vm vm) { final var utilizationModelFull = new UtilizationModelFull(); final var utilizationModelDynamic = new UtilizationModelDynamic(0.2); - return new CloudletSimple(CLOUDLET_LENGTH, CLOUDLET_CORES) + return CloudletSimple.of(CLOUDLET_LENGTH, CLOUDLET_CORES) .setUtilizationModelCpu(utilizationModelFull) .setUtilizationModelRam(utilizationModelDynamic) .setUtilizationModelBw(utilizationModelDynamic) @@ -231,7 +231,7 @@ private Datacenter createDatacenter() { hostList.add(createHost()); } - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } /// Creates a host with pre-defined configuration. @@ -242,6 +242,6 @@ private Host createHost() { long storage = 1000000; // host storage (Megabyte) long bw = 10000; //Megabits/s - return new HostSimple(ram, bw, storage, HOST_CAPACITY); + return HostSimple.of(ram, bw, storage, HOST_CAPACITY); } } diff --git a/src/main/java/org/cloudsimplus/examples/dynamic/DynamicVmsArrival2.java b/src/main/java/org/cloudsimplus/examples/dynamic/DynamicVmsArrival2.java index c1516d1..21bbc96 100644 --- a/src/main/java/org/cloudsimplus/examples/dynamic/DynamicVmsArrival2.java +++ b/src/main/java/org/cloudsimplus/examples/dynamic/DynamicVmsArrival2.java @@ -148,7 +148,7 @@ private Vm createVm(final int id) { final int ram = 512; // vm memory (Megabyte) final long bw = 1000; - return new VmSimple(id, new CoreCapacity(VM_PES_NUMBER, mips)).setRam(ram).setBw(bw).setSize(size); + return VmSimple.of(id, new CoreCapacity(VM_PES_NUMBER, mips)).setRam(ram).setBw(bw).setSize(size); } /// Creates a cloudlet with pre-defined configuration. @@ -163,7 +163,7 @@ private Cloudlet createCloudlet(final int id, final Vm vm) { final int pesNumber = 1; final var utilizationModel = new UtilizationModelFull(); - return new CloudletSimple(id, length, pesNumber) + return CloudletSimple.of(id, length, pesNumber) .setFileSize(fileSize) .setOutputSize(outputSize) .setUtilizationModel(utilizationModel) @@ -178,7 +178,7 @@ private Datacenter createDatacenter() { hostList.add(createHost()); } - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } /// Creates a host with pre-defined configuration. @@ -191,6 +191,6 @@ private Host createHost() { final long storage = 1000000; // in Megabytes final long bw = 10000; //in Megabits/s - return new HostSimple(ram, bw, storage, cpuCapacity); + return HostSimple.of(ram, bw, storage, cpuCapacity); } } diff --git a/src/main/java/org/cloudsimplus/examples/dynamic/IndefiniteLengthCloudlet.java b/src/main/java/org/cloudsimplus/examples/dynamic/IndefiniteLengthCloudlet.java index 9f0e500..633d821 100755 --- a/src/main/java/org/cloudsimplus/examples/dynamic/IndefiniteLengthCloudlet.java +++ b/src/main/java/org/cloudsimplus/examples/dynamic/IndefiniteLengthCloudlet.java @@ -137,14 +137,14 @@ private Datacenter createDatacenter() { hostList.add(host); } - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } private Host createHost() { final long ram = 2048; //in Megabytes final long bw = 10000; //in Megabits/s final long storage = 1000000; //in Megabytes - final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); + final var host = HostSimple.of(ram, bw, storage, HOST_CAPACITY); host.setVmScheduler(new VmSchedulerTimeShared()); return host; } @@ -154,7 +154,7 @@ private List createVms() { final var newVmList = new ArrayList(VMS); for (int i = 0; i < VMS; i++) { final var vm = - new VmSimple(i, VM_CAPACITY) + VmSimple.of(i, VM_CAPACITY) .setRam(512).setBw(1000).setSize(10000) .setCloudletScheduler(new CloudletSchedulerTimeShared()); @@ -174,7 +174,7 @@ private List createCloudlets() { for (int i = 0; i < CLOUDLETS; i++) { final var cloudlet = - new CloudletSimple(CLOUDLET_LENGTH, CLOUDLET_CORES) + CloudletSimple.of(CLOUDLET_LENGTH, CLOUDLET_CORES) .setFileSize(1024) .setOutputSize(1024) .setUtilizationModelCpu(utilizationFull) diff --git a/src/main/java/org/cloudsimplus/examples/dynamic/KeepSimulationRunningExample.java b/src/main/java/org/cloudsimplus/examples/dynamic/KeepSimulationRunningExample.java index 79fd663..37aafe3 100755 --- a/src/main/java/org/cloudsimplus/examples/dynamic/KeepSimulationRunningExample.java +++ b/src/main/java/org/cloudsimplus/examples/dynamic/KeepSimulationRunningExample.java @@ -160,7 +160,7 @@ private Datacenter createDatacenter() { hostList.add(host); } - final var dc = new DatacenterSimple(simulation, hostList); + final var dc = DatacenterSimple.of(simulation, hostList); dc.setSchedulingInterval(SCHEDULING_INTERVAL); return dc; } @@ -169,7 +169,7 @@ private Host createHost() { final long ram = 2048; //in Megabytes final long bw = 10000; //in Megabits/s final long storage = 1000000; //in Megabytes - final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); + final var host = HostSimple.of(ram, bw, storage, HOST_CAPACITY); host .setRamAllocator(new ResourceAllocatorSimple()) .setBwAllocator(new ResourceAllocatorSimple()) @@ -185,7 +185,7 @@ private void createVms() { } private Vm createVm(final int pes) { - return new VmSimple(new CoreCapacity(pes, 1000)) + return VmSimple.of(new CoreCapacity(pes, 1000)) .setRam(1000).setBw(1000).setSize(10000) .setCloudletScheduler(new CloudletSchedulerTimeShared()); } @@ -199,7 +199,7 @@ private void createCloudlets() { private Cloudlet createCloudlet() { final var um = new UtilizationModelDynamic(0.2); - return new CloudletSimple(CLOUDLET_LENGTH, CLOUDLET_CORES) + return CloudletSimple.of(CLOUDLET_LENGTH, CLOUDLET_CORES) .setFileSize(1024) .setOutputSize(1024) .setUtilizationModelCpu(new UtilizationModelFull()) diff --git a/src/main/java/org/cloudsimplus/examples/dynamic/RandomCloudletsArrivalExample.java b/src/main/java/org/cloudsimplus/examples/dynamic/RandomCloudletsArrivalExample.java index 93e6ee7..0025fca 100755 --- a/src/main/java/org/cloudsimplus/examples/dynamic/RandomCloudletsArrivalExample.java +++ b/src/main/java/org/cloudsimplus/examples/dynamic/RandomCloudletsArrivalExample.java @@ -156,7 +156,7 @@ private Datacenter createDatacenter() { hostList.add(host); } - final var dc = new DatacenterSimple(simulation, hostList); + final var dc = DatacenterSimple.of(simulation, hostList); dc.setSchedulingInterval(SCHEDULING_INTERVAL); return dc; } @@ -165,7 +165,7 @@ private Host createHost() { final long ram = 2048; //in Megabytes final long bw = 10000; //in Megabits/s final long storage = 1000000; //in Megabytes - final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); + final var host = HostSimple.of(ram, bw, storage, HOST_CAPACITY); host.setVmScheduler(new VmSchedulerTimeShared()); return host; } @@ -180,7 +180,7 @@ private List createVms() { } private Vm createVm(final int pes) { - return new VmSimple(new CoreCapacity(pes, 1000)) + return VmSimple.of(new CoreCapacity(pes, 1000)) .setRam(1000).setBw(1000).setSize(10000) .setCloudletScheduler(new CloudletSchedulerTimeShared()); } @@ -198,7 +198,7 @@ private List createCloudlets(final int count) { private Cloudlet createCloudlet() { final var um = new UtilizationModelDynamic(0.2); - return new CloudletSimple(CLOUDLET_LENGTH, CLOUDLET_CORES) + return CloudletSimple.of(CLOUDLET_LENGTH, CLOUDLET_CORES) .setFileSize(1024) .setOutputSize(1024) .setUtilizationModelCpu(new UtilizationModelFull()) diff --git a/src/main/java/org/cloudsimplus/examples/listeners/CloudletListenersExample1.java b/src/main/java/org/cloudsimplus/examples/listeners/CloudletListenersExample1.java index a043dbb..8784837 100755 --- a/src/main/java/org/cloudsimplus/examples/listeners/CloudletListenersExample1.java +++ b/src/main/java/org/cloudsimplus/examples/listeners/CloudletListenersExample1.java @@ -165,7 +165,7 @@ private Vm createVm(int id) { final int ram = 512; // vm memory (Megabyte) final long bw = 1000; - final var vm = new VmSimple(id, new CoreCapacity(VM_PES_NUMBER, mips)) + final var vm = VmSimple.of(id, new CoreCapacity(VM_PES_NUMBER, mips)) .setRam(ram).setBw(bw).setSize(size) .setCloudletScheduler(new CloudletSchedulerSpaceShared()); @@ -184,7 +184,7 @@ private Cloudlet createCloudlet(long id, Vm vm, long length) { final int pesNumber = 1; final var utilizationModel = new UtilizationModelDynamic(0.2); final var cloudlet - = new CloudletSimple(id, length, pesNumber) + = CloudletSimple.of(id, length, pesNumber) .setFileSize(fileSize) .setOutputSize(outputSize) .setUtilizationModelCpu(new UtilizationModelFull()) @@ -202,7 +202,7 @@ private Cloudlet createCloudlet(long id, Vm vm, long length) { private Datacenter createDatacenter() { final var host = createHost(0); hostList.add(host); - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } /// Creates a host with pre-defined configuration. @@ -217,6 +217,6 @@ private Host createHost(int id) { final long storage = 1000000; // host storage (Megabyte) final long bw = 10000; //Megabits/s - return new HostSimple(ram, bw, storage, cpuCapacity).setVmScheduler(new VmSchedulerTimeShared()); + return HostSimple.of(ram, bw, storage, cpuCapacity).setVmScheduler(new VmSchedulerTimeShared()); } } diff --git a/src/main/java/org/cloudsimplus/examples/listeners/CloudletListenersExample2_ResourceUsageAlongTime.java b/src/main/java/org/cloudsimplus/examples/listeners/CloudletListenersExample2_ResourceUsageAlongTime.java index 1276622..925eb80 100755 --- a/src/main/java/org/cloudsimplus/examples/listeners/CloudletListenersExample2_ResourceUsageAlongTime.java +++ b/src/main/java/org/cloudsimplus/examples/listeners/CloudletListenersExample2_ResourceUsageAlongTime.java @@ -167,7 +167,7 @@ private Vm createVm(int id) { final int ram = 512; // vm memory (Megabyte) final long bw = 1000; - final var vm = new VmSimple(id, new CoreCapacity(VM_PES_NUMBER, mips)) + final var vm = VmSimple.of(id, new CoreCapacity(VM_PES_NUMBER, mips)) .setRam(ram).setBw(bw).setSize(size) .setCloudletScheduler(new CloudletSchedulerSpaceShared()); return vm; @@ -190,7 +190,7 @@ private Cloudlet createCloudlet(long id, Vm vm, long length) { final var bwUtilizationModel = new UtilizationModelStochastic(); final var cloudlet = - new CloudletSimple(id, length, pesNumber) + CloudletSimple.of(id, length, pesNumber) .setFileSize(fileSize) .setOutputSize(outputSize) .setUtilizationModelCpu(cpuUtilizationModel) @@ -209,7 +209,7 @@ private Datacenter createDatacenter() { final var host = createHost(0); hostList.add(host); - return new DatacenterSimple(simulation, hostList) + return DatacenterSimple.of(simulation, hostList) .setSchedulingInterval(DATACENTER_SCHEDULING_INTERVAL); } @@ -225,6 +225,6 @@ private Host createHost(int id) { final long storage = 1000000; // host storage (Megabyte) final long bw = 10000; //Megabits/s - return new HostSimple(ram, bw, storage, cpuCapacity).setVmScheduler(new VmSchedulerTimeShared()); + return HostSimple.of(ram, bw, storage, cpuCapacity).setVmScheduler(new VmSchedulerTimeShared()); } } diff --git a/src/main/java/org/cloudsimplus/examples/listeners/VmListenersExample1.java b/src/main/java/org/cloudsimplus/examples/listeners/VmListenersExample1.java index 1ae977b..1a4cbd7 100755 --- a/src/main/java/org/cloudsimplus/examples/listeners/VmListenersExample1.java +++ b/src/main/java/org/cloudsimplus/examples/listeners/VmListenersExample1.java @@ -163,7 +163,7 @@ private Vm createVm(int id) { final int ram = 512; // vm memory (Megabyte) final long bw = 1000; - return new VmSimple(id, new CoreCapacity(VM_PES_NUMBER, mips)) + return VmSimple.of(id, new CoreCapacity(VM_PES_NUMBER, mips)) .setRam(ram).setBw(bw).setSize(size) .setCloudletScheduler(new CloudletSchedulerTimeShared()); } @@ -178,7 +178,7 @@ private Cloudlet createCloudlet(int id, Vm vm) { final long fileSize = 300; final long outputSize = 300; final var utilizationModel = new UtilizationModelFull(); - return new CloudletSimple(id, length, VM_PES_NUMBER) + return CloudletSimple.of(id, length, VM_PES_NUMBER) .setFileSize(fileSize) .setOutputSize(outputSize) .setUtilizationModel(utilizationModel) @@ -192,7 +192,7 @@ private Datacenter createDatacenter() { final var host = createHost(0); hostList.add(host); - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } /// Creates a host with pre-defined configuration. @@ -207,6 +207,6 @@ private Host createHost(int id) { final long storage = 1000000; // host storage (Megabyte) final long bw = 10000; //Megabits/s - return new HostSimple(ram, bw, storage, cpuCapacity).setVmScheduler(new VmSchedulerTimeShared()); + return HostSimple.of(ram, bw, storage, cpuCapacity).setVmScheduler(new VmSchedulerTimeShared()); } } diff --git a/src/main/java/org/cloudsimplus/examples/listeners/VmListenersExample2.java b/src/main/java/org/cloudsimplus/examples/listeners/VmListenersExample2.java index 0c9bb54..d86b02f 100755 --- a/src/main/java/org/cloudsimplus/examples/listeners/VmListenersExample2.java +++ b/src/main/java/org/cloudsimplus/examples/listeners/VmListenersExample2.java @@ -164,7 +164,7 @@ private Vm createVm(int id) { final int ram = 512; // vm memory (Megabyte) final long bw = 1000; - final var vm = new VmSimple(id, new CoreCapacity(VM_PES_NUMBER, mips)) + final var vm = VmSimple.of(id, new CoreCapacity(VM_PES_NUMBER, mips)) .setRam(ram).setBw(bw).setSize(size) .setCloudletScheduler(new CloudletSchedulerTimeShared()); @@ -187,7 +187,7 @@ private Cloudlet createCloudlet(int id, Vm vm) { final long fileSize = 300; final long outputSize = 300; final var utilizationModel = new UtilizationModelFull(); - return new CloudletSimple(id, length, VM_PES_NUMBER) + return CloudletSimple.of(id, length, VM_PES_NUMBER) .setFileSize(fileSize) .setOutputSize(outputSize) .setUtilizationModel(utilizationModel) @@ -201,7 +201,7 @@ private Datacenter createDatacenter() { final var host = createHost(0); hostList.add(host); - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } /// Creates a host with pre-defined configuration. @@ -216,7 +216,7 @@ private Host createHost(int id) { final long storage = 1000000; // host storage (Megabyte) final long bw = 10000; //Megabits/s - return new HostSimple(ram, bw, storage, cpuCapacity).setVmScheduler(new VmSchedulerTimeShared()); + return HostSimple.of(ram, bw, storage, cpuCapacity).setVmScheduler(new VmSchedulerTimeShared()); } private void runSimulationAndPrintResults() { diff --git a/src/main/java/org/cloudsimplus/examples/listeners/VmListenersExample3_DynamicVmCreation.java b/src/main/java/org/cloudsimplus/examples/listeners/VmListenersExample3_DynamicVmCreation.java index 31871b5..5375c54 100755 --- a/src/main/java/org/cloudsimplus/examples/listeners/VmListenersExample3_DynamicVmCreation.java +++ b/src/main/java/org/cloudsimplus/examples/listeners/VmListenersExample3_DynamicVmCreation.java @@ -208,7 +208,7 @@ private Vm createVm(int id, DatacenterBroker broker) { final int ram = 512; // vm memory (Megabyte) final long bw = 1000; - return new VmSimple(id, new CoreCapacity(VM_PES_NUMBER, mips)) + return VmSimple.of(id, new CoreCapacity(VM_PES_NUMBER, mips)) .setRam(ram).setBw(bw).setSize(size) .setCloudletScheduler(new CloudletSchedulerSpaceShared()) .addOnHostRemovalListener(this::onHostRemovalListener); @@ -226,7 +226,7 @@ private Cloudlet createCloudlet(int id, Vm vm, DatacenterBroker broker) { final long length = 10000; //in number of Million Instructions (MI) final int pesNumber = 1; - return new CloudletSimple(id, length, pesNumber) + return CloudletSimple.of(id, length, pesNumber) .setFileSize(fileSize) .setOutputSize(outputSize) .setUtilizationModelCpu(new UtilizationModelFull()) @@ -240,7 +240,7 @@ private Cloudlet createCloudlet(int id, Vm vm, DatacenterBroker broker) { private Datacenter createDatacenter() { final var host = createHost(0); hostList.add(host); - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } /// Creates a host with pre-defined configuration. @@ -255,6 +255,6 @@ private Host createHost(int id) { final long storage = 1000000; // host storage (Megabyte) final long bw = 10000; //Megabits/s - return new HostSimple(ram, bw, storage, cpuCapacity).setVmScheduler(new VmSchedulerSpaceShared()); + return HostSimple.of(ram, bw, storage, cpuCapacity).setVmScheduler(new VmSchedulerSpaceShared()); } } diff --git a/src/main/java/org/cloudsimplus/examples/migration/InterDatacenterMigration1.java b/src/main/java/org/cloudsimplus/examples/migration/InterDatacenterMigration1.java index a832052..4582746 100755 --- a/src/main/java/org/cloudsimplus/examples/migration/InterDatacenterMigration1.java +++ b/src/main/java/org/cloudsimplus/examples/migration/InterDatacenterMigration1.java @@ -339,7 +339,7 @@ public void createAndSubmitCloudlets(final DatacenterBroker broker) { public Cloudlet createCloudlet(final Vm vm, final UtilizationModel cpuUtilizationModel) { final var broker = vm.getBroker(); final var cloudlet = - new CloudletSimple(createdCloudlets++, CLOUDLET_LENGTH, vm.getProcessor().getCores()) + CloudletSimple.of(createdCloudlets++, CLOUDLET_LENGTH, vm.getProcessor().getCores()) .setFileSize(CLOUDLET_FILESIZE) .setOutputSize(CLOUDLET_OUTPUT_SIZE) .setUtilizationModelRam(new UtilizationModelDynamic(0.4)) @@ -365,7 +365,7 @@ private void startMigration(final VmHostEventInfo info) { } public Vm createVm(final int pes) { - return new VmSimple(createdVms++, new CoreCapacity(pes, VM_MIPS)) + return VmSimple.of(createdVms++, new CoreCapacity(pes, VM_MIPS)) .setRam(VM_RAM) .setBw(VM_BW) .setSize(VM_SIZE); @@ -423,7 +423,7 @@ private Datacenter createDatacenter(final int index) { final var distribution = index % 2 == 0 ? Distribution.PRIVATE : Distribution.PUBLIC; final var hostList = createHosts(DC_HOST_PES[index]); final var allocationPolicy = createVmPlacementPolicy(); - final var dc = new DatacenterSimple(simulation, hostList, allocationPolicy); + final var dc = DatacenterSimple.of(simulation, hostList, allocationPolicy); dc.setSchedulingInterval(SCHEDULING_INTERVAL) .setHostSearchRetryDelay(HOST_SEARCH_RETRY_DELAY) .getCharacteristics() @@ -449,7 +449,7 @@ private List createHosts(final int[] pesNumberArray) { public Host createHost(final int pesNumber, final long ram) { final var cpuCapacity = new CoreCapacity(pesNumber, HOST_MIPS); - final var host = new HostSimple(ram, HOST_BW, HOST_STORAGE, cpuCapacity); + final var host = HostSimple.of(ram, HOST_BW, HOST_STORAGE, cpuCapacity); host.setId(createdHosts++) .setVmScheduler(new VmSchedulerTimeShared()) .setStateHistoryEnabled(true); diff --git a/src/main/java/org/cloudsimplus/examples/migration/ManualMigrationExample1.java b/src/main/java/org/cloudsimplus/examples/migration/ManualMigrationExample1.java index 306a57e..63577e0 100755 --- a/src/main/java/org/cloudsimplus/examples/migration/ManualMigrationExample1.java +++ b/src/main/java/org/cloudsimplus/examples/migration/ManualMigrationExample1.java @@ -211,7 +211,7 @@ public void createAndSubmitCloudlets(DatacenterBroker broker) { /// @return the created Cloudlets public Cloudlet createCloudlet(Vm vm, DatacenterBroker broker) { final var cloudlet = - new CloudletSimple(CLOUDLET_LENGHT, (int)vm.getProcessor().getCores()) + CloudletSimple.of(CLOUDLET_LENGHT, (int)vm.getProcessor().getCores()) .setFileSize(CLOUDLET_FILESIZE) .setOutputSize(CLOUDLET_OUTPUTSIZE) .setUtilizationModel(new UtilizationModelFull()); @@ -248,7 +248,7 @@ private void startMigration(final VmHostEventInfo info) { } public Vm createVm(int pes) { - final Vm vm = new VmSimple(new CoreCapacity(pes, VM_MIPS)); + final Vm vm = VmSimple.of(new CoreCapacity(pes, VM_MIPS)); vm .setRam(VM_RAM).setBw((long)VM_BW).setSize(VM_SIZE) .setCloudletScheduler(new CloudletSchedulerTimeShared()); @@ -266,14 +266,14 @@ private Datacenter createDatacenter() { } System.out.println(); - final var dc = new DatacenterSimple(simulation, hostList, new VmPlacementPolicyFirstFit()); + final var dc = DatacenterSimple.of(simulation, hostList, new VmPlacementPolicyFirstFit()); dc.setSchedulingInterval(SCHEDULING_INTERVAL); return dc; } public Host createHost(int pesNumber, long mipsByPe) { final var cpuCapacity = new CoreCapacity(pesNumber, mipsByPe); - final var host = new HostSimple(HOST_RAM, HOST_BW, HOST_STORAGE, cpuCapacity); + final var host = HostSimple.of(HOST_RAM, HOST_BW, HOST_STORAGE, cpuCapacity); host.setVmScheduler(new VmSchedulerTimeShared()) .setStateHistoryEnabled(true); return host; diff --git a/src/main/java/org/cloudsimplus/examples/migration/MigrationExample1.java b/src/main/java/org/cloudsimplus/examples/migration/MigrationExample1.java index aac999f..bcd40ff 100755 --- a/src/main/java/org/cloudsimplus/examples/migration/MigrationExample1.java +++ b/src/main/java/org/cloudsimplus/examples/migration/MigrationExample1.java @@ -311,7 +311,7 @@ public Cloudlet createCloudlet(Vm vm, DatacenterBroker broker, UtilizationModel final var utilizationModelFull = new UtilizationModelFull(); final var cloudlet = - new CloudletSimple(CLOUDLET_LENGTH, (int)vm.getProcessor().getCores()) + CloudletSimple.of(CLOUDLET_LENGTH, (int)vm.getProcessor().getCores()) .setFileSize(CLOUDLET_FILESIZE) .setOutputSize(CLOUDLET_OUTPUTSIZE) .setUtilizationModelRam(utilizationModelFull) @@ -336,7 +336,7 @@ public void createAndSubmitVms(DatacenterBroker broker) { } public Vm createVm(final int pes) { - final var vm = new VmSimple(new CoreCapacity(pes, VM_MIPS)); + final var vm = VmSimple.of(new CoreCapacity(pes, VM_MIPS)); vm .setRam(VM_RAM).setBw((long)VM_BW).setSize(VM_SIZE) .setCloudletScheduler(new CloudletSchedulerTimeShared()); @@ -388,7 +388,7 @@ private double getCpuUsageIncrement(final UtilizationModelDynamic um){ /// @return private Datacenter createDatacenter() { System.out.println(); - final var dc = new DatacenterSimple(simulation, hostList, allocationPolicy); + final var dc = DatacenterSimple.of(simulation, hostList, allocationPolicy); for (Host host : hostList) { System.out.printf( "# Created %s with %.0f MIPS x %d PEs (%.0f total MIPS)%n", @@ -430,7 +430,7 @@ private List createHosts() { public Host createHost(final int pesNumber, final long ram) { final var cpuCapacity = new CoreCapacity(pesNumber, HOST_MIPS); - final var host = new HostSimple(ram, HOST_BW, HOST_STORAGE, cpuCapacity); + final var host = HostSimple.of(ram, HOST_BW, HOST_STORAGE, cpuCapacity); host.setVmScheduler(new VmSchedulerTimeShared()) .setStateHistoryEnabled(true); return host; diff --git a/src/main/java/org/cloudsimplus/examples/performance/PerformanceExample1.java b/src/main/java/org/cloudsimplus/examples/performance/PerformanceExample1.java index 25604e8..6e8daed 100755 --- a/src/main/java/org/cloudsimplus/examples/performance/PerformanceExample1.java +++ b/src/main/java/org/cloudsimplus/examples/performance/PerformanceExample1.java @@ -145,7 +145,7 @@ private Datacenter createDatacenter() { .mapToObj(i -> createHost()) .collect(toCollection(() -> new ArrayList<>(HOSTS))); - return new DatacenterSimple(simulation, hostList) + return DatacenterSimple.of(simulation, hostList) .setVmPlacementPolicy(vmPlacementPolicy) .setSchedulingInterval(SCHEDULING_INTERVAL); } @@ -154,7 +154,7 @@ private Host createHost() { final long ram = 2048; //in Megabytes final long bw = 10000; //in Megabits/s final long storage = 1000000; //in Megabytes - final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); + final var host = HostSimple.of(ram, bw, storage, HOST_CAPACITY); host.setVmScheduler(new VmSchedulerTimeShared()); return host; } @@ -163,7 +163,7 @@ private List createVms() { final var newVmList = new ArrayList(VMS); for (int i = 0; i < VMS; i++) { final var vm = - new VmSimple(i, VM_CAPACITY) + VmSimple.of(i, VM_CAPACITY) .setCloudletScheduler(cloudletSchedulerSupplier.get()) .setRam(512).setBw(1000).setSize(10000); @@ -177,7 +177,7 @@ private List createVms() { private Cloudlet createCloudlet(final Vm vm) { final var ramBwModel = new UtilizationModelDynamic(RAM_BW_RESOURCE_UTILIZATION_PERCENT); final var cloudlet = - new CloudletSimple(CLOUDLET_LENGTH, CLOUDLET_CORES) + CloudletSimple.of(CLOUDLET_LENGTH, CLOUDLET_CORES) .setFileSize(1024) .setOutputSize(1024) .setUtilizationModelBw(ramBwModel) diff --git a/src/main/java/org/cloudsimplus/examples/performance/UtilizationModelFullPerformance.java b/src/main/java/org/cloudsimplus/examples/performance/UtilizationModelFullPerformance.java index 69a529d..4d319f0 100755 --- a/src/main/java/org/cloudsimplus/examples/performance/UtilizationModelFullPerformance.java +++ b/src/main/java/org/cloudsimplus/examples/performance/UtilizationModelFullPerformance.java @@ -155,20 +155,20 @@ private Datacenter createDatacenter() { .mapToObj(i -> createHost()) .collect(toCollection(() -> new ArrayList<>(HOSTS))); - return new DatacenterSimple(simulation, hostList, VM_ALLOCATION_POLICY).setSchedulingInterval(SCHEDULING_INTERVAL); + return DatacenterSimple.of(simulation, hostList, VM_ALLOCATION_POLICY).setSchedulingInterval(SCHEDULING_INTERVAL); } private Host createHost() { final long ramMB = 20480; final long bwMbps = 10000; final long storageMB = 1000000; - return new HostSimple(ramMB, bwMbps, storageMB, HOST_CAPACITY); + return HostSimple.of(ramMB, bwMbps, storageMB, HOST_CAPACITY); } private List createVms() { final var newVmList = new ArrayList(VMS); for (int i = 0; i < VMS; i++) { - final Vm vm = new VmSimple(VM_CAPACITY); + final Vm vm = VmSimple.of(VM_CAPACITY); newVmList.add(vm); } @@ -178,7 +178,7 @@ private List createVms() { private List createCloudlets() { final var newCloudletList = new ArrayList(CLOUDLETS); for (int i = 0; i < CLOUDLETS; i++) { - final var cloudlet = new CloudletSimple(CLOUDLET_LENGTH, CLOUDLET_CORES); + final var cloudlet = CloudletSimple.of(CLOUDLET_LENGTH, CLOUDLET_CORES); cloudlet.setUtilizationModelCpu(um).setSizes(1024); newCloudletList.add(cloudlet); } diff --git a/src/main/java/org/cloudsimplus/examples/performance/UtilizationModelStochasticPerformance.java b/src/main/java/org/cloudsimplus/examples/performance/UtilizationModelStochasticPerformance.java index c967eaa..2a452ab 100755 --- a/src/main/java/org/cloudsimplus/examples/performance/UtilizationModelStochasticPerformance.java +++ b/src/main/java/org/cloudsimplus/examples/performance/UtilizationModelStochasticPerformance.java @@ -195,20 +195,20 @@ private Datacenter createDatacenter() { .mapToObj(i -> createHost()) .collect(toCollection(() -> new ArrayList<>(HOSTS))); - return new DatacenterSimple(simulation, hostList, VM_ALLOCATION_POLICY).setSchedulingInterval(SCHEDULING_INTERVAL); + return DatacenterSimple.of(simulation, hostList, VM_ALLOCATION_POLICY).setSchedulingInterval(SCHEDULING_INTERVAL); } private Host createHost() { final long ramMB = 20480; final long bwMbps = 10000; final long storageMB = 1000000; - return new HostSimple(ramMB, bwMbps, storageMB, HOST_CAPACITY); + return HostSimple.of(ramMB, bwMbps, storageMB, HOST_CAPACITY); } private List createVms() { final var newVmList = new ArrayList(VMS); for (int i = 0; i < VMS; i++) { - final Vm vm = new VmSimple(VM_CAPACITY); + final Vm vm = VmSimple.of(VM_CAPACITY); newVmList.add(vm); } @@ -218,7 +218,7 @@ private List createVms() { private List createCloudlets() { final var newCloudletList = new ArrayList(CLOUDLETS); for (int i = 0; i < CLOUDLETS; i++) { - final var cloudlet = new CloudletSimple(CLOUDLET_LENGTH, CLOUDLET_CORES); + final var cloudlet = CloudletSimple.of(CLOUDLET_LENGTH, CLOUDLET_CORES); this.um = MULTIPLE_UTILIZATION_MODELS || this.um == null ? new UtilizationModelStochastic(SEED) : this.um; this.um .setHistoryEnabled(STORE_CLOUDLETS_CPU_UTILIZATION_HISTORY) diff --git a/src/main/java/org/cloudsimplus/examples/power/HostActivationExample.java b/src/main/java/org/cloudsimplus/examples/power/HostActivationExample.java index 6b36988..4dedd52 100755 --- a/src/main/java/org/cloudsimplus/examples/power/HostActivationExample.java +++ b/src/main/java/org/cloudsimplus/examples/power/HostActivationExample.java @@ -237,7 +237,7 @@ private List createAndSubmitVmsAndCloudlets(final int vmsToCreate) { final var newCloudletList = new ArrayList(vmsToCreate); for (int i = 0; i < vmsToCreate; i++) { - final var vm = new VmSimple(VM_CAPACITY); + final var vm = VmSimple.of(VM_CAPACITY); //vm.setSubmissionDelay(2.0); final var cloudlet = createCloudlet(vm); vmList.add(vm); @@ -259,7 +259,7 @@ private Datacenter createDatacenter() { hostList.add(host); } - final var dc = new DatacenterSimple(simulation, hostList, new VmPlacementPolicyBestFit()); + final var dc = DatacenterSimple.of(simulation, hostList, new VmPlacementPolicyBestFit()); dc.setSchedulingInterval(SCHEDULING_INTERVAL); return dc; } @@ -270,7 +270,7 @@ private Datacenter createDatacenter() { private Host createHost(final long id) { //Indicates if the Host will be powered on or not after creation final boolean activate = false; - final var host = new HostSimple(HOST_CAPACITY, activate); + final var host = HostSimple.of(HOST_CAPACITY, activate); host.setId(id) .setStartupDelay(HOST_START_UP_DELAY) .setShutDownDelay(HOST_SHUT_DOWN_DELAY); @@ -294,7 +294,7 @@ private Cloudlet createCloudlet(Vm vm) { * ensuring that a positive length is generated (Cloudlets * with negative length run indefinitely until being explicitly stopped. */ final long len = Math.abs(CLOUDLET_LENGTH - cloudletList.size()*3000); - return new CloudletSimple(len, VM_CORES) + return CloudletSimple.of(len, VM_CORES) .setUtilizationModelCpu(new UtilizationModelFull()) .setUtilizationModelRam(utilizationModel) .setVm(vm); diff --git a/src/main/java/org/cloudsimplus/examples/power/PowerExample.java b/src/main/java/org/cloudsimplus/examples/power/PowerExample.java index 255e2b9..75bc7e1 100755 --- a/src/main/java/org/cloudsimplus/examples/power/PowerExample.java +++ b/src/main/java/org/cloudsimplus/examples/power/PowerExample.java @@ -243,7 +243,7 @@ private Datacenter createDatacenter() { hostList.add(host); } - final var dc = new DatacenterSimple(simulation, hostList); + final var dc = DatacenterSimple.of(simulation, hostList); dc.setSchedulingInterval(SCHEDULING_INTERVAL); return dc; } @@ -254,7 +254,7 @@ private Host createPowerHost(final int id) { final long storage = 1000000; //in Megabytes final var vmScheduler = new VmSchedulerTimeShared(); - final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); + final var host = HostSimple.of(ram, bw, storage, HOST_CAPACITY); host.setStartupDelay(HOST_START_UP_DELAY) .setShutDownDelay(HOST_SHUT_DOWN_DELAY); @@ -275,7 +275,7 @@ private Host createPowerHost(final int id) { private List createVms() { final var list = new ArrayList(VMS); for (int i = 0; i < VMS; i++) { - final var vm = new VmSimple(i, VM_CAPACITY); + final var vm = VmSimple.of(i, VM_CAPACITY); vm.setRam(512).setBw(1000).setSize(10000).enableUtilizationStats(); list.add(vm); } @@ -291,7 +291,7 @@ private List createCloudlets() { //Sets half of the cloudlets with the defined length and the other half with the double of it final long length = i < CLOUDLETS / 2 ? CLOUDLET_LENGTH : CLOUDLET_LENGTH * 2; final var cloudlet = - new CloudletSimple(i, length, CLOUDLET_CORES) + CloudletSimple.of(i, length, CLOUDLET_CORES) .setFileSize(1024) .setOutputSize(1024) .setUtilizationModelCpu(new UtilizationModelFull()) diff --git a/src/main/java/org/cloudsimplus/examples/power/PowerExampleSchedulingInterval.java b/src/main/java/org/cloudsimplus/examples/power/PowerExampleSchedulingInterval.java index a22097b..591bf42 100755 --- a/src/main/java/org/cloudsimplus/examples/power/PowerExampleSchedulingInterval.java +++ b/src/main/java/org/cloudsimplus/examples/power/PowerExampleSchedulingInterval.java @@ -156,7 +156,7 @@ private Datacenter createDatacenterSimple() { hostList.add(host); } - final var dc = new DatacenterSimple(simulation, hostList); + final var dc = DatacenterSimple.of(simulation, hostList); dc.setSchedulingInterval(schedulingInterval); return dc; } @@ -166,7 +166,7 @@ private Host createPowerHost(final int id) { final long bw = 10000; //in Megabits/s final long storage = 1000000; //in Megabytes - final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); + final var host = HostSimple.of(ram, bw, storage, HOST_CAPACITY); host .setId(id) .setVmScheduler(new VmSchedulerTimeShared()) @@ -178,7 +178,7 @@ private Host createPowerHost(final int id) { private List createVms() { final var newVmList = new ArrayList(VMS); for (int i = 0; i < VMS; i++) { - final var vm = new VmSimple(i, VM_CAPACITY); + final var vm = VmSimple.of(i, VM_CAPACITY); vm.setRam(512).setBw(1000).setSize(10000) .setCloudletScheduler(new CloudletSchedulerTimeShared()) .enableUtilizationStats(); @@ -195,7 +195,7 @@ private List createCloudlets() { //Sets half of the cloudlets with the defined length and the other half with the double of it final long length = i < CLOUDLETS/2 ? CLOUDLET_LENGTH : CLOUDLET_LENGTH*2; final var cloudlet = - new CloudletSimple(i, length, CLOUDLET_CORES) + CloudletSimple.of(i, length, CLOUDLET_CORES) .setFileSize(1024) .setOutputSize(1024) .setUtilizationModelCpu(new UtilizationModelFull()) diff --git a/src/main/java/org/cloudsimplus/examples/power/PowerSpecFileExample.java b/src/main/java/org/cloudsimplus/examples/power/PowerSpecFileExample.java index 37f124d..c429a80 100755 --- a/src/main/java/org/cloudsimplus/examples/power/PowerSpecFileExample.java +++ b/src/main/java/org/cloudsimplus/examples/power/PowerSpecFileExample.java @@ -177,7 +177,7 @@ private Datacenter createDatacenter() { hostList.add(host); } - final var dc = new DatacenterSimple(simulation, hostList); + final var dc = DatacenterSimple.of(simulation, hostList); dc.setSchedulingInterval(SCHEDULING_INTERVAL); return dc; } @@ -188,7 +188,7 @@ private Host createPowerHost(final int id) { final long storage = 1000000; //in Megabytes final var vmScheduler = new VmSchedulerTimeShared(); - final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); + final var host = HostSimple.of(ram, bw, storage, HOST_CAPACITY); host.setStartupDelay(HOST_START_UP_DELAY) .setShutDownDelay(HOST_SHUT_DOWN_DELAY); @@ -210,7 +210,7 @@ private Host createPowerHost(final int id) { private List createVms() { final var list = new ArrayList(VMS); for (int i = 0; i < VMS; i++) { - final var vm = new VmSimple(i, VM_CAPACITY); + final var vm = VmSimple.of(i, VM_CAPACITY); vm.setRam(512).setBw(1000).setSize(10000); list.add(vm); } @@ -226,7 +226,7 @@ private List createCloudlets() { //Sets half of the cloudlets with the defined length and the other half with the double of it final long length = i < CLOUDLETS / 2 ? CLOUDLET_LENGTH : CLOUDLET_LENGTH * 2; final var cloudlet = - new CloudletSimple(i, length, CLOUDLET_CORES) + CloudletSimple.of(i, length, CLOUDLET_CORES) .setFileSize(1024) .setOutputSize(1024) .setUtilizationModelCpu(new UtilizationModelFull()) diff --git a/src/main/java/org/cloudsimplus/examples/resourceusage/HostsCpuUsageExample.java b/src/main/java/org/cloudsimplus/examples/resourceusage/HostsCpuUsageExample.java index 9640d70..b57c39b 100755 --- a/src/main/java/org/cloudsimplus/examples/resourceusage/HostsCpuUsageExample.java +++ b/src/main/java/org/cloudsimplus/examples/resourceusage/HostsCpuUsageExample.java @@ -125,7 +125,7 @@ private Cloudlet createCloudlet(final int pesNumber) { final long outputSize = 300; final var utilizationModel = new UtilizationModelFull(); - return new CloudletSimple(length, pesNumber) + return CloudletSimple.of(length, pesNumber) .setFileSize(fileSize) .setOutputSize(outputSize) .setUtilizationModel(utilizationModel); @@ -140,7 +140,7 @@ private Vm createVm(final int pesNumber, final long mips) { final long size = 10000; //image size (Megabyte) final int ram = 2048; //vm memory (Megabyte) final long bw = 1000; - final var vm = new VmSimple(new CoreCapacity(pesNumber, mips)) + final var vm = VmSimple.of(new CoreCapacity(pesNumber, mips)) .setRam(ram).setBw(bw).setSize(size) .setCloudletScheduler(new CloudletSchedulerTimeShared()); vm.enableUtilizationStats(); @@ -180,7 +180,7 @@ private Datacenter createDatacenter() { hostList.add(host); } - final var dc = new DatacenterSimple(simulation, hostList); + final var dc = DatacenterSimple.of(simulation, hostList); dc.setSchedulingInterval(2); return dc; } @@ -192,7 +192,7 @@ private Host createHost(final int id, final int pesNumber, final long mips) { final long storage = 1000000; //host storage (Megabyte) final long bw = 10000; //Megabits/s - final var host = new HostSimple(ram, bw, storage, cpuCapacity); + final var host = HostSimple.of(ram, bw, storage, cpuCapacity); host.setId(id) .setVmScheduler(new VmSchedulerTimeShared()); host.enableUtilizationStats(); diff --git a/src/main/java/org/cloudsimplus/examples/resourceusage/UtilizationModelDynamicExample.java b/src/main/java/org/cloudsimplus/examples/resourceusage/UtilizationModelDynamicExample.java index 655642f..2e15c58 100755 --- a/src/main/java/org/cloudsimplus/examples/resourceusage/UtilizationModelDynamicExample.java +++ b/src/main/java/org/cloudsimplus/examples/resourceusage/UtilizationModelDynamicExample.java @@ -29,6 +29,7 @@ import org.cloudsimplus.cloudlets.Cloudlet; import org.cloudsimplus.cloudlets.CloudletSimple; import org.cloudsimplus.core.CloudSimPlus; +import org.cloudsimplus.datacenters.Datacenter; import org.cloudsimplus.datacenters.DatacenterSimple; import org.cloudsimplus.hosts.Host; import org.cloudsimplus.hosts.HostSimple; @@ -104,14 +105,14 @@ on behalf of a given cloud user (customer).*/ System.out.println(getClass().getSimpleName() + " finished!"); } - private DatacenterSimple createDatacenter() { + private Datacenter createDatacenter() { final var hostList = new ArrayList(HOSTS); for(int i = 0; i < HOSTS; i++) { final var host = createHost(); hostList.add(host); } - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } private Host createHost() { @@ -123,7 +124,7 @@ private Host createHost() { //Defines the number of Host CPU cores and the MIPS capacity of each core final var cpuCapacity = new CoreCapacity(2, mips); - return new HostSimple(ram, bw, storage, cpuCapacity).setVmScheduler(new VmSchedulerTimeShared()); + return HostSimple.of(ram, bw, storage, cpuCapacity).setVmScheduler(new VmSchedulerTimeShared()); } private Vm createVm(DatacenterBroker broker) { @@ -133,7 +134,7 @@ private Vm createVm(DatacenterBroker broker) { final long bw = 1000; // vm bandwidth (Megabits/s) final int pesNumber = 2; // number of CPU cores - return new VmSimple(vmList.size(), new CoreCapacity(pesNumber, mips)) + return VmSimple.of(vmList.size(), new CoreCapacity(pesNumber, mips)) .setRam(ram) .setBw(bw) .setSize(storage) @@ -153,7 +154,7 @@ private Cloudlet createCloudlet(DatacenterBroker broker, Vm vm) { * Virtual PEs or simply vPEs are the PEs allocated to a given VM, * which will be used to run Cloudlets.*/ final var utilizationHalfCapacity = new UtilizationModelDynamic(0.5); - return new CloudletSimple( + return CloudletSimple.of( cloudletList.size(), length, numberOfCpuCores) .setFileSize(fileSize) .setOutputSize(outputSize) diff --git a/src/main/java/org/cloudsimplus/examples/resourceusage/VirtualMemoryForRequestedRamHigherThanAvailableExample.java b/src/main/java/org/cloudsimplus/examples/resourceusage/VirtualMemoryForRequestedRamHigherThanAvailableExample.java index 0ef5f8a..7f3b14e 100755 --- a/src/main/java/org/cloudsimplus/examples/resourceusage/VirtualMemoryForRequestedRamHigherThanAvailableExample.java +++ b/src/main/java/org/cloudsimplus/examples/resourceusage/VirtualMemoryForRequestedRamHigherThanAvailableExample.java @@ -208,7 +208,7 @@ private Datacenter createDatacenter() { } //Uses a VmPlacementPolicySimple by default to place VMs - final var dc = new DatacenterSimple(simulation, hostList); + final var dc = DatacenterSimple.of(simulation, hostList); dc.setSchedulingInterval(SCHEDULING_INTERVAL); return dc; } @@ -227,7 +227,7 @@ private Host createHost() { Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ - return new HostSimple(HOST_RAM, bw, hardDrive, HOST_CAPACITY); + return HostSimple.of(HOST_RAM, bw, hardDrive, HOST_CAPACITY); } /// Creates a list of VMs. @@ -235,7 +235,7 @@ private List createVms() { final var newVmList = new ArrayList(VMS); for (int i = 0; i < VMS; i++) { //Uses a CloudletSchedulerTimeShared by default to schedule Cloudlets - final Vm vm = new VmSimple(VM_CAPACITY); + final Vm vm = VmSimple.of(VM_CAPACITY); vm.setRam(VM_RAM).setBw(1000).setSize(10000); newVmList.add(vm); } @@ -285,7 +285,7 @@ private Cloudlet createCloudlet( final Vm vm, final UtilizationModel utilizationModelRam, final UtilizationModel utilizationModelBw) { - final var cloudlet = new CloudletSimple(CLOUDLET_LENGTH, CLOUDLET_CORES); + final var cloudlet = CloudletSimple.of(CLOUDLET_LENGTH, CLOUDLET_CORES); cloudlet.setUtilizationModelCpu(new UtilizationModelFull()) .setUtilizationModelRam(utilizationModelRam) .setUtilizationModelBw(utilizationModelBw) diff --git a/src/main/java/org/cloudsimplus/examples/resourceusage/VmRelativeHostResourceUtilizationExample.java b/src/main/java/org/cloudsimplus/examples/resourceusage/VmRelativeHostResourceUtilizationExample.java index b3cef7e..be52f78 100755 --- a/src/main/java/org/cloudsimplus/examples/resourceusage/VmRelativeHostResourceUtilizationExample.java +++ b/src/main/java/org/cloudsimplus/examples/resourceusage/VmRelativeHostResourceUtilizationExample.java @@ -136,7 +136,7 @@ private Datacenter createDatacenter() { hostList.add(host); } - return new DatacenterSimple(simulation, hostList).setSchedulingInterval(SCHEDULING_INTERVAL); + return DatacenterSimple.of(simulation, hostList).setSchedulingInterval(SCHEDULING_INTERVAL); } private Host createHost() { @@ -146,13 +146,13 @@ private Host createHost() { Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ - return new HostSimple(HOST_RAM, HOST_BW, storage, HOST_CAPACITY); + return HostSimple.of(HOST_RAM, HOST_BW, storage, HOST_CAPACITY); } private List createVms() { final var newVmList = new ArrayList(VMS); for (int i = 0; i < VMS; i++) { - final var vm = new VmSimple(VM_CAPACITY); + final var vm = VmSimple.of(VM_CAPACITY); vm.setRam(VM_RAM).setBw(VM_BW).setSize(10000); newVmList.add(vm); } @@ -167,7 +167,7 @@ private List createCloudlets() { final var utilizationModelRamAndBw = new UtilizationModelDynamic(0.5); for (int i = 0; i < CLOUDLETS; i++) { - final var cloudlet = new CloudletSimple(CLOUDLET_LENGTH, CLOUDLET_CORES); + final var cloudlet = CloudletSimple.of(CLOUDLET_LENGTH, CLOUDLET_CORES); cloudlet.setUtilizationModelCpu(new UtilizationModelFull()) .setUtilizationModelBw(utilizationModelRamAndBw) .setUtilizationModelRam(utilizationModelRamAndBw) diff --git a/src/main/java/org/cloudsimplus/examples/resourceusage/VmsCpuUsageExample.java b/src/main/java/org/cloudsimplus/examples/resourceusage/VmsCpuUsageExample.java index 05a6bfe..2932fca 100755 --- a/src/main/java/org/cloudsimplus/examples/resourceusage/VmsCpuUsageExample.java +++ b/src/main/java/org/cloudsimplus/examples/resourceusage/VmsCpuUsageExample.java @@ -117,7 +117,7 @@ private Cloudlet createCloudlet(final int pesNumber) { final var utilizationModelDynamic = new UtilizationModelDynamic(0.25); final var utilizationModelCpu = new UtilizationModelDynamic(0.5); - final var cloudlet = new CloudletSimple(length, pesNumber); + final var cloudlet = CloudletSimple.of(length, pesNumber); cloudlet.setFileSize(fileSize) .setOutputSize(outputSize) .setUtilizationModelCpu(utilizationModelCpu) @@ -137,7 +137,7 @@ private Vm createVm(final int pesNumber, final int mips, final int id) { final long bw = 1000; //create two VMs - final var vm = new VmSimple(id, new CoreCapacity(pesNumber, mips)); + final var vm = VmSimple.of(id, new CoreCapacity(pesNumber, mips)); vm.setRam(ram).setBw(bw) .setSize(size) .setCloudletScheduler(new CloudletSchedulerTimeShared()); @@ -168,7 +168,7 @@ private static Datacenter createDatacenter(CloudSimPlus simulation) { hostList.add(host); } - final var dc = new DatacenterSimple(simulation, hostList); + final var dc = DatacenterSimple.of(simulation, hostList); dc.setSchedulingInterval(2); return dc; } @@ -180,7 +180,7 @@ private static Host createHost(final int id, final int pesNumber, final long mip final long storage = 1000000; //host storage final int bw = 10000; - final var host = new HostSimple(ram, bw, storage, cpuCapacity) + final var host = HostSimple.of(ram, bw, storage, cpuCapacity) .setId(id) .setStateHistoryEnabled(true) .setRamAllocator(new ResourceAllocatorSimple()) diff --git a/src/main/java/org/cloudsimplus/examples/resourceusage/VmsRamAndBwUsageExample.java b/src/main/java/org/cloudsimplus/examples/resourceusage/VmsRamAndBwUsageExample.java index d483db9..425a269 100755 --- a/src/main/java/org/cloudsimplus/examples/resourceusage/VmsRamAndBwUsageExample.java +++ b/src/main/java/org/cloudsimplus/examples/resourceusage/VmsRamAndBwUsageExample.java @@ -218,7 +218,7 @@ private Datacenter createDatacenter() { hostList.add(host); } - final var dc = new DatacenterSimple(simulation, hostList); + final var dc = DatacenterSimple.of(simulation, hostList); dc.setSchedulingInterval(SCHEDULING_INTERVAL); return dc; } @@ -227,7 +227,7 @@ private Host createHost() { final long ram = 2048; //in Megabytes final long bw = 10000; //in Megabits/s final long storage = 1000000; //in Megabytes - final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); + final var host = HostSimple.of(ram, bw, storage, HOST_CAPACITY); host.setVmScheduler(new VmSchedulerTimeShared()); return host; } @@ -242,7 +242,7 @@ private List createVms() { } private Vm createVm(final int pes) { - return new VmSimple(new CoreCapacity(pes, 1000)) + return VmSimple.of(new CoreCapacity(pes, 1000)) .setRam(1000).setBw(1000).setSize(10000) .setCloudletScheduler(new CloudletSchedulerTimeShared()); } @@ -267,7 +267,7 @@ private Cloudlet createCloudlet() { ramUtilizationModel.setUtilizationUpdateFunction(this::utilizationUpdate); bwUtilizationModel.setUtilizationUpdateFunction(this::utilizationUpdate); - return new CloudletSimple(CLOUDLET_LENGTH, CLOUDLET_CORES) + return CloudletSimple.of(CLOUDLET_LENGTH, CLOUDLET_CORES) .setFileSize(1024) .setOutputSize(1024) .setUtilizationModelCpu(new UtilizationModelFull()) diff --git a/src/main/java/org/cloudsimplus/examples/schedulers/CloudletSchedulerSpaceSharedExample1.java b/src/main/java/org/cloudsimplus/examples/schedulers/CloudletSchedulerSpaceSharedExample1.java index 03e91f1..f64dcf0 100755 --- a/src/main/java/org/cloudsimplus/examples/schedulers/CloudletSchedulerSpaceSharedExample1.java +++ b/src/main/java/org/cloudsimplus/examples/schedulers/CloudletSchedulerSpaceSharedExample1.java @@ -115,7 +115,7 @@ private Datacenter createDatacenter() { hostList.add(host); } - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } /// Creates a Host that uses a [ResourceAllocatorSimple] by default @@ -124,7 +124,7 @@ private Host createHost() { final long ram = 2048; //in Megabytes final long bw = 10000; //in Megabits/s final long storage = 1000000; //in Megabytes - final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); + final var host = HostSimple.of(ram, bw, storage, HOST_CAPACITY); host.setVmScheduler(new VmSchedulerTimeShared()); return host; } @@ -134,7 +134,7 @@ private List createVms() { final var vmList = new ArrayList(VMS); final int mips = 1000; for (int id = 0; id < VMS; id++) { - final var vm = new VmSimple(id, new CoreCapacity(VM_CORES, mips)); + final var vm = VmSimple.of(id, new CoreCapacity(VM_CORES, mips)); vm .setRam(512).setBw(1000).setSize(10000) .setCloudletScheduler(new CloudletSchedulerSpaceShared()); @@ -152,7 +152,7 @@ private List createCloudlets() { /* A utilization model for RAM and BW that uses only 50% of the resource capacity all the time. */ final var utilizationModelDynamic = new UtilizationModelDynamic(0.5); for (int id = 0; id < CLOUDLETS; id++) { - final var cloudlet = new CloudletSimple(id, CLOUDLET_LENGTH, CLOUDLET_CORES); + final var cloudlet = CloudletSimple.of(id, CLOUDLET_LENGTH, CLOUDLET_CORES); cloudlet .setFileSize(1024) .setOutputSize(1024) diff --git a/src/main/java/org/cloudsimplus/examples/schedulers/CloudletSchedulerTimeSharedExample1.java b/src/main/java/org/cloudsimplus/examples/schedulers/CloudletSchedulerTimeSharedExample1.java index 71aac94..f6bd2d2 100755 --- a/src/main/java/org/cloudsimplus/examples/schedulers/CloudletSchedulerTimeSharedExample1.java +++ b/src/main/java/org/cloudsimplus/examples/schedulers/CloudletSchedulerTimeSharedExample1.java @@ -122,7 +122,7 @@ private Datacenter createDatacenter() { hostList.add(host); } - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } private Host createHost() { @@ -130,7 +130,7 @@ private Host createHost() { final long bw = 10000; //in Megabits/s final long storage = 1000000; //in Megabytes final var vmScheduler = new VmSchedulerTimeShared(); - final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); + final var host = HostSimple.of(ram, bw, storage, HOST_CAPACITY); host.setVmScheduler(vmScheduler); return host; } @@ -140,7 +140,7 @@ private List createVms() { final var newVmList = new ArrayList(VMS); for (int v = 0; v < VMS; v++) { final var vm = - new VmSimple(v, VM_CAPACITY) + VmSimple.of(v, VM_CAPACITY) .setRam(512).setBw(1000).setSize(10000) .setCloudletScheduler(new CloudletSchedulerTimeShared()); @@ -155,7 +155,7 @@ private List createCloudlets() { final var newCloudletList = new ArrayList(CLOUDLETS); for (int c = 0; c < CLOUDLETS; c++) { final var cloudlet = - new CloudletSimple(c, CLOUDLET_LENGTH, CLOUDLET_CORES) + CloudletSimple.of(c, CLOUDLET_LENGTH, CLOUDLET_CORES) .setFileSize(1024) .setOutputSize(1024) .setUtilizationModelCpu(new UtilizationModelFull()) diff --git a/src/main/java/org/cloudsimplus/examples/schedulers/LinuxCompletelyFairSchedulerExample.java b/src/main/java/org/cloudsimplus/examples/schedulers/LinuxCompletelyFairSchedulerExample.java index 60694cd..b505820 100755 --- a/src/main/java/org/cloudsimplus/examples/schedulers/LinuxCompletelyFairSchedulerExample.java +++ b/src/main/java/org/cloudsimplus/examples/schedulers/LinuxCompletelyFairSchedulerExample.java @@ -136,7 +136,7 @@ private Datacenter createDatacenter() { hostList.add(createHost()); } - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } private Host createHost() { @@ -146,7 +146,7 @@ private Host createHost() { final var peList = new CoreCapacity(HOST_CORES, HOST_MIPS); - return new HostSimple(ram, bw, storage, peList).setVmScheduler(new VmSchedulerTimeShared()); + return HostSimple.of(ram, bw, storage, peList).setVmScheduler(new VmSchedulerTimeShared()); } private Vm createVm(DatacenterBroker broker) { @@ -154,7 +154,7 @@ private Vm createVm(DatacenterBroker broker) { final int ram = 512; // vm memory (Megabyte) final long bw = 1000; // vm bandwidth - return new VmSimple(numberOfCreatedVms++, VM_CAPACITY) + return VmSimple.of(numberOfCreatedVms++, VM_CAPACITY) .setRam(ram).setBw(bw).setSize(storage) .setCloudletScheduler(new CloudletSchedulerCompletelyFair()); } @@ -164,7 +164,7 @@ private Cloudlet createCloudlet(DatacenterBroker broker) { final long outputSize = 300; //Size (in bytes) after execution final var utilization = new UtilizationModelFull(); - return new CloudletSimple(numberOfCreatedCloudlets++, CLOUDLET_LEN, CLOUDLET_CORES) + return CloudletSimple.of(numberOfCreatedCloudlets++, CLOUDLET_LEN, CLOUDLET_CORES) .setFileSize(fileSize) .setOutputSize(outputSize) .setUtilizationModelCpu(utilization) diff --git a/src/main/java/org/cloudsimplus/examples/schedulers/SharingHostPEsUsingVmSchedulerSpaceSharedExample.java b/src/main/java/org/cloudsimplus/examples/schedulers/SharingHostPEsUsingVmSchedulerSpaceSharedExample.java index fb02e71..a05feae 100755 --- a/src/main/java/org/cloudsimplus/examples/schedulers/SharingHostPEsUsingVmSchedulerSpaceSharedExample.java +++ b/src/main/java/org/cloudsimplus/examples/schedulers/SharingHostPEsUsingVmSchedulerSpaceSharedExample.java @@ -29,6 +29,7 @@ import org.cloudsimplus.cloudlets.Cloudlet; import org.cloudsimplus.cloudlets.CloudletSimple; import org.cloudsimplus.core.CloudSimPlus; +import org.cloudsimplus.datacenters.Datacenter; import org.cloudsimplus.datacenters.DatacenterSimple; import org.cloudsimplus.hosts.Host; import org.cloudsimplus.hosts.HostSimple; @@ -143,12 +144,12 @@ private void createAndSubmitVmsAndCloudlets(final DatacenterBroker broker0) { broker0.submitCloudletList(cloudletList); } - private DatacenterSimple createDatacenter() { + private Datacenter createDatacenter() { final var hostList = new ArrayList(); final var host0 = createHost(); hostList.add(host0); - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } private Host createHost() { @@ -156,7 +157,7 @@ private Host createHost() { final long storage = 1000000; // in Megabytes final long bw = 10000; //in Megabits/s - return new HostSimple(ram, bw, storage, HOST_CAPACITY).setVmScheduler(new VmSchedulerSpaceShared()); + return HostSimple.of(ram, bw, storage, HOST_CAPACITY).setVmScheduler(new VmSchedulerSpaceShared()); } private Vm createVm(DatacenterBroker broker, long mips, int pesNumber) { @@ -164,7 +165,7 @@ private Vm createVm(DatacenterBroker broker, long mips, int pesNumber) { final int ram = 512; // vm memory (Megabyte) final long bw = 1000; // vm bandwidth - return new VmSimple(numberOfCreatedVms++, new CoreCapacity(pesNumber, mips)) + return VmSimple.of(numberOfCreatedVms++, new CoreCapacity(pesNumber, mips)) .setRam(ram).setBw(bw).setSize(storage) .setCloudletScheduler(new CloudletSchedulerTimeShared()); } @@ -174,7 +175,7 @@ private Cloudlet createCloudlet(DatacenterBroker broker, Vm vm) { final long outputSize = 300; //Size (in bytes) after execution final long numberOfCpuCores = vm.getProcessor().getCores(); //cloudlet will use all the VM's CPU cores - return new CloudletSimple(numberOfCreatedCloudlets++, CLOUDLET_LENGTH, numberOfCpuCores) + return CloudletSimple.of(numberOfCreatedCloudlets++, CLOUDLET_LENGTH, numberOfCpuCores) .setFileSize(fileSize) .setOutputSize(outputSize) .setUtilizationModelCpu(new UtilizationModelFull()) diff --git a/src/main/java/org/cloudsimplus/examples/schedulers/SharingHostPEsUsingVmSchedulerTimeSharedExample.java b/src/main/java/org/cloudsimplus/examples/schedulers/SharingHostPEsUsingVmSchedulerTimeSharedExample.java index 0fe983d..ec6b4b0 100755 --- a/src/main/java/org/cloudsimplus/examples/schedulers/SharingHostPEsUsingVmSchedulerTimeSharedExample.java +++ b/src/main/java/org/cloudsimplus/examples/schedulers/SharingHostPEsUsingVmSchedulerTimeSharedExample.java @@ -29,6 +29,7 @@ import org.cloudsimplus.cloudlets.Cloudlet; import org.cloudsimplus.cloudlets.CloudletSimple; import org.cloudsimplus.core.CloudSimPlus; +import org.cloudsimplus.datacenters.Datacenter; import org.cloudsimplus.datacenters.DatacenterSimple; import org.cloudsimplus.hosts.Host; import org.cloudsimplus.hosts.HostSimple; @@ -138,12 +139,12 @@ private void createAndSubmitVmsAndCloudlets(final DatacenterBroker broker0) { broker0.submitCloudletList(cloudletList); } - private DatacenterSimple createDatacenter() { + private Datacenter createDatacenter() { final var hostList = new ArrayList(); final var host0 = createHost(); hostList.add(host0); - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } private Host createHost() { @@ -152,7 +153,7 @@ private Host createHost() { final long storage = 1000000; // in Megabytes final long bw = 10000; //in Megabits/s - return new HostSimple(ram, bw, storage, HOST_CAPACITY).setVmScheduler(new VmSchedulerTimeShared()); + return HostSimple.of(ram, bw, storage, HOST_CAPACITY).setVmScheduler(new VmSchedulerTimeShared()); } private Vm createVm(DatacenterBroker broker, long mips, int pesNumber) { @@ -160,7 +161,7 @@ private Vm createVm(DatacenterBroker broker, long mips, int pesNumber) { final int ram = 512; // vm memory (Megabyte) final long bw = 1000; // vm bandwidth - return new VmSimple(numberOfCreatedVms++, new CoreCapacity(pesNumber, mips)) + return VmSimple.of(numberOfCreatedVms++, new CoreCapacity(pesNumber, mips)) .setRam(ram).setBw(bw).setSize(storage) .setCloudletScheduler(new CloudletSchedulerTimeShared()); @@ -175,7 +176,7 @@ private Cloudlet createCloudlet(DatacenterBroker broker, Vm vm) { //Sets the same utilization model for all these resources. final var utilization = new UtilizationModelFull(); - return new CloudletSimple(numberOfCreatedCloudlets++, CLOUDLET_LENGTH, numberOfCpuCores) + return CloudletSimple.of(numberOfCreatedCloudlets++, CLOUDLET_LENGTH, numberOfCpuCores) .setFileSize(fileSize) .setOutputSize(outputSize) .setUtilizationModel(utilization) diff --git a/src/main/java/org/cloudsimplus/examples/schedulers/TwoCloudletsAndOneSpaceSharedVmExample.java b/src/main/java/org/cloudsimplus/examples/schedulers/TwoCloudletsAndOneSpaceSharedVmExample.java index 1e378ea..ed98034 100755 --- a/src/main/java/org/cloudsimplus/examples/schedulers/TwoCloudletsAndOneSpaceSharedVmExample.java +++ b/src/main/java/org/cloudsimplus/examples/schedulers/TwoCloudletsAndOneSpaceSharedVmExample.java @@ -91,7 +91,7 @@ private TwoCloudletsAndOneSpaceSharedVmExample(){ long bw = 1000; int pesNumber = 1; // number of cpus - final var vm = new VmSimple(vmid, new CoreCapacity(pesNumber, mips)) + final var vm = VmSimple.of(vmid, new CoreCapacity(pesNumber, mips)) .setRam(ram).setBw(bw).setSize(size) .setCloudletScheduler(new CloudletSchedulerSpaceShared()); vmlist.add(vm); @@ -109,14 +109,14 @@ private TwoCloudletsAndOneSpaceSharedVmExample(){ long outputSize = 300; final var utilizationModel = new UtilizationModelFull(); - final var cloudlet1 = new CloudletSimple(++id, length, pesNumber) + final var cloudlet1 = CloudletSimple.of(++id, length, pesNumber) .setFileSize(fileSize) .setOutputSize(outputSize) .setUtilizationModel(utilizationModel) .setVm(vm); cloudletList.add(cloudlet1); - final var cloudlet2 = new CloudletSimple(++id, length, pesNumber) + final var cloudlet2 = CloudletSimple.of(++id, length, pesNumber) .setFileSize(fileSize) .setOutputSize(outputSize) .setUtilizationModel(utilizationModel) @@ -145,11 +145,11 @@ private Datacenter createDatacenter() { final long ram = 20000; //in Megabytes final long bw = 100000; //in Megabytes final long storage = 10000000; //in Megabytes - final var host = new HostSimple(ram, bw, storage, cpuCapacity) + final var host = HostSimple.of(ram, bw, storage, cpuCapacity) .setVmScheduler(new VmSchedulerTimeShared()); hostList.add(host); - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } } diff --git a/src/main/java/org/cloudsimplus/examples/schedulers/TwoCloudletsAndOneTimeSharedVmExample.java b/src/main/java/org/cloudsimplus/examples/schedulers/TwoCloudletsAndOneTimeSharedVmExample.java index 00d9ac1..1cf1280 100755 --- a/src/main/java/org/cloudsimplus/examples/schedulers/TwoCloudletsAndOneTimeSharedVmExample.java +++ b/src/main/java/org/cloudsimplus/examples/schedulers/TwoCloudletsAndOneTimeSharedVmExample.java @@ -93,7 +93,7 @@ private TwoCloudletsAndOneTimeSharedVmExample(){ final long bw = 1000; final int pesNumber = 1; // number of cpus - final var vm = new VmSimple(vmid, new CoreCapacity(pesNumber, mips)) + final var vm = VmSimple.of(vmid, new CoreCapacity(pesNumber, mips)) .setRam(ram).setBw(bw).setSize(size) .setCloudletScheduler(new CloudletSchedulerTimeShared()); @@ -111,7 +111,7 @@ private TwoCloudletsAndOneTimeSharedVmExample(){ long outputSize = 300; final var utilizationModel = new UtilizationModelFull(); - final var cloudlet1 = new CloudletSimple(++id, length, pesNumber) + final var cloudlet1 = CloudletSimple.of(++id, length, pesNumber) .setFileSize(fileSize) .setOutputSize(outputSize) .setUtilizationModelCpu(utilizationModel) @@ -119,7 +119,7 @@ private TwoCloudletsAndOneTimeSharedVmExample(){ .setVm(vm); cloudletList.add(cloudlet1); - final var cloudlet2 = new CloudletSimple(++id, length, pesNumber) + final var cloudlet2 = CloudletSimple.of(++id, length, pesNumber) .setFileSize(fileSize) .setOutputSize(outputSize) .setUtilizationModelCpu(utilizationModel) @@ -150,13 +150,13 @@ private Datacenter createDatacenter() { final long ram = 20000; //in Megabytes final long bw = 100000; //in Megabytes final long storage = 10000000; //in Megabytes - final var host = new HostSimple(ram, bw, storage, cpuCapacity) + final var host = HostSimple.of(ram, bw, storage, cpuCapacity) .setRamAllocator(new ResourceAllocatorSimple()) .setBwAllocator(new ResourceAllocatorSimple()) .setVmScheduler(new VmSchedulerTimeShared()); hostList.add(host); - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } } diff --git a/src/main/java/org/cloudsimplus/examples/schedulers/VmSchedulerTimeSharedExample.java b/src/main/java/org/cloudsimplus/examples/schedulers/VmSchedulerTimeSharedExample.java index 3100a06..2dd6517 100755 --- a/src/main/java/org/cloudsimplus/examples/schedulers/VmSchedulerTimeSharedExample.java +++ b/src/main/java/org/cloudsimplus/examples/schedulers/VmSchedulerTimeSharedExample.java @@ -191,12 +191,12 @@ private void createDatacenter() { hostList.add(host); } - Datacenter dc0 = new DatacenterSimple(simulation, hostList, new VmPlacementPolicyFirstFit()); + Datacenter dc0 = DatacenterSimple.of(simulation, hostList, new VmPlacementPolicyFirstFit()); dc0.setSchedulingInterval(SCHEDULING_INTERVAL); } private Host createHost() { - final var host = new HostSimple(HOST_RAM, HOST_BW, HOST_STORAGE, HOST_CAPACITY); + final var host = HostSimple.of(HOST_RAM, HOST_BW, HOST_STORAGE, HOST_CAPACITY); host.setStateHistoryEnabled(true) .setVmScheduler(new VmSchedulerTimeShared()); return host; @@ -206,7 +206,7 @@ private Host createHost() { private void createVms() { for (int i = 0; i < VMS; i++) { final var vm = - new VmSimple(VM_CAPACITY) + VmSimple.of(VM_CAPACITY) .setRam(VM_RAM).setBw(VM_BW).setSize(VM_SIZE); vmList.add(vm); } @@ -215,7 +215,7 @@ private void createVms() { /// Creates one Cloudlet for each VM belonging to [#broker0]. private void createCloudlets() { for (final var vm : vmList) { - final var cloudlet = new CloudletSimple(CLOUDLET_LENGTH, CLOUDLET_CORES); + final var cloudlet = CloudletSimple.of(CLOUDLET_LENGTH, CLOUDLET_CORES); cloudlet.setVm(vm); cloudletList.add(cloudlet); } diff --git a/src/main/java/org/cloudsimplus/examples/simulationstatus/PauseSimulationAtGivenTimeExample1.java b/src/main/java/org/cloudsimplus/examples/simulationstatus/PauseSimulationAtGivenTimeExample1.java index 2d7f149..feec98b 100755 --- a/src/main/java/org/cloudsimplus/examples/simulationstatus/PauseSimulationAtGivenTimeExample1.java +++ b/src/main/java/org/cloudsimplus/examples/simulationstatus/PauseSimulationAtGivenTimeExample1.java @@ -172,12 +172,12 @@ private void printsListOfcloudletFinishedList(String title) { .build(); } - private DatacenterSimple createDatacenter() { + private Datacenter createDatacenter() { final var hostList = new ArrayList(); final var host0 = createHost(); hostList.add(host0); - var dc = new DatacenterSimple(simulation, hostList); + var dc = DatacenterSimple.of(simulation, hostList); dc.setSchedulingInterval(SCHEDULING_INTERVAL); return dc; } @@ -191,11 +191,11 @@ private Host createHost() { //Defines the number of Host CPU cores and the MIPS capacity of each core final var cpuCapacity = new CoreCapacity(1, mips); - return new HostSimple(ram, bw, storage, cpuCapacity).setVmScheduler(new VmSchedulerTimeShared()); + return HostSimple.of(ram, bw, storage, cpuCapacity).setVmScheduler(new VmSchedulerTimeShared()); } private Vm createVm() { - return new VmSimple(VM_CAPACITY) + return VmSimple.of(VM_CAPACITY) .setRam(512) .setBw(1000) .setSize(10000) @@ -203,7 +203,7 @@ private Vm createVm() { } private Cloudlet createCloudlet(Vm vm) { - return new CloudletSimple(10000, vm.getProcessor().getCores()) + return CloudletSimple.of(10000, vm.getProcessor().getCores()) .setFileSize(300) .setOutputSize(300) .setUtilizationModel(new UtilizationModelFull()) diff --git a/src/main/java/org/cloudsimplus/examples/simulationstatus/PauseSimulationAtGivenTimeExample2.java b/src/main/java/org/cloudsimplus/examples/simulationstatus/PauseSimulationAtGivenTimeExample2.java index 0c3974e..f820ea0 100755 --- a/src/main/java/org/cloudsimplus/examples/simulationstatus/PauseSimulationAtGivenTimeExample2.java +++ b/src/main/java/org/cloudsimplus/examples/simulationstatus/PauseSimulationAtGivenTimeExample2.java @@ -185,12 +185,12 @@ private void printsListOfcloudletFinishedList(String title) { .build(); } - private DatacenterSimple createDatacenter() { + private Datacenter createDatacenter() { final var hostList = new ArrayList(); final var host0 = createHost(); hostList.add(host0); - final var dc = new DatacenterSimple(simulation, hostList); + final var dc = DatacenterSimple.of(simulation, hostList); dc.setSchedulingInterval(SCHEDULING_INTERVAL); return dc; } @@ -204,11 +204,11 @@ private Host createHost() { //Defines the number of Host CPU cores and the MIPS capacity of each core final var cpuCapacity = new CoreCapacity(1, mips); - return new HostSimple(ram, bw, storage, cpuCapacity).setVmScheduler(new VmSchedulerTimeShared()); + return HostSimple.of(ram, bw, storage, cpuCapacity).setVmScheduler(new VmSchedulerTimeShared()); } private Vm createVm() { - return new VmSimple(VM_CAPACITY) + return VmSimple.of(VM_CAPACITY) .setRam(512) .setBw(1000) .setSize(10000) @@ -216,7 +216,7 @@ private Vm createVm() { } private Cloudlet createCloudlet(Vm vm) { - return new CloudletSimple(10000, vm.getProcessor().getCores()) + return CloudletSimple.of(10000, vm.getProcessor().getCores()) .setFileSize(300) .setOutputSize(300) .setUtilizationModel(new UtilizationModelFull()) diff --git a/src/main/java/org/cloudsimplus/examples/simulationstatus/TerminateSimulationAtGivenConditionExample.java b/src/main/java/org/cloudsimplus/examples/simulationstatus/TerminateSimulationAtGivenConditionExample.java index 6d39f7c..99df1c5 100755 --- a/src/main/java/org/cloudsimplus/examples/simulationstatus/TerminateSimulationAtGivenConditionExample.java +++ b/src/main/java/org/cloudsimplus/examples/simulationstatus/TerminateSimulationAtGivenConditionExample.java @@ -29,6 +29,7 @@ import org.cloudsimplus.cloudlets.Cloudlet; import org.cloudsimplus.cloudlets.CloudletSimple; import org.cloudsimplus.core.CloudSimPlus; +import org.cloudsimplus.datacenters.Datacenter; import org.cloudsimplus.datacenters.DatacenterSimple; import org.cloudsimplus.hosts.Host; import org.cloudsimplus.hosts.HostSimple; @@ -132,12 +133,12 @@ private void onClouletProcessingUpdate(CloudletVmEventInfo event) { } } - private DatacenterSimple createDatacenter() { + private Datacenter createDatacenter() { final var hostList = new ArrayList(); final var host0 = createHost(); hostList.add(host0); - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } private Host createHost() { @@ -149,7 +150,7 @@ private Host createHost() { //Defines the number of Host CPU cores and the MIPS capacity of each core final var cpuCapacity = new CoreCapacity(1, mips); - return new HostSimple(ram, bw, storage, cpuCapacity) + return HostSimple.of(ram, bw, storage, cpuCapacity) .setRamAllocator(new ResourceAllocatorSimple()) .setBwAllocator(new ResourceAllocatorSimple()) .setVmScheduler(new VmSchedulerTimeShared()); @@ -162,7 +163,7 @@ private Vm createVm(DatacenterBroker broker) { final long bw = 1000; // vm bandwidth (Megabits/s) final int pesNumber = 1; // number of CPU cores - return new VmSimple(numberOfCreatedVms++, new CoreCapacity(pesNumber, mips)) + return VmSimple.of(numberOfCreatedVms++, new CoreCapacity(pesNumber, mips)) .setRam(ram) .setBw(bw) .setSize(storage) @@ -179,7 +180,7 @@ private Cloudlet createCloudlet(DatacenterBroker broker, Vm vm) { //Sets the same utilization model for all these resources. final var utilization = new UtilizationModelFull(); - return new CloudletSimple( + return CloudletSimple.of( numberOfCreatedCloudlets++, length, numberOfCpuCores) .setFileSize(fileSize) .setOutputSize(outputSize) diff --git a/src/main/java/org/cloudsimplus/examples/simulationstatus/TerminateSimulationAtGivenTimeExample.java b/src/main/java/org/cloudsimplus/examples/simulationstatus/TerminateSimulationAtGivenTimeExample.java index a6d8f6d..72600a8 100755 --- a/src/main/java/org/cloudsimplus/examples/simulationstatus/TerminateSimulationAtGivenTimeExample.java +++ b/src/main/java/org/cloudsimplus/examples/simulationstatus/TerminateSimulationAtGivenTimeExample.java @@ -29,6 +29,7 @@ import org.cloudsimplus.cloudlets.Cloudlet; import org.cloudsimplus.cloudlets.CloudletSimple; import org.cloudsimplus.core.CloudSimPlus; +import org.cloudsimplus.datacenters.Datacenter; import org.cloudsimplus.datacenters.DatacenterSimple; import org.cloudsimplus.hosts.Host; import org.cloudsimplus.hosts.HostSimple; @@ -107,12 +108,12 @@ on behalf of a given cloud user (customer).*/ System.out.println(getClass().getSimpleName() + " finished!"); } - private DatacenterSimple createDatacenter() { + private Datacenter createDatacenter() { final var hostList = new ArrayList(); final var host0 = createHost(); hostList.add(host0); - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } private Host createHost() { @@ -124,14 +125,14 @@ private Host createHost() { //Defines the number of Host CPU cores and the MIPS capacity of each core final var cpuCapacity = new CoreCapacity(1, mips); - return new HostSimple(ram, bw, storage, cpuCapacity); + return HostSimple.of(ram, bw, storage, cpuCapacity); } private Vm createVm(DatacenterBroker broker) { final long mips = 1000; final int pesNumber = 1; // number of CPU cores - return new VmSimple(numberOfCreatedVms++, new CoreCapacity(pesNumber, mips)) + return VmSimple.of(numberOfCreatedVms++, new CoreCapacity(pesNumber, mips)) .setRam(512) .setBw((long) 1000) .setSize((long) 10000) @@ -142,7 +143,7 @@ private Cloudlet createCloudlet(DatacenterBroker broker, Vm vm) { final long length = 10000; //in Million Instructions (MI) final long numberOfCpuCores = vm.getProcessor().getCores(); //cloudlet will use all the VM's CPU cores - return new CloudletSimple( + return CloudletSimple.of( numberOfCreatedCloudlets++, length, numberOfCpuCores) .setFileSize(300) .setOutputSize(300) diff --git a/src/main/java/org/cloudsimplus/examples/sla/VmMigrationWhenCpuMetricIsViolatedExample.java b/src/main/java/org/cloudsimplus/examples/sla/VmMigrationWhenCpuMetricIsViolatedExample.java index c887351..f369c3b 100755 --- a/src/main/java/org/cloudsimplus/examples/sla/VmMigrationWhenCpuMetricIsViolatedExample.java +++ b/src/main/java/org/cloudsimplus/examples/sla/VmMigrationWhenCpuMetricIsViolatedExample.java @@ -161,7 +161,7 @@ private void createAndSubmitVms(final DatacenterBroker broker) { } private Vm createVm() { - final Vm vm = new VmSimple(vmList.size(), VM_CAPACITY); + final Vm vm = VmSimple.of(vmList.size(), VM_CAPACITY); vm.setRam(VM_RAM).setBw(VM_BW).setSize(VM_SIZE) .setCloudletScheduler(new CloudletSchedulerTimeShared()); return vm; @@ -185,7 +185,7 @@ private void createAndSubmitCloudlets( progressiveCpuUsage); final Cloudlet c - = new CloudletSimple( + = CloudletSimple.of( cloudletId, CLOUDLET_LENGHT, 2) .setFileSize(CLOUDLET_FILESIZE) .setOutputSize(CLOUDLET_OUTPUTSIZE) @@ -268,14 +268,14 @@ private Datacenter createDatacenter() { contract.getCpuUtilizationMetric().getMaxDimension().getValue()); allocationPolicy.setUnderUtilizationThreshold(contract.getCpuUtilizationMetric().getMinDimension().getValue()); - final var dc = new DatacenterSimple(simulation, hostList, allocationPolicy); + final var dc = DatacenterSimple.of(simulation, hostList, allocationPolicy); dc.enableMigrations().setSchedulingInterval(SCHEDULE_TIME_TO_PROCESS_DATACENTER_EVENTS); return dc; } private Host createHost(final int pesNumber, final long mipsByPe) { final var cpuCapacity = new CoreCapacity(pesNumber, mipsByPe); - final var host = new HostSimple(HOST_RAM, HOST_BW, HOST_STORAGE, cpuCapacity); + final var host = HostSimple.of(HOST_RAM, HOST_BW, HOST_STORAGE, cpuCapacity); host.setPowerModel(new PowerModelHostSimple(1000, 700)); host.setRamAllocator(new ResourceAllocatorSimple()); host.setBwAllocator(new ResourceAllocatorSimple()); diff --git a/src/main/java/org/cloudsimplus/examples/synchronous/SynchronousSimulationExample1.java b/src/main/java/org/cloudsimplus/examples/synchronous/SynchronousSimulationExample1.java index 2123d4b..21f6b49 100755 --- a/src/main/java/org/cloudsimplus/examples/synchronous/SynchronousSimulationExample1.java +++ b/src/main/java/org/cloudsimplus/examples/synchronous/SynchronousSimulationExample1.java @@ -161,7 +161,7 @@ private Datacenter createDatacenter() { } //Uses a VmPlacementPolicySimple by default to place VMs - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } private Host createHost() { @@ -173,7 +173,7 @@ private Host createHost() { Uses ResourceAllocatorSimple by default for RAM and BW allocation and VmSchedulerSpaceShared for VM scheduling. */ - return new HostSimple(ram, bw, storage, HOST_CAPACITY); + return HostSimple.of(ram, bw, storage, HOST_CAPACITY); } /// Creates a list of VMs. @@ -181,7 +181,7 @@ private List createVms() { final var list = new ArrayList(VMS); for (int i = 0; i < VMS; i++) { //Uses a CloudletSchedulerTimeShared by default to schedule Cloudlets - final Vm vm = new VmSimple(VM_CAPACITY); + final Vm vm = VmSimple.of(VM_CAPACITY); vm.setRam(512).setBw(1000).setSize(10000); list.add(vm); } @@ -194,7 +194,7 @@ private List createCloudlets() { final var list = new ArrayList(CLOUDLETS); for (int i = 0; i < CLOUDLETS; i++) { - final var cloudlet = new CloudletSimple(CLOUDLET_LENGTH, CLOUDLET_CORES); + final var cloudlet = CloudletSimple.of(CLOUDLET_LENGTH, CLOUDLET_CORES); cloudlet.setUtilizationModelCpu(new UtilizationModelFull()) .setSizes(1024) .setSubmissionDelay(i); diff --git a/src/main/java/org/cloudsimplus/examples/traces/PlanetLabExample1.java b/src/main/java/org/cloudsimplus/examples/traces/PlanetLabExample1.java index be02385..322fabf 100755 --- a/src/main/java/org/cloudsimplus/examples/traces/PlanetLabExample1.java +++ b/src/main/java/org/cloudsimplus/examples/traces/PlanetLabExample1.java @@ -134,7 +134,7 @@ private Datacenter createDatacenter() { hostList.add(host); } - final var dc = new DatacenterSimple(simulation, hostList); + final var dc = DatacenterSimple.of(simulation, hostList); dc.setSchedulingInterval(SCHEDULING_INTERVAL); return dc; } @@ -143,7 +143,7 @@ private Host createHost() { final long ram = 2048; //in Megabytes final long bw = 10000; //in Megabits/s final long storage = 1000000; //in Megabytes - final var host = new HostSimple(ram, bw, storage, HOST_CAPACITY); + final var host = HostSimple.of(ram, bw, storage, HOST_CAPACITY); host .setRamAllocator(new ResourceAllocatorSimple()) .setBwAllocator(new ResourceAllocatorSimple()) @@ -156,7 +156,7 @@ private List createVms() { final var list = new ArrayList(VMS); for (int i = 0; i < VMS; i++) { final var vm = - new VmSimple(i, VM_CAPACITY) + VmSimple.of(i, VM_CAPACITY) .setRam(512).setBw(1000).setSize(10000) .setCloudletScheduler(new CloudletSchedulerTimeShared()); @@ -174,7 +174,7 @@ private List createCloudlets() { final var utilizationCpu = UtilizationModelPlanetLab.getInstance(TRACE_FILE, SCHEDULING_INTERVAL); for (int i = 0; i < CLOUDLETS; i++) { final var cloudlet = - new CloudletSimple(i, CLOUDLET_LENGTH, CLOUDLET_CORES) + CloudletSimple.of(i, CLOUDLET_LENGTH, CLOUDLET_CORES) .setFileSize(1024) .setOutputSize(1024) .setUtilizationModelCpu(utilizationCpu) diff --git a/src/main/java/org/cloudsimplus/examples/traces/SwfWorkloadFormatExample1.java b/src/main/java/org/cloudsimplus/examples/traces/SwfWorkloadFormatExample1.java index 2234ad8..1c4f35a 100755 --- a/src/main/java/org/cloudsimplus/examples/traces/SwfWorkloadFormatExample1.java +++ b/src/main/java/org/cloudsimplus/examples/traces/SwfWorkloadFormatExample1.java @@ -174,7 +174,7 @@ private void createVms() { final int totalVms = (int)Math.ceil(totalCloudletCores / (VM_CORES*6)); for (int i = 0; i < totalVms; i++) { - final var vm = new VmSimple(VM_CAPACITY) + final var vm = VmSimple.of(VM_CAPACITY) .setRam(VM_RAM).setBw(VM_BW).setSize(VM_SIZE) .setCloudletScheduler(new CloudletSchedulerSpaceShared()); vmlist.add(vm); @@ -197,7 +197,7 @@ private void createCloudletsFromWorkloadFile() { /// @return the created Datacenter private Datacenter createDatacenter() { final var hostList = createHosts(vmlist.size()/2); - var datacenter = new DatacenterSimple(simulation, hostList, new VmPlacementPolicyFirstFit()); + var datacenter = DatacenterSimple.of(simulation, hostList, new VmPlacementPolicyFirstFit()); System.out.printf("# Added %12d Hosts to %s%n", hostList.size(), datacenter); return datacenter; @@ -215,7 +215,7 @@ private List createHosts(final long hostsNumber) { final var hostList = new ArrayList((int)hostsNumber); for (int i = 0; i < hostsNumber; i++) { CoreCapacity cpuCapacity = new CoreCapacity(HOST_CORES, VM_MIPS); - final var host = new HostSimple(ram, bw, storage, cpuCapacity); + final var host = HostSimple.of(ram, bw, storage, cpuCapacity); hostList.add(host); } diff --git a/src/main/java/org/cloudsimplus/examples/traces/google/GoogleMachineEventsExample1.java b/src/main/java/org/cloudsimplus/examples/traces/google/GoogleMachineEventsExample1.java index b8b1b8c..239c556 100755 --- a/src/main/java/org/cloudsimplus/examples/traces/google/GoogleMachineEventsExample1.java +++ b/src/main/java/org/cloudsimplus/examples/traces/google/GoogleMachineEventsExample1.java @@ -145,7 +145,7 @@ private void createDatacenters() { //Creates Datacenters with no hosts. for(int i = 0; i < DATACENTERS_NUMBER; i++){ - datacenters.add(new DatacenterSimple(simulation, new VmPlacementPolicySimple())); + datacenters.add(DatacenterSimple.of(simulation, new VmPlacementPolicySimple())); } /*Process the trace file and creates the Hosts that the timestamp is defined as zero inside the file. @@ -171,7 +171,7 @@ private void createDatacenters() { /// @param event an object containing the trace line read, used to create the Host. /// @return private Host createHost(final MachineEvent event) { - final Host host = new HostSimple(event.getRam(), HOST_BW, HOST_STORAGE, new CoreCapacity(event.getCpuCores(), HOST_MIPS)); + final Host host = HostSimple.of(event.getRam(), HOST_BW, HOST_STORAGE, new CoreCapacity(event.getCpuCores(), HOST_MIPS)); host.setId(event.getMachineId()); return host; } @@ -194,7 +194,7 @@ private List createAndSubmitVms(Datacenter datacenter) { /// @param host /// @return private Vm createVm(final Host host) { - return new VmSimple(new CoreCapacity(host.getProcessor().getCores(), 1000)) + return VmSimple.of(new CoreCapacity(host.getProcessor().getCores(), 1000)) .setRam(host.getRam().getCapacity()).setBw(HOST_BW).setSize(HOST_STORAGE) .setCloudletScheduler(new CloudletSchedulerSpaceShared()); } @@ -212,7 +212,7 @@ private void createAndSubmitCloudlets(final List vmList) { private Cloudlet createCloudlet(Vm vm) { final var utilization = new UtilizationModelFull(); - return new CloudletSimple(CLOUDLET_LENGTH, vm.getProcessor().getCores()) + return CloudletSimple.of(CLOUDLET_LENGTH, vm.getProcessor().getCores()) .setFileSize(1024) .setOutputSize(1024) .setUtilizationModel(utilization) diff --git a/src/main/java/org/cloudsimplus/examples/traces/google/GoogleTaskEventsExample1.java b/src/main/java/org/cloudsimplus/examples/traces/google/GoogleTaskEventsExample1.java index 98f1a60..1a66899 100755 --- a/src/main/java/org/cloudsimplus/examples/traces/google/GoogleTaskEventsExample1.java +++ b/src/main/java/org/cloudsimplus/examples/traces/google/GoogleTaskEventsExample1.java @@ -218,7 +218,7 @@ private Cloudlet createCloudlet(final TaskEvent event) { final double sizeInMB = event.getResourceRequestForLocalDiskSpace() * VM_SIZE_MB + 1; final long sizeInBytes = (long) Math.ceil(megaBytesToBytes(sizeInMB)); - return new CloudletSimple(CLOUDLET_LENGTH, pesNumber) + return CloudletSimple.of(CLOUDLET_LENGTH, pesNumber) .setFileSize(sizeInBytes) .setOutputSize(sizeInBytes) .setUtilizationModelCpu(new UtilizationModelFull()) @@ -246,7 +246,7 @@ private Datacenter createDatacenter() { } //Uses a VmPlacementPolicySimple by default - return new DatacenterSimple(simulation, hostList); + return DatacenterSimple.of(simulation, hostList); } private long getVmSize(final Cloudlet cloudlet) { @@ -259,7 +259,7 @@ private long getCloudletSizeInMB(final Cloudlet cloudlet) { private Host createHost() { //Uses a ResourceAllocatorSimple for RAM and BW - final Host host = new HostSimple(HOST_RAM, HOST_BW, HOST_STORAGE, HOST_CAPACITY); + final Host host = HostSimple.of(HOST_RAM, HOST_BW, HOST_STORAGE, HOST_CAPACITY); host.setVmScheduler(new VmSchedulerTimeShared()); return host; } @@ -270,7 +270,7 @@ private List createVms() { private Vm createVm() { //Uses a CloudletSchedulerTimeShared by default - return new VmSimple(VM_CAPACITY).setRam(VM_RAM).setBw(VM_BW).setSize(VM_SIZE_MB); + return VmSimple.of(VM_CAPACITY).setRam(VM_RAM).setBw(VM_BW).setSize(VM_SIZE_MB); } private void printCloudlets(final DatacenterBroker broker) {