public class PrioritizableRunnable<T> extends Object implements Prioritizable<T>, Runnable
Modifier and Type | Field and Description |
---|---|
protected boolean |
dirty
Indicates if the relative timestamp has been
recently updated.
|
protected double |
relativeWaitingTime
realtive waiting time within a given context.
|
Constructor and Description |
---|
PrioritizableRunnable(Runnable runnable,
PriorityCalculator<T> calculator)
Creats the object and timestamps it.
|
Modifier and Type | Method and Description |
---|---|
double |
getPriority()
Returns the priority.
|
PriorityCalculator<T> |
getPriorityCalculator() |
double |
getRelativeWaitingTime()
Gets the relative waiting time
|
long |
getTimestamp()
Returns the timestamp.
|
boolean |
isDirty() |
void |
markDirty(boolean dirty)
marks this runnable as dirty so the priority should be recalculated
if necessary.
|
T |
prioritySource() |
void |
run() |
void |
setRelativeWaitingTime(com.google.common.base.Function<Long,Double> normalizer)
Uses the normaliser to set the relative waiting time of this
runnable and marks it as dirty
|
protected boolean dirty
protected double relativeWaitingTime
public PrioritizableRunnable(Runnable runnable, PriorityCalculator<T> calculator)
Object#PrioritizedRunnable()
public PriorityCalculator<T> getPriorityCalculator()
public long getTimestamp()
Prioritizable
getTimestamp
in interface Prioritizable<T>
public double getRelativeWaitingTime()
getRelativeWaitingTime
in interface Prioritizable<T>
public void markDirty(boolean dirty)
public boolean isDirty()
public void setRelativeWaitingTime(com.google.common.base.Function<Long,Double> normalizer)
public double getPriority()
Prioritizable
getPriority
in interface Prioritizable<T>
public T prioritySource()
prioritySource
in interface Prioritizable<T>
Copyright © 2010–2024 The DAISY Consortium. All rights reserved.