Class WithPriority<T>
Object
WithPriority<T>
- Type Parameters:
T
- the element-type
- All Implemented Interfaces:
Comparable<WithPriority<T>>
Wraps an element of type
T
to ensure priority is given when the flag gpu==true
.
The priority exists via an ordering of elements, where elements with flag gpu==true
always precede those with gpu==false
.
- Author:
- Owen Feehan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
int
compareTo
(WithPriority<T> other) Orders so thatgpu==true
has higher priority in queue togpu==false
.boolean
get()
Gets the underlying element stored in the structure.int
hashCode()
boolean
isGPU()
Is the element returned byget()
associated with a GPU?
-
Constructor Details
-
WithPriority
Creates a newWithPriority
instance.- Parameters:
element
- The element to assign priority to.gpu
- Whether the element is associated with a GPU, in which case, it is given priority.
-
-
Method Details
-
get
Gets the underlying element stored in the structure.- Returns:
- the underlying element, ignoring any priority.
-
isGPU
public boolean isGPU()Is the element returned byget()
associated with a GPU?- Returns:
- true if it the element is associated with the GPU.
-
compareTo
Orders so thatgpu==true
has higher priority in queue togpu==false
.- Specified by:
compareTo
in interfaceComparable<T>
-
equals
-
canEqual
-
hashCode
public int hashCode()
-