public interface Resource extends ResourceCapacity
Modifier and Type | Field and Description |
---|---|
static Resource |
NULL
An attribute that implements the Null Object Design Pattern for
Resource
objects. |
Modifier and Type | Method and 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.
|
String |
getUnit()
Gets the measurement unit of this resource.
|
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 |
isSubClassOf(Class classWanted)
Checks if this object is instance of a given class.
|
getCapacity
default boolean isSubClassOf(Class classWanted)
classWanted
- the class to verify if the object is instance oflong getAvailableResource()
long getAllocatedResource()
default boolean isAmountAvailable(Resource resource)
resource
- the resource to check if its capacity is available at the current resourceisAmountAvailable(long)
boolean isAmountAvailable(long amountToCheck)
amountToCheck
- the amount of resource to check if is free.String getUnit()
default boolean isAmountAvailable(double amountToCheck)
This method is just a shorthand to avoid explicitly converting a double to long.
amountToCheck
- the amount of resource to check if is free.isAmountAvailable(long)
default boolean isFull()
default double getPercentUtilization()
Copyright © 2015–2021 Systems, Security and Image Communication Lab - Instituto de Telecomunicações (IT) - Universidade da Beira Interior (UBI) - Instituto Federal de Educação Ciência e Tecnologia do Tocantins (IFTO). All rights reserved.