-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBrokerInfo.java
53 lines (38 loc) · 1.45 KB
/
BrokerInfo.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package org.cloudbus.cloudsim.examples;
import java.util.LinkedList;
import java.util.List;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.DatacenterBroker;
import org.cloudbus.cloudsim.Vm;
public class BrokerInfo {
public List<VmInfo> vmList;
public List<VmInfo> vmsCreatedList;
public List<CloudletInfo> cloudletList;
public List<CloudletInfo> cloudletSubmittedList;
public List<CloudletInfo> cloudletReceivedList;
public int id;
public BrokerInfo(DatacenterBroker broker) {
this.vmList = constructVmList(broker.getVmList());
this.vmsCreatedList = constructVmList(broker.getVmsCreatedList());
this.cloudletList = constructCloudletList(broker.getCloudletList());
this.cloudletSubmittedList= constructCloudletList(broker.getCloudletSubmittedList());
this.cloudletReceivedList= constructCloudletList(broker.getCloudletReceivedList());
this.id = broker.getId();
}
private List<CloudletInfo> constructCloudletList(List<Cloudlet> list) {
List<CloudletInfo> cloudletList = new LinkedList<CloudletInfo>();
for(Cloudlet cloudsimCloudlet : list) {
CloudletInfo payloadCloudlet = new CloudletInfo(cloudsimCloudlet);
cloudletList.add(payloadCloudlet);
}
return cloudletList;
}
public List<VmInfo> constructVmList(List<Vm> list) {
List<VmInfo> vmList = new LinkedList<VmInfo>();
for(Vm cloudsimVm : list) {
VmInfo payloadVm = new VmInfo(cloudsimVm);
vmList.add(payloadVm);
}
return vmList;
}
}