Package org.cloudbus.cloudsim.resources
Interface Resource
-
- All Superinterfaces:
ResourceCapacity
- All Known Subinterfaces:
FileStorage
,Pe
,ResourceManageable
- All Known Implementing Classes:
Bandwidth
,HarddriveStorage
,PeSimple
,Processor
,Ram
,ResourceAbstract
,ResourceManageableAbstract
,SanStorage
,Storage
public interface Resource extends ResourceCapacity
An interface to represent a physical or virtual resource (like RAM, CPU or Bandwidth) that doesn't provide direct features to change allocated amount of resource. Objects that directly implement this interface are supposed to define the capacity and amount of allocated resource in their constructors.- Since:
- CloudSim Plus 1.0
- Author:
- Uros Cibej, Anthony Sulistio, Manoel Campos da Silva Filho
-
-
Method Summary
Modifier and Type Method Description long
getAllocatedResource()
Gets the current total amount of allocated resource.long
getAvailableResource()
Gets the amount of the resource that is available (free).default double
getPercentUtilization()
Gets the current percentage of resource utilization in scale from 0 to 1.default boolean
isAmountAvailable(double amountToCheck)
Checks if there is a specific amount of resource available (free), where such amount is a double value that will be converted to long.boolean
isAmountAvailable(long amountToCheck)
Checks if there is a specific amount of resource available (free).default boolean
isAmountAvailable(Resource resource)
Checks if there the capacity required for the given resource is available (free) at this resource.default boolean
isFull()
Checks if the resource is full or not.default boolean
isObjectSubClassOf(java.lang.Class classWanted)
Checks if this object is instance of a given class.static boolean
isObjectSubClassOf(java.lang.Object object, java.lang.Class classWanted)
Checks if a given object is instance of a given class.-
Methods inherited from interface org.cloudbus.cloudsim.resources.ResourceCapacity
getCapacity
-
-
-
-
Method Detail
-
isObjectSubClassOf
static boolean isObjectSubClassOf(java.lang.Object object, java.lang.Class classWanted)
Checks if a given object is instance of a given class.- Parameters:
object
- the object to checkclassWanted
- the class to verify if the object is instance of- Returns:
- true if the object is instance of the given class, false otherwise
-
isObjectSubClassOf
default boolean isObjectSubClassOf(java.lang.Class classWanted)
Checks if this object is instance of a given class.- Parameters:
classWanted
- the class to verify if the object is instance of- Returns:
- true if the object is instance of the given class, false otherwise
-
getAvailableResource
long getAvailableResource()
Gets the amount of the resource that is available (free).- Returns:
- the amount of available resource
-
getAllocatedResource
long getAllocatedResource()
Gets the current total amount of allocated resource.- Returns:
- amount of allocated resource
-
isAmountAvailable
default boolean isAmountAvailable(Resource resource)
Checks if there the capacity required for the 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(long)
-
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.- Returns:
- true if the specified amount is free; false otherwise
-
isAmountAvailable
default boolean isAmountAvailable(double amountToCheck)
Checks if there is a specific amount of resource available (free), where such 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.- Returns:
- true if the specified amount is free; false otherwise
- See Also:
isAmountAvailable(long)
-
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 in scale from 0 to 1. 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
-
-