net.groboclown.gui.paintpipe.v1
Class EventPooler

java.lang.Object
  |
  +--net.groboclown.gui.paintpipe.v1.EventPooler

public class EventPooler
extends Object

Posts events.

In order to be more efficient, the various events are pooled. The PainterThread.paint() method needs to modify these, and pass them to the queue. The pools are reused on a paintFinished event, created in the initialize() method, and cleaned up in the cleanup() method.

Note that the only non-pooled event is the FlushPaintingEvent. There is only one of these allocated.

Warning: this needs to be better documented.

Version:
1.0
Author:
Matt Albrecht

Field Summary
private  Class[] events
           
private  int len
           
private  int[] nextIndex
           
private  Vector[] pooledEvents
           
 
Constructor Summary
EventPooler(Class[] eventList)
           
 
Method Summary
 void cleanup()
           
 Object getNextEvent(int eventIndex)
           
 void initialize()
           
 void paintFinished()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

events

private Class[] events

nextIndex

private int[] nextIndex

pooledEvents

private Vector[] pooledEvents

len

private int len
Constructor Detail

EventPooler

public EventPooler(Class[] eventList)
Method Detail

getNextEvent

public Object getNextEvent(int eventIndex)

initialize

public void initialize()

paintFinished

public void paintFinished()

cleanup

public void cleanup()


Written under the LGPL