Package org.cloudbus.cloudsim.resources
Class ResourceAbstract
java.lang.Object
org.cloudbus.cloudsim.resources.ResourceAbstract
- All Implemented Interfaces:
Resource
,ResourceCapacity
- Direct Known Subclasses:
ResourceManageableAbstract
public abstract class ResourceAbstract extends Object implements Resource
An abstract implementation of a
Resource
.- Since:
- CloudSim Plus 1.2.0
- Author:
- Manoel Campos da Silva Filho
-
Field Summary
Fields Modifier and Type Field Description protected long
capacity
-
Constructor Summary
Constructors Constructor Description ResourceAbstract(long capacity)
-
Method Summary
Modifier and Type Method Description long
getAllocatedResource()
Gets the current total amount of allocated resource.long
getCapacity()
Gets the total capacity of the 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:
getCapacity()
-
-
Constructor Details
-
ResourceAbstract
public ResourceAbstract(long capacity)
-
-
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:
Resource.isAmountAvailable(long)
-
isResourceAmountBeingUsed
public boolean isResourceAmountBeingUsed(long amountToCheck) -
isSuitable
public boolean isSuitable(long newTotalAllocatedResource)
-