0

我正在研究 Cloudsim。我想为自己的工作更改 PowerVmAllocationPolicyAbstract 类的 findHostForVm() 方法。我将 findHostForVm() 更改为抽象方法,如下所示

public abstract class PowerVmAllocationPolicyAbstract extends VmAllocationPolicy {
    public PowerVmAllocationPolicyAbstract(List<? extends Host> list) {
    super(list);
      }
    public abstract PowerHost   findHostForVm(Vm vm) ;
     .
     .
} 

在我自己的课程中,我写了 findHostForVm(Vm vm) 。当我从 powerDatacenter 创建实例时,一个参数需要参考 PowerVmAllocationPolicyAbstract 。我在下面写了

public class D{
  public PowerHost findHostForVm(List<Vm>  vmlist) {
   .
   .
  }
    powerDatacenter = new PowerDatacenter(
                name,
                characteristics,
                new D(),
                 new LinkedList<Storage>(),
                5.0);
   }

但它有错误。这个错误是:

constructor PowerDatacenter in class org.cloudbus.cloudsim.power.PowerDatacenter cannot            be applied to given types;
   required:    java.lang.String,org.cloudbus.cloudsim.DatacenterCharacteristics,org.cloudbus.cloudsim.VmAl       locationPolicy,java.util.List<org.cloudbus.cloudsim.Storage>,double
    found:     java.lang.String,org.cloudbus.cloudsim.DatacenterCharacteristics,cs.umu.se.vmp.alg.    D,java.util.LinkedList<org.cloudbus.cloudsim.Storage>,double
   reason: actual argument cs.umu.se.vmp.alg. D  cannot be converted to    org.cloudbus.cloudsim.VmAllocationPolicy by method invocation conversion

请帮帮我我该怎么办?多谢

4

0 回答 0