org.apache.ignite.streamer.index.tree

## Class StreamerTreeIndexProvider<E,K,V>

- java.lang.Object
- - org.apache.ignite.streamer.index.StreamerIndexProviderAdapter<E,K,V>
  - - org.apache.ignite.streamer.index.tree.StreamerTreeIndexProvider<E,K,V>

All Implemented Interfaces:
  StreamerIndexProvider<E,K,V>, StreamerIndexProviderMBean

    public class StreamerTreeIndexProvider<E,K,V>
    extends StreamerIndexProviderAdapter<E,K,V>

Tree index implementation of a `StreamerIndexProvider`.

The advantage of a tree index is that it maintains entries in a sorted order, which is invaluable for many kinds of tasks, where event ordering makes sense (like `GridStreamingPopularNumbersExample`). The drawback is that the index entry values should be comparable to each other, and you'll are likely to need to implement a custom comparator for values in place of a default one.

If ordering is not required, consider using `StreamerHashIndexProvider` instead, which is more efficient (O(1) vs. O(log(n))) and does not require comparability.

See Also:
  `StreamerHashIndexProvider`

### Nested Class Summary

### Nested classes/interfaces inherited from class org.apache.ignite.streamer.index.StreamerIndexProviderAdapter

`StreamerIndexProviderAdapter.DedupTrackingEntry<E,K,V>, StreamerIndexProviderAdapter.Entry<E,K,V>, StreamerIndexProviderAdapter.EventTrackingEntry<E,K,V>, StreamerIndexProviderAdapter.IndexKey<V>, StreamerIndexProviderAdapter.NonTrackingEntry<E,K,V>`

### Field Summary

### Fields inherited from class org.apache.ignite.streamer.index.StreamerIndexProviderAdapter

`entryToKey, entryToVal`

### Constructor Summary

Constructors
Constructor and Description
`StreamerTreeIndexProvider()`

### Method Summary

Methods
`protected void` `add(E evt, K key, StreamerIndexUpdateSync sync)` Add event to the index.
`protected void` `endUpdate0(StreamerIndexUpdateSync sync, E evt, K key, boolean rollback)`
`protected StreamerIndex<E,K,V>` `index0()`
`void` `initialize()` Initializes the index.
`protected StreamerIndexProviderAdapter.IndexKey<V>` `nextKey(V val)`
`protected void` `remove(E evt, K key, StreamerIndexUpdateSync sync)` Remove event from the index.
`void` `reset0()` Called on reset.
`void` `setComparator(Comparator<V> cmp)` Sets comparator.
`boolean` `sorted()` Returns `true` if index supports sorting and therefore can perform range operations.

### Methods inherited from class org.apache.ignite.streamer.index.StreamerIndexProviderAdapter

`add, addEvent, addToCollection, addToMap, dispose, endUpdate, eventsCount, getName, getPolicy, getUpdater, index, isUnique, lockIndexKey, name, newEntry, policy, readLock, readUnlock, remove, removeEvent, removeFromCollection, removeFromMap, reset, setName, setPolicy, setUnique, setUpdater, size, toString, trieGet, unique, unlockIndexKey, updaterClass, writeLock, writeUnlock`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### StreamerTreeIndexProvider

    public StreamerTreeIndexProvider()

### Method Detail

#### setComparator

    public void setComparator(Comparator<V> cmp)

Sets comparator.

Parameters:
  `cmp` - Comparator.

#### index0

    protected StreamerIndex<E,K,V> index0()

Specified by:
  `index0` in class `StreamerIndexProviderAdapter<E,K,V>`
Returns:
  Index

#### initialize

    public void initialize()

Initializes the index.

#### reset0

    public void reset0()

Called on reset.

Specified by:
  `reset0` in class `StreamerIndexProviderAdapter<E,K,V>`

#### add

    protected void add(E evt,
           K key,
           StreamerIndexUpdateSync sync)

Add event to the index.

Specified by:
  `add` in class `StreamerIndexProviderAdapter<E,K,V>`
Parameters:
  `evt` - Event.
  `key` - key.
  `sync` - Sync.

#### remove

    protected void remove(E evt,
              K key,
              StreamerIndexUpdateSync sync)

Remove event from the index.

Specified by:
  `remove` in class `StreamerIndexProviderAdapter<E,K,V>`
Parameters:
  `evt` - Event.
  `key` - Key.
  `sync` - Sync.

#### endUpdate0

    protected void endUpdate0(StreamerIndexUpdateSync sync,
                  E evt,
                  K key,
                  boolean rollback)

Specified by:
  `endUpdate0` in class `StreamerIndexProviderAdapter<E,K,V>`
Parameters:
  `sync` - Sync.
  `evt` - Event.
  `key` - Key.
  `rollback` - Rollback flag.

#### nextKey

    protected StreamerIndexProviderAdapter.IndexKey<V> nextKey(V val)

Parameters:
  `val` - Value.
Returns:
  Index key.

#### sorted

    public boolean sorted()

Returns `true` if index supports sorting and therefore can perform range operations.

Returns:
  Index sorted flag.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.0.0-RC3
Release Date | : March 24 2015