Package org.cloudbus.cloudsim.resources
Class ResourceAbstract
java.lang.Object
org.cloudbus.cloudsim.resources.ResourceAbstract
- All Implemented Interfaces:
Resource
,ResourceCapacity
- Direct Known Subclasses:
ResourceManageableAbstract
An abstract implementation of a
Resource
.- Since:
- CloudSim Plus 1.2.0
- Author:
- Manoel Campos da Silva Filho
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
Gets the current total amount of allocated resource.long
Gets the total capacity of the resource.getUnit()
Gets the measurement unit of this resource.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).boolean
isResourceAmountBeingUsed
(long amountToCheck) boolean
isSuitable
(long newTotalAllocatedResource) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.cloudbus.cloudsim.resources.Resource
getAvailableResource, getPercentUtilization, isAmountAvailable, isFull, isSubClassOf
-
Field Details
-
capacity
protected long capacity- See Also:
-
-
Constructor Details
-
ResourceAbstract
-
-
Method Details
-
getCapacity
public long getCapacity()Description copied from interface:ResourceCapacity
Gets the total capacity of the resource.- Specified by:
getCapacity
in interfaceResourceCapacity
- Returns:
- the total resource capacity
-
getAllocatedResource
public long getAllocatedResource()Description copied from interface:Resource
Gets the current total amount of allocated resource.- Specified by:
getAllocatedResource
in interfaceResource
- Returns:
- amount of allocated resource
-
isAmountAvailable
public boolean isAmountAvailable(long amountToCheck) Description copied from interface:Resource
Checks if there is a specific amount of resource available (free).- Specified by:
isAmountAvailable
in interfaceResource
- Parameters:
amountToCheck
- the amount of resource to check if is free.- Returns:
- true if the specified amount is free; false otherwise
-
isAmountAvailable
public boolean isAmountAvailable(double amountToCheck) Description copied from interface:Resource
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.
- Specified by:
isAmountAvailable
in interfaceResource
- Parameters:
amountToCheck
- the amount of resource to check if is free.- Returns:
- true if the specified amount is free; false otherwise
- See Also:
-
isResourceAmountBeingUsed
public boolean isResourceAmountBeingUsed(long amountToCheck) -
isSuitable
public boolean isSuitable(long newTotalAllocatedResource) -
getUnit
Description copied from interface:Resource
Gets the measurement unit of this resource.
-