Interface Resource
- All Superinterfaces:
ResourceCapacity
- All Known Subinterfaces:
FileStorage,Pe,ResourceManageable
- All Known Implementing Classes:
Bandwidth,HarddriveStorage,PeSimple,Processor,Ram,ResourceAbstract,ResourceManageableAbstract,SanStorage,SimpleStorage,VmRam
An interface to represent a physical or virtual resource (like RAM, CPU or Bandwidth)
that doesn't provide direct features to change the allocated amount of resource.
Objects that directly implement this interface are supposed to define
the capacity and amount of allocated resource only in their constructors.
- Since:
- CloudSim Plus 1.0
- Author:
- Uros Cibej, Anthony Sulistio, Manoel Campos da Silva Filho
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the current total amount of allocated resource.longReturns the available amount of the resource that is free to be used.default doubleGets the current percentage of resource utilization.getUnit()default booleanisAmountAvailable(double amountToCheck) Checks if there is a specific amount of resource available (free), where such an amount is a double value that will be converted to long.booleanisAmountAvailable(long amountToCheck) Checks if there is a specific amount of resource available (free).default booleanisAmountAvailable(Resource resource) Checks if the capacity required by a given resource is available (free) at this resource.default booleanisFull()Checks if the resource is full or not.default booleanisSubClassOf(Class classWanted) Checks if this object is an instance of a given class.Methods inherited from interface org.cloudsimplus.resources.ResourceCapacity
getCapacity
-
Field Details
-
NULL
-
-
Method Details
-
isSubClassOf
Checks if this object is an instance of a given class.- Parameters:
classWanted- the class to verify if the object is an instance of- Returns:
- true if the object is an instance of the given class, false otherwise
-
getAvailableResource
long getAvailableResource()Returns the available amount of the resource that is free to be used. The data unit depends on the implementing classes.- Returns:
- the available amount of the resource that is free to be used
-
getAllocatedResource
long getAllocatedResource()Returns the current total amount of allocated resource. The data unit depends on the implementing classes, according to thegetUnit().- Returns:
- the current total amount of allocated resource
-
isAmountAvailable
Checks if the capacity required by a given resource is available (free) at this resource. This method is commonly used to check if there is a specific amount of resource free at a physical resource (this Resource instance) that is required by a virtualized resource (the given Resource).- Parameters:
resource- the resource to check if its capacity is available at the current resource- Returns:
- true if the capacity required by the given Resource is free; false otherwise
- See Also:
-
isAmountAvailable
default boolean isAmountAvailable(double amountToCheck) Checks if there is a specific amount of resource available (free), where such an amount is a double value that will be converted to long.This method is just a shorthand to avoid explicitly converting a double to long.
- Parameters:
amountToCheck- the amount of resource to check if is free. The data unit depends on the implementing classes, according to thegetUnit().- Returns:
- true if the specified amount is free; false otherwise
- See Also:
-
isAmountAvailable
boolean isAmountAvailable(long amountToCheck) Checks if there is a specific amount of resource available (free).- Parameters:
amountToCheck- the amount of resource to check if is free. The data unit depends on the implementing classes, according to thegetUnit().- Returns:
- true if the specified amount is free; false otherwise
- See Also:
-
getUnit
String getUnit()- Returns:
- the measurement unit of this resource.
-
isFull
default boolean isFull()Checks if the resource is full or not.- Returns:
- true if the storage is full, false otherwise
-
getPercentUtilization
default double getPercentUtilization()Gets the current percentage of resource utilization. It is the percentage of the total resource capacity that is currently allocated.- Returns:
- current resource utilization (allocation) percentage (in scale from 0 to 1)
-