Top Description Inners Fields Constructors Methods
org.fxmisc.wellbehaved.event.internal

public abstract Class PrefixTree<K, V>

extends Object
Class Inheritance
Known Direct Subclasses
org.fxmisc.wellbehaved.event.internal.PrefixTree.Empty, org.fxmisc.wellbehaved.event.internal.PrefixTree.NonEmpty
Type Parameters
<K>
type of "strings" used to index values
<V>
type of values (data) indexed by this trie
Imports
java.util.AbstractMap.SimpleEntry, .ArrayList, .Arrays, .List, .Map, .Map.Entry, .Objects, java.util.function.BiFunction, .Function, java.util.stream.Stream

Prefix tree (Trie) with an additional property that no data is stored in internal nodes.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private static class
private abstract static class
public static interface

Field Summary

Modifier and TypeField and Description
pack-priv final PrefixTree.Ops<K, V>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static <K, V> PrefixTree<K, V>
empty(PrefixTree.Ops<K, V> ops)

public abstract Stream<Map.Entry<K, V>>
private static <A, B, C> BiFunction<B, A, C>
flip(BiFunction<A, B, C> f)

public abstract PrefixTree<K, V>
insert(K key, V value, BiFunction<? super V, ? super V, ? extends V> combine)

pack-priv abstract PrefixTree<K, V>
insertInside(K key, V value, BiFunction<? super V, ? super V, ? extends V> combine)

public abstract <W> PrefixTree<K, W>
map(Function<? super V, ? extends W> f, PrefixTree.Ops<K, W> ops)

public final PrefixTree<K, V>
map(Function<? super V, ? extends V> f)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

opsback to summary
pack-priv final PrefixTree.Ops<K, V> ops

Constructor Detail

PrefixTreeback to summary
private PrefixTree(PrefixTree.Ops<K, V> ops)

Method Detail

emptyback to summary
public static <K, V> PrefixTree<K, V> empty(PrefixTree.Ops<K, V> ops)
entriesback to summary
public abstract Stream<Map.Entry<K, V>> entries()
flipback to summary
private static <A, B, C> BiFunction<B, A, C> flip(BiFunction<A, B, C> f)
insertback to summary
public abstract PrefixTree<K, V> insert(K key, V value, BiFunction<? super V, ? super V, ? extends V> combine)
insertInsideback to summary
pack-priv abstract PrefixTree<K, V> insertInside(K key, V value, BiFunction<? super V, ? super V, ? extends V> combine)
mapback to summary
public abstract <W> PrefixTree<K, W> map(Function<? super V, ? extends W> f, PrefixTree.Ops<K, W> ops)
mapback to summary
public final PrefixTree<K, V> map(Function<? super V, ? extends V> f)
org.fxmisc.wellbehaved.event.internal back to summary

private Class PrefixTree.Branch<K, V>

extends PrefixTree.NonEmpty<K, V>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final K
private final List<PrefixTree.NonEmpty<K, V>>

Constructor Summary

AccessConstructor and Description
pack-priv
Branch(PrefixTree.Ops<K, V> ops, K prefix, List<PrefixTree.NonEmpty<K, V>> subTrees)

private
Branch(PrefixTree.Ops<K, V> ops, PrefixTree.NonEmpty<K, V> t1, PrefixTree.NonEmpty<K, V> t2)

Method Summary

Modifier and TypeMethod and Description
pack-priv PrefixTree.Data<K, V>
public Stream<Map.Entry<K, V>>
pack-priv K
pack-priv PrefixTree.NonEmpty<K, V>
insertInside(K key, V value, BiFunction<? super V, ? super V, ? extends V> combine)

Implements abstract org.fxmisc.wellbehaved.event.internal.PrefixTree.NonEmpty.insertInside.

public <W> PrefixTree.NonEmpty<K, W>
map(Function<? super V, ? extends W> f, PrefixTree.Ops<K, W> ops)

Implements abstract org.fxmisc.wellbehaved.event.internal.PrefixTree.NonEmpty.map.

private PrefixTree.Branch<K, V>
replaceBranch(int i, PrefixTree.NonEmpty<K, V> replacement)

Inherited from org.fxmisc.wellbehaved.event.internal.PrefixTree.NonEmpty:
insert

Field Detail

prefixback to summary
private final K prefix
subTreesback to summary
private final List<PrefixTree.NonEmpty<K, V>> subTrees

Constructor Detail

Branchback to summary
pack-priv Branch(PrefixTree.Ops<K, V> ops, K prefix, List<PrefixTree.NonEmpty<K, V>> subTrees)
Branchback to summary
private Branch(PrefixTree.Ops<K, V> ops, PrefixTree.NonEmpty<K, V> t1, PrefixTree.NonEmpty<K, V> t2)

Method Detail

collapseback to summary
pack-priv PrefixTree.Data<K, V> collapse()

Implements abstract org.fxmisc.wellbehaved.event.internal.PrefixTree.NonEmpty.collapse.

Annotations
@Override
entriesback to summary
public Stream<Map.Entry<K, V>> entries()

