public final class EventDispatchTreeImpl extends java.lang.Object implements EventDispatchTree
| Modifier and Type | Field and Description |
|---|---|
private static int |
CAPACITY_GROWTH_FACTOR
Must be a power of two.
|
private EventDispatcher[] |
dispatchers |
private boolean |
expandTailFirstPath |
private int[] |
nextChildren |
private int[] |
nextSiblings |
private static int |
NULL_INDEX |
private int |
reservedCount |
private int |
rootIndex |
private int |
tailFirstIndex |
private int |
tailLastIndex |
| Constructor and Description |
|---|
EventDispatchTreeImpl() |
| Modifier and Type | Method and Description |
|---|---|
EventDispatchTree |
append(EventDispatcher eventDispatcher)
Appends the specified
EventDispatcher to this chain. |
private void |
appendSubtree(java.lang.StringBuilder sb,
int index) |
private void |
appendTreeLevel(java.lang.StringBuilder sb,
int levelIndex) |
private int |
copySubtree(EventDispatchTreeImpl srcTree,
int srcIndex) |
private int |
copyTreeLevel(EventDispatchTreeImpl srcTree,
int srcLevelIndex) |
EventDispatchTree |
createTree() |
Event |
dispatchEvent(Event event)
Dispatches the specified event through this
EventDispatchChain. |
private void |
ensureCapacity(int size) |
private void |
expandTail(int levelIndex) |
private static int |
getChildIndex(EventDispatchTreeImpl tree,
int index) |
EventDispatchTree |
mergeTree(EventDispatchTree tree) |
private void |
mergeTreeLevel(EventDispatchTreeImpl srcTree,
int dstLevelIndex,
int srcLevelIndex) |
EventDispatchTree |
prepend(EventDispatcher eventDispatcher)
Prepends the specified
EventDispatcher to this chain. |
void |
reset() |
java.lang.String |
toString() |
private static final int CAPACITY_GROWTH_FACTOR
private static final int NULL_INDEX
private EventDispatcher[] dispatchers
private int[] nextChildren
private int[] nextSiblings
private int reservedCount
private int rootIndex
private int tailFirstIndex
private int tailLastIndex
private boolean expandTailFirstPath
public void reset()
public EventDispatchTree createTree()
createTree in interface EventDispatchTreepublic EventDispatchTree mergeTree(EventDispatchTree tree)
mergeTree in interface EventDispatchTreepublic EventDispatchTree append(EventDispatcher eventDispatcher)
EventDispatchChainEventDispatcher to this chain. Returns a
reference to the chain with the appended element.
The caller shouldn't assume that this EventDispatchChain remains
unchanged nor that the returned value will reference a different chain
after the call. All this depends on the EventDispatchChain
implementation.
So the call should be always done in the following form:
chain = chain.append(eventDispatcher);
append in interface EventDispatchTreeappend in interface EventDispatchChaineventDispatcher - the EventDispatcher to append to the
chainpublic EventDispatchTree prepend(EventDispatcher eventDispatcher)
EventDispatchChainEventDispatcher to this chain. Returns a
reference to the chain with the prepended element.
The caller shouldn't assume that this EventDispatchChain remains
unchanged nor that the returned value will reference a different chain
after the call. All this depends on the EventDispatchChain
implementation.
So the call should be always done in the following form:
chain = chain.prepend(eventDispatcher);
prepend in interface EventDispatchTreeprepend in interface EventDispatchChaineventDispatcher - the EventDispatcher to prepend to the
chainpublic Event dispatchEvent(Event event)
EventDispatchChainEventDispatchChain.
The return value represents the event after processing done by the chain.
If further processing is to be done after the call the event referenced
by the return value should be used instead of the original event. In the
case the event is fully handled / consumed in the chain the returned
value is null and no further processing should be done with that
event.dispatchEvent in interface EventDispatchChainevent - the event to dispatchnull if the event had been fully
handled / consumedpublic java.lang.String toString()
toString in class java.lang.Objectprivate void ensureCapacity(int size)
private void expandTail(int levelIndex)
private void mergeTreeLevel(EventDispatchTreeImpl srcTree, int dstLevelIndex, int srcLevelIndex)
private int copyTreeLevel(EventDispatchTreeImpl srcTree, int srcLevelIndex)
private int copySubtree(EventDispatchTreeImpl srcTree, int srcIndex)
private void appendTreeLevel(java.lang.StringBuilder sb,
int levelIndex)
private void appendSubtree(java.lang.StringBuilder sb,
int index)
private static int getChildIndex(EventDispatchTreeImpl tree, int index)