Package elki.visualization.svg
Class UpdateRunner
- java.lang.Object
-
- elki.visualization.svg.UpdateRunner
-
public class UpdateRunner extends java.lang.Object
Class to handle updates to an SVG plot, in particular when used in an Apache Batik UI.- Since:
- 0.3
- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.ConcurrentLinkedQueue<java.lang.Runnable>
queue
The queue of pending updatesprivate java.lang.Object
sync
Owner/Synchronization objectprivate UpdateSynchronizer
synchronizer
Synchronizer that can block events from being executed right away.
-
Constructor Summary
Constructors Modifier Constructor Description protected
UpdateRunner(java.lang.Object sync)
Construct a new update handler
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clear queue.void
invokeLater(java.lang.Runnable r)
Add a new update to run at any appropriate time.boolean
isEmpty()
Check whether the queue is empty.void
runQueue()
Run the processing queue now.void
synchronizeWith(UpdateSynchronizer newsync)
Set a new update synchronizer.void
unsynchronizeWith(UpdateSynchronizer oldsync)
Remove an update synchronizer
-
-
-
Field Detail
-
sync
private java.lang.Object sync
Owner/Synchronization object
-
queue
private final java.util.concurrent.ConcurrentLinkedQueue<java.lang.Runnable> queue
The queue of pending updates
-
synchronizer
private UpdateSynchronizer synchronizer
Synchronizer that can block events from being executed right away.
-
-
Method Detail
-
invokeLater
public void invokeLater(java.lang.Runnable r)
Add a new update to run at any appropriate time.- Parameters:
r
- New runnable to perform the update
-
runQueue
public void runQueue()
Run the processing queue now. This should usually be only invoked by the UpdateSynchronizer
-
clear
public void clear()
Clear queue. For shutdown!
-
isEmpty
public boolean isEmpty()
Check whether the queue is empty.- Returns:
- queue status
-
synchronizeWith
public void synchronizeWith(UpdateSynchronizer newsync)
Set a new update synchronizer.- Parameters:
newsync
- Update synchronizer
-
unsynchronizeWith
public void unsynchronizeWith(UpdateSynchronizer oldsync)
Remove an update synchronizer- Parameters:
oldsync
- Update synchronizer to remove
-
-