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 booleanintcompareTo(WithPriority<T> other) Orders so thatgpu==truehas higher priority in queue togpu==false.booleanget()Gets the underlying element stored in the structure.inthashCode()booleanisGPU()Is the element returned byget()associated with a GPU?
-
Constructor Details
-
WithPriority
Creates a newWithPriorityinstance.- 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==truehas higher priority in queue togpu==false.- Specified by:
compareToin interfaceComparable<T>
-
equals
-
canEqual
-
hashCode
public int hashCode()
-