本文整理汇总了Java中org.cloudbus.cloudsim.Vm.getId方法的典型用法代码示例。如果您正苦于以下问题:Java Vm.getId方法的具体用法?Java Vm.getId怎么用?Java Vm.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.cloudbus.cloudsim.Vm
的用法示例。
在下文中一共展示了Vm.getId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findVm
import org.cloudbus.cloudsim.Vm; //导入方法依赖的package包/类
private Vm findVm(int vmId) {
List<Vm> vms = host.getVmList();
for(Vm vm:vms) {
if(vm.getId() == vmId) {
return vm;
}
}
return null;
}
示例2: findVm
import org.cloudbus.cloudsim.Vm; //导入方法依赖的package包/类
protected Vm findVm(int vmId) {
for(Vm vm:vmList) {
if(vm.getId() == vmId)
return vm;
}
return null;
}
开发者ID:gmartinezramirez,项目名称:Fog-Computing-Mobile-Architecture,代码行数:8,代码来源:NetworkOperatingSystem.java
示例3: getOperatorName
import org.cloudbus.cloudsim.Vm; //导入方法依赖的package包/类
public String getOperatorName(int vmId){
for(Vm vm : this.getHost().getVmList()){
if(vm.getId() == vmId)
return ((AppModule)vm).getName();
}
return null;
}
示例4: allocateHostForVm
import org.cloudbus.cloudsim.Vm; //导入方法依赖的package包/类
@Override
public boolean allocateHostForVm(Vm vm) {
boolean result = false;
if (!getVmTable().containsKey(vm.getUid())) { // if this vm was not created
boolean vmFound = false;
int vmCounter = 0;
int hostIndex = 0;
int dataCenterIndex = 0;
//find proper datacenter id and host id for this VM
Document doc = SimSettings.getInstance().getEdgeDevicesDocument();
NodeList datacenterList = doc.getElementsByTagName("datacenter");
for (int i = 0; (!vmFound && i < datacenterList.getLength()); i++) {
Node datacenterNode = datacenterList.item(i);
Element datacenterElement = (Element) datacenterNode;
NodeList hostNodeList = datacenterElement.getElementsByTagName("host");
for (int j = 0; (!vmFound && j < hostNodeList.getLength()); j++) {
Node hostNode = hostNodeList.item(j);
Element hostElement = (Element) hostNode;
NodeList vmNodeList = hostElement.getElementsByTagName("VM");
for (int k = 0; (!vmFound && k < vmNodeList.getLength()); k++) {
if(vmCounter == vm.getId()){
dataCenterIndex = i;
hostIndex = j;
vmFound = true;
}
vmCounter++;
}
}
}
if(vmFound && dataCenterIndex == DataCenterIndex && hostIndex < getHostList().size()){
Host host = getHostList().get(hostIndex);
result = host.vmCreate(vm);
if (result) { // if vm were succesfully created in the host
getVmTable().put(vm.getUid(), host);
createdVmNum++;
Log.formatLine("%.2f: VM #" + vm.getId() + " has been allocated to the host #" + host.getId(),CloudSim.clock());
result = true;
}
}
}
return result;
}