本文整理汇总了Java中org.cloudbus.cloudsim.ParameterException类的典型用法代码示例。如果您正苦于以下问题:Java ParameterException类的具体用法?Java ParameterException怎么用?Java ParameterException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ParameterException类属于org.cloudbus.cloudsim包,在下文中一共展示了ParameterException类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPersistentStorage
import org.cloudbus.cloudsim.ParameterException; //导入依赖的package包/类
/**
* create a defined number of defined storage type to the persistent storage of a power-aware datacenter.
*
* @param storageNumber
* @throws ParameterException
*/
public void createPersistentStorage(int storageNumber, StorageModelHdd hddModel, PowerModelHdd hddPowerModel)
throws ParameterException {
for (int i = 1; i <= storageNumber; i++) {
storageList.add(new MyPowerHarddriveStorage(i, "hdd" + i, hddModel, hddPowerModel));
}
}
示例2: createDataFilesList
import org.cloudbus.cloudsim.ParameterException; //导入依赖的package包/类
/**
* Create a list of data Files.
*
* @param source
* name of the file in the default files folder.
*/
public void createDataFilesList(String source) {
String path = "files/" + source;
try {
// instantiate a reader
BufferedReader input = new BufferedReader(new FileReader(path));
// read line by line
String line;
String[] lineSplited;
String fileName;
String fileSize;
while ((line = input.readLine()) != null) {
// retrieve fileName and fileSize
lineSplited = line.split(",");
fileName = lineSplited[0];
fileSize = lineSplited[1];
// add file to the List
dataFiles.add(new File(fileName, Integer.parseInt(fileSize)));
}
// close the reader
input.close();
} catch (IOException | NumberFormatException | ParameterException e) {
e.printStackTrace();
}
}
示例3: createCloudletList
import org.cloudbus.cloudsim.ParameterException; //导入依赖的package包/类
/**
* @param CloudlerNumber
* @throws ParameterException
*/
public void createCloudletList(int CloudlerNumber) throws ParameterException {
// local variable
ArrayList<String> tempRequiredFilesList = null;
ArrayList<File> tempDataFilesList = null;
for (int i = 1; i <= CloudlerNumber; i++) {
// handle dataFiles
if (i <= dataFiles.size()) {
tempDataFilesList = new ArrayList<File>(Arrays.asList(dataFiles.get(i - 1)));
} else {
tempDataFilesList = null;
}
// handle requiredFiles
if (i <= requiredFiles.size()) {
tempRequiredFilesList = new ArrayList<String>(Arrays.asList(requiredFiles.get(i - 1)));
} else {
tempRequiredFilesList = null;
}
// create cloudlet
cloudletList.add(new MyCloudlet(i, MyConstants.CLOUDLET_LENGHT, MyConstants.CLOUDLET_PES_NUMBER,
MyConstants.CLOUDLET_FILE_SIZE, MyConstants.CLOUDLET_OUTPUT_SIZE,
MyConstants.CLOUDLET_UTILIZATION_MODEL_CPU, MyConstants.CLOUDLET_UTILIZATION_MODEL_RAM,
MyConstants.CLOUDLET_UTILIZATION_MODEL_BW, tempRequiredFilesList, tempDataFilesList));
cloudletList.get(i - 1).setUserId(broker.getId());
cloudletList.get(i - 1).setVmId(vmlist.get(0).getId());
}
// submit the list to the broker
broker.submitCloudletList(cloudletList);
}
示例4: addFiles
import org.cloudbus.cloudsim.ParameterException; //导入依赖的package包/类
/**
* @param startingFilesList
*/
public void addFiles(String startingFilesList) {
if (startingFilesList != "") {
try {
// instantiate a reader
BufferedReader input = new BufferedReader(new FileReader("files/" + startingFilesList));
// read line by line
String line;
String[] lineSplited;
String fileName;
String fileSize;
while ((line = input.readLine()) != null) {
// retrieve fileName and fileSize
lineSplited = line.split("\\s+"); // regular expression
// quantifiers for
// whitespace
fileName = lineSplited[0];
fileSize = lineSplited[1];
// add file to datacenter
datacenter.addFile(new File(fileName, Integer.parseInt(fileSize)));
}
// close the reader
input.close();
} catch (IOException | NumberFormatException | ParameterException e) {
e.printStackTrace();
}
}
}
示例5: MyHarddriveStorage
import org.cloudbus.cloudsim.ParameterException; //导入依赖的package包/类
/**
* The constructor.
*
* @param id
* unique id for this drive
* @param name
* the name of the new Hard Drive storage
* @param storageModelHdd
* the model of a specific hard drive
* @throws ParameterException
* when the name and the capacity are not valid
*/
public MyHarddriveStorage(int id, String name, StorageModelHdd storageModelHdd) throws ParameterException {
// store id & name
this.Id = id;
this.name = name;
// initializes final variables
this.storageModel = storageModelHdd;
this.capacity = storageModelHdd.getCapacity();
this.reference = storageModelHdd.getModelNumber();
this.maxInternalDataTransferRate = storageModelHdd.getMaxInternalDataTransferRate();
this.avgRotLatency = storageModelHdd.getAvgRotationLatency();
this.avgSeekTime = storageModelHdd.getAvgSeekTime();
// initializes global variables
this.activeEndAt = 0.0;
this.fileList = new ArrayList<File>();
this.nameList = new ArrayList<String>();
this.genSeekTime = null;
this.usedSpace = 0;
setMode(0);
setQueueLength(0);
// randomize seekTime & rotation latency
setSeekTime(storageModelHdd.getAvgSeekTime());
setRotLatency(storageModelHdd.getAvgRotationLatency());
}
示例6: MyPowerHarddriveStorage
import org.cloudbus.cloudsim.ParameterException; //导入依赖的package包/类
/**
* Creates a new Hard Drive storage base on a specific HDD Model.
*
* @param id
* unique id of the HDD CloudSim component
* @param name
* the name
* @param storageModelHdd
* the specific model
* @param powerModel
* the power model
* @throws ParameterException
* when the name and the capacity are not valid
*/
public MyPowerHarddriveStorage(int id, String name, StorageModelHdd storageModelHdd, PowerModelHdd powerModel)
throws ParameterException {
super(id, name, storageModelHdd);
// set HDD characteristics
setPowerModelHdd(powerModel);
// set initial parameters
setInActiveDuration(0.0);
setLastIdleStartTime(0.0);
}
示例7: ClusterStorage
import org.cloudbus.cloudsim.ParameterException; //导入依赖的package包/类
/**
* Initialize a ClusterStorage
*
* @param name, name of this storage
* @param capacity, capacity
* @throws ParameterException
*/
public ClusterStorage(String name, double capacity) throws ParameterException {
super(name, capacity);
}