Implements abstract org.fxmisc.wellbehaved.event.internal.PrefixTree.entries.

Annotations
@Override
getPrefixback to summary
pack-priv K getPrefix()

Implements abstract org.fxmisc.wellbehaved.event.internal.PrefixTree.NonEmpty.getPrefix.

Annotations
@Override
insertInsideback to summary
pack-priv PrefixTree.NonEmpty<K, V> insertInside(K key, V value, BiFunction<? super V, ? super V, ? extends V> combine)

Implements abstract org.fxmisc.wellbehaved.event.internal.PrefixTree.NonEmpty.insertInside.

Annotations
@Override
mapback to summary
public <W> PrefixTree.NonEmpty<K, W> map(Function<? super V, ? extends W> f, PrefixTree.Ops<K, W> ops)

Implements abstract org.fxmisc.wellbehaved.event.internal.PrefixTree.NonEmpty.map.

Annotations
@Override
replaceBranchback to summary
private PrefixTree.Branch<K, V> replaceBranch(int i, PrefixTree.NonEmpty<K, V> replacement)
org.fxmisc.wellbehaved.event.internal back to summary

private Class PrefixTree.Data<K, V>

extends PrefixTree.NonEmpty<K, V>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final K
private final V

Constructor Summary

AccessConstructor and Description
pack-priv
Data(PrefixTree.Ops<K, V> ops, K key, V value)

Method Summary

Modifier and TypeMethod and Description
pack-priv PrefixTree.Data<K, V>
public Stream<Map.Entry<K, V>>
pack-priv K
pack-priv PrefixTree.NonEmpty<K, V>
insertInside(K key, V value, BiFunction<? super V, ? super V, ? extends V> combine)

Implements abstract org.fxmisc.wellbehaved.event.internal.PrefixTree.NonEmpty.insertInside.

pack-priv PrefixTree.NonEmpty<K, V>
insertInside(PrefixTree.NonEmpty<K, V> tree, BiFunction<? super V, ? super V, ? extends V> combine)

public <W> PrefixTree.Data<K, W>
map(Function<? super V, ? extends W> f, PrefixTree.Ops<K, W> ops)

Implements abstract org.fxmisc.wellbehaved.event.internal.PrefixTree.NonEmpty.map.

pack-priv PrefixTree.Data<K, V>
promote(K key)

pack-priv PrefixTree.Data<K, V>
squash(PrefixTree.Data<K, V> that)

Inherited from org.fxmisc.wellbehaved.event.internal.PrefixTree.NonEmpty:
insert

Field Detail

keyback to summary
private final K key
valueback to summary
private final V value

Constructor Detail

Databack to summary
pack-priv Data(PrefixTree.Ops<K, V> ops, K key, V value)

Method Detail

collapseback to summary
pack-priv PrefixTree.Data<K, V> collapse()

Implements abstract org.fxmisc.wellbehaved.event.internal.PrefixTree.NonEmpty.collapse.

Annotations
@Override
entriesback to summary
public Stream<Map.Entry<K, V>> entries()

Implements abstract org.fxmisc.wellbehaved.event.internal.PrefixTree.entries.

Annotations
@Override
getPrefixback to summary
pack-priv K getPrefix()

Implements abstract org.fxmisc.wellbehaved.event.internal.PrefixTree.NonEmpty.getPrefix.

Annotations
@Override
insertInsideback to summary
pack-priv PrefixTree.NonEmpty<K, V> insertInside(K key, V value, BiFunction<? super V, ? super V, ? extends V> combine)

Implements abstract org.fxmisc.wellbehaved.event.internal.PrefixTree.NonEmpty.insertInside.

Annotations
@Override
insertInsideback to summary
pack-priv PrefixTree.NonEmpty<K, V> insertInside(PrefixTree.NonEmpty<K, V> tree, BiFunction<? super V, ? super V, ? extends V> combine)
mapback to summary
public <W> PrefixTree.Data<K, W> map(Function<? super V, ? extends W> f, PrefixTree.Ops<K, W> ops)

Implements abstract org.fxmisc.wellbehaved.event.internal.PrefixTree.NonEmpty.map.

Annotations
@Override
promoteback to summary
pack-priv PrefixTree.Data<K, V> promote(K key)
squashback to summary
pack-priv PrefixTree.Data<K, V> squash(PrefixTree.Data<K, V> that)
org.fxmisc.wellbehaved.event.internal back to summary

private Class PrefixTree.Empty<K, V>

extends PrefixTree<K, V>
Class Inheritance

Field Summary

Inherited from org.fxmisc.wellbehaved.event.internal.PrefixTree:
ops

Constructor Summary

AccessConstructor and Description
public
Empty(PrefixTree.Ops<K, V> ops)

Method Summary

Modifier and TypeMethod and Description
public Stream<Map.Entry<K, V>>
public PrefixTree<K, V>
insert(K key, V value, BiFunction<? super V, ? super V, ? extends V> combine)

Implements abstract org.fxmisc.wellbehaved.event.internal.PrefixTree.insert.

pack-priv PrefixTree<K, V>
insertInside(K key, V value, BiFunction<? super V, ? super V, ? extends V> combine)

Implements abstract org.fxmisc.wellbehaved.event.internal.PrefixTree.insertInside.

public <W> PrefixTree<K, W>
map(Function<? super V, ? extends W> f, PrefixTree.Ops<K, W> ops)

Implements abstract org.fxmisc.wellbehaved.event.internal.PrefixTree.map.

Inherited from org.fxmisc.wellbehaved.event.internal.PrefixTree:
emptymap

Constructor Detail

Emptyback to summary
public Empty(PrefixTree.Ops<K, V> ops)

Method Detail

entriesback to summary
public Stream<Map.Entry<K, V>> entries()

Implements abstract org.fxmisc.wellbehaved.event.internal.PrefixTree.entries.

Annotations
@Override
insertback to summary
public PrefixTree<K, V> insert(K key, V value, BiFunction<? super V, ? super V, ? extends V> combine)

Implements abstract org.fxmisc.wellbehaved.event.internal.PrefixTree.insert.

Annotations
@Override
insertInsideback to summary
pack-priv PrefixTree<K, V> insertInside(K key, V value, BiFunction<? super V, ? super V, ? extends V> combine)

Implements abstract org.fxmisc.wellbehaved.event.internal.PrefixTree.insertInside.

Annotations
@Override
mapback to summary
public <W> PrefixTree<K, W> map(Function<? super V, ? extends W> f, PrefixTree.Ops<K, W> ops)

Implements abstract org.fxmisc.wellbehaved.event.internal.PrefixTree.map.

Annotations
@Override
org.fxmisc.wellbehaved.event.internal back to summary

private abstract Class PrefixTree.NonEmpty<K, V>

extends PrefixTree<K, V>
Class Inheritance
Known Direct Subclasses
org.fxmisc.wellbehaved.event.internal.PrefixTree.Branch, org.fxmisc.wellbehaved.event.internal.PrefixTree.Data

Field Summary

Inherited from org.fxmisc.wellbehaved.event.internal.PrefixTree:
ops

Constructor Summary

AccessConstructor and Description
public
NonEmpty(PrefixTree.Ops<K, V> ops)

Method Summary

Modifier and TypeMethod and Description
pack-priv abstract PrefixTree.Data<K, V>
pack-priv abstract K
public PrefixTree<K, V>
insert(K key, V value, BiFunction<? super V, ? super V, ? extends V> combine)

Implements abstract org.fxmisc.wellbehaved.event.internal.PrefixTree.insert.

pack-priv abstract PrefixTree.NonEmpty<K, V>
insertInside(K key, V value, BiFunction<? super V, ? super V, ? extends V> combine)

Implements abstract org.fxmisc.wellbehaved.event.internal.PrefixTree.insertInside.

public abstract <W> PrefixTree.NonEmpty<K, W>
map(Function<? super V, ? extends W> f, PrefixTree.Ops<K, W> ops)

Implements abstract org.fxmisc.wellbehaved.event.internal.PrefixTree.map.

Inherited from org.fxmisc.wellbehaved.event.internal.PrefixTree:
emptyentriesmap

Constructor Detail

NonEmptyback to summary
public NonEmpty(PrefixTree.Ops<K, V> ops)

Method Detail

collapseback to summary
pack-priv abstract PrefixTree.Data<K, V> collapse()
getPrefixback to summary
pack-priv abstract K getPrefix()
insertback to summary
public PrefixTree<K, V> insert(K key, V value, BiFunction<? super V, ? super V, ? extends V> combine)

Implements abstract org.fxmisc.wellbehaved.event.internal.PrefixTree.insert.

Annotations
@Override
insertInsideback to summary
pack-priv abstract PrefixTree.NonEmpty<K, V> insertInside(K key, V value, BiFunction<? super V, ? super V, ? extends V> combine)

Implements abstract org.fxmisc.wellbehaved.event.internal.PrefixTree.insertInside.

Annotations
@Override
mapback to summary
public abstract <W> PrefixTree.NonEmpty<K, W> map(Function<? super V, ? extends W> f, PrefixTree.Ops<K, W> ops)

Implements abstract org.fxmisc.wellbehaved.event.internal.PrefixTree.map.

Annotations
@Override
org.fxmisc.wellbehaved.event.internal back to summary

public Interface PrefixTree.Ops<K, V>


Method Summary

Modifier and TypeMethod and Description
public K
commonPrefix(K k1, K k2)

public boolean
isPrefixOf(K k1, K k2)

public V
promote(V v, K oldKey, K newKey)

public V
squash(V v1, V v2)

Method Detail

commonPrefixback to summary
public K commonPrefix(K k1, K k2)
isPrefixOfback to summary
public boolean isPrefixOf(K k1, K k2)
promoteback to summary
public V promote(V v, K oldKey, K newKey)
squashback to summary
public V squash(V v1, V v2)