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 Details

  • Constructor Details

    • ResourceAbstract

      public ResourceAbstract(long capacity, String unit)
  • Method Details

    • getCapacity

      public long getCapacity()
      Description copied from interface: ResourceCapacity
      Gets the total capacity of the resource.
      Specified by:
      getCapacity in interface ResourceCapacity
      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 interface Resource
      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 interface Resource
      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 interface Resource
      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

      public String getUnit()
      Description copied from interface: Resource
      Gets the measurement unit of this resource.
      Specified by:
      getUnit in interface Resource
      Returns: