Top Inners
io.vavr.collection

pack-priv Interface RedBlackTreeModule

Located in compilation unit of io.vavr.collection.RedBlackTree.


Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
RedBlackTreeModule.Empty<
Component type
T
>

The empty tree node.

public static class
RedBlackTreeModule.Node<
Component type
T
>

A non-empty tree node.

io.vavr.collection back to summary

public final Class RedBlackTreeModule.Empty<T>

extends Object
implements RedBlackTree<T>, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, io.vavr.collection.RedBlackTree, java.lang.Iterable
Type Parameters
<T>
Component type

The empty tree node. It can't be a singleton because it depends on a Comparator.

Field Summary

Modifier and TypeField and Description
pack-priv final Comparator<T>
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv
Empty(Comparator<? super T> comparator)

Method Summary

Modifier and TypeMethod and Description
public RedBlackTree.Color
color()

Implements io.vavr.collection.RedBlackTree.color.

Return the Color of this Red/Black Tree node.

public Comparator<T>
comparator()

Implements io.vavr.collection.RedBlackTree.comparator.

Returns the underlying java.util.Comparator of this RedBlackTree.

public boolean
contains(T
A value.
value
)

Implements io.vavr.collection.RedBlackTree.contains.

Checks, if this RedBlackTree contains the given value.

public RedBlackTreeModule.Empty<T>
emptyInstance()

Implements io.vavr.collection.RedBlackTree.emptyInstance.

Returns the empty instance of this RedBlackTree.

public Option<T>
find(T
A value
value
)

Implements io.vavr.collection.RedBlackTree.find.

Finds the value stored in this tree, if exists, by applying the underlying comparator to the tree elements and the given element.

public boolean
isEmpty()

Implements io.vavr.collection.RedBlackTree.isEmpty.

Checks if this RedBlackTree is empty, i.e. an instance of Leaf.

public RedBlackTree<T>
left()

Implements io.vavr.collection.RedBlackTree.left.

Returns the left child if this is a non-empty node, otherwise throws.

public RedBlackTree<T>
right()

Implements io.vavr.collection.RedBlackTree.right.

Returns the right child if this is a non-empty node, otherwise throws.

public int
size()

Implements io.vavr.collection.RedBlackTree.size.

Returns the size of this tree.

public String
toString()

Overrides java.lang.Object.toString.

Implements io.vavr.collection.RedBlackTree.toString.

Returns a Lisp like representation of this tree.

public T
value()

Implements io.vavr.collection.RedBlackTree.value.

Returns the value of the current tree node or throws if this is empty.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

comparatorback to summary
pack-priv final Comparator<T> comparator
Annotations
@SuppressWarnings:serial
serialVersionUIDback to summary
private static final long serialVersionUID

Hides io.vavr.collection.RedBlackTree.serialVersionUID.

Constructor Detail

Emptyback to summary
pack-priv Empty(Comparator<? super T> comparator)
Annotations
@SuppressWarnings:unchecked

Method Detail

colorback to summary
public RedBlackTree.Color color()

Implements io.vavr.collection.RedBlackTree.color.

Doc from io.vavr.collection.RedBlackTree.color.

Return the Color of this Red/Black Tree node.

An empty node is BLACK by definition.

Returns:RedBlackTree.Color

Either RED or BLACK.

Annotations
@Override
comparatorback to summary
public Comparator<T> comparator()

Implements io.vavr.collection.RedBlackTree.comparator.

Doc from io.vavr.collection.RedBlackTree.comparator.

Returns the underlying java.util.Comparator of this RedBlackTree.

Returns:Comparator<T>

The comparator.

Annotations
@Override
containsback to summary
public boolean contains(T value)

Implements io.vavr.collection.RedBlackTree.contains.

Doc from io.vavr.collection.RedBlackTree.contains.

Checks, if this RedBlackTree contains the given value.

Parameters
value:T

A value.

Returns:boolean

true, if this tree contains the value, false otherwise.

Annotations
@Override
emptyInstanceback to summary
public RedBlackTreeModule.Empty<T> emptyInstance()

Implements io.vavr.collection.RedBlackTree.emptyInstance.

Doc from io.vavr.collection.RedBlackTree.emptyInstance.

Returns the empty instance of this RedBlackTree.

Returns:RedBlackTreeModule.Empty<T>

An empty ReadBlackTree

Annotations
@Override
findback to summary
public Option<T> find(T value)

Implements io.vavr.collection.RedBlackTree.find.

Doc from io.vavr.collection.RedBlackTree.find.

Finds the value stored in this tree, if exists, by applying the underlying comparator to the tree elements and the given element.

Especially the value returned may differ from the given value, even if the underlying comparator states that both are equal.

Parameters
value:T

A value

Returns:Option<T>

Some value, if this tree contains a value equal to the given value according to the underlying comparator. Otherwise None.

Annotations
@Override
isEmptyback to summary
public boolean isEmpty()

Implements io.vavr.collection.RedBlackTree.isEmpty.

Doc from io.vavr.collection.RedBlackTree.isEmpty.

Checks if this RedBlackTree is empty, i.e. an instance of Leaf.

Returns:boolean

true, if it is empty, false otherwise.

Annotations
@Override
leftback to summary
public RedBlackTree<T> left()

Implements io.vavr.collection.RedBlackTree.left.

Doc from io.vavr.collection.RedBlackTree.left.

Returns the left child if this is a non-empty node, otherwise throws.

Returns:RedBlackTree<T>

The left child.

Annotations
@Override
rightback to summary
public RedBlackTree<T> right()

Implements io.vavr.collection.RedBlackTree.right.

Doc from io.vavr.collection.RedBlackTree.right.

Returns the right child if this is a non-empty node, otherwise throws.

Returns:RedBlackTree<T>

The right child.

Annotations
@Override
sizeback to summary
public int size()

Implements io.vavr.collection.RedBlackTree.size.

Doc from io.vavr.collection.RedBlackTree.size.

Returns the size of this tree.

Returns:int

the number of nodes of this tree and 0 if this is the empty tree

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Implements io.vavr.collection.RedBlackTree.toString.

Doc from io.vavr.collection.RedBlackTree.toString.

Returns a Lisp like representation of this tree.

Returns:String

This Tree as Lisp like String.

Annotations
@Override
valueback to summary
public T value()

Implements io.vavr.collection.RedBlackTree.value.

Doc from io.vavr.collection.RedBlackTree.value.

Returns the value of the current tree node or throws if this is empty.

Returns:T

The value.

Annotations
@Override
io.vavr.collection back to summary

public final Class RedBlackTreeModule.Node<T>

extends Object
implements RedBlackTree<T>, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, io.vavr.collection.RedBlackTree, java.lang.Iterable
Type Parameters
<T>
Component type

A non-empty tree node.

Field Summary

Modifier and TypeField and Description
pack-priv final int
pack-priv final RedBlackTree.Color
pack-priv final RedBlackTreeModule.Empty<T>
pack-priv final RedBlackTree<T>
pack-priv final RedBlackTree<T>
private static final long
pack-priv final int
pack-priv final T

Constructor Summary

AccessConstructor and Description
pack-priv
Node(RedBlackTree.Color color, int blackHeight, RedBlackTree<T> left, T value, RedBlackTree<T> right, RedBlackTreeModule.Empty<T> empty)

Method Summary

Modifier and TypeMethod and Description
private static <T> RedBlackTreeModule.Node<T>
balanceLeft(RedBlackTree.Color color, int blackHeight, RedBlackTree<T> left, T value, RedBlackTree<T> right, RedBlackTreeModule.Empty<T> empty)

private static <T> RedBlackTreeModule.Node<T>
balanceRight(RedBlackTree.Color color, int blackHeight, RedBlackTree<T> left, T value, RedBlackTree<T> right, RedBlackTreeModule.Empty<T> empty)

private static <T> Tuple2<? extends RedBlackTree<T>, Boolean>
public RedBlackTree.Color
color()

Implements io.vavr.collection.RedBlackTree.color.

Return the Color of this Red/Black Tree node.

pack-priv RedBlackTreeModule.Node<T>
pack-priv static <T> RedBlackTree<T>
public Comparator<T>
comparator()

Implements io.vavr.collection.RedBlackTree.comparator.

Returns the underlying java.util.Comparator of this RedBlackTree.

public boolean
contains(T
A value.
value
)

Implements io.vavr.collection.RedBlackTree.contains.

Checks, if this RedBlackTree contains the given value.

pack-priv static <T> Tuple2<? extends RedBlackTree<T>, Boolean>
delete(RedBlackTree<T> tree, T value)

private static <T> Tuple3<? extends RedBlackTree<T>, Boolean, T>
public RedBlackTreeModule.Empty<T>
emptyInstance()

Implements io.vavr.collection.RedBlackTree.emptyInstance.

Returns the empty instance of this RedBlackTree.

public Option<T>
find(T
A value
value
)

Implements io.vavr.collection.RedBlackTree.find.

Finds the value stored in this tree, if exists, by applying the underlying comparator to the tree elements and the given element.

pack-priv static <T> RedBlackTreeModule.Node<T>
insert(RedBlackTree<T> tree, T value)

public boolean
isEmpty()

Implements io.vavr.collection.RedBlackTree.isEmpty.

Checks if this RedBlackTree is empty, i.e. an instance of Leaf.

private boolean
private static boolean
pack-priv static <T> RedBlackTree<T>
join(RedBlackTree<T> t1, T value, RedBlackTree<T> t2)

private static <T> RedBlackTreeModule.Node<T>
joinGT(RedBlackTreeModule.Node<T> n1, T value, RedBlackTreeModule.Node<T> n2, int h2)

private static <T> RedBlackTreeModule.Node<T>
joinLT(RedBlackTreeModule.Node<T> n1, T value, RedBlackTreeModule.Node<T> n2, int h1)

public RedBlackTree<T>
left()

Implements io.vavr.collection.RedBlackTree.left.

Returns the left child if this is a non-empty node, otherwise throws.

pack-priv static <T> T
pack-priv static <T> RedBlackTree<T>
private static <T> RedBlackTreeModule.Node<T>
private static <T> RedBlackTreeModule.Node<T>
private static <T> RedBlackTreeModule.Node<T>
pack-priv static <T> T
public RedBlackTree<T>
right()

Implements io.vavr.collection.RedBlackTree.right.

Returns the right child if this is a non-empty node, otherwise throws.

public int
size()

Implements io.vavr.collection.RedBlackTree.size.

Returns the size of this tree.

pack-priv static <T> Tuple2<RedBlackTree<T>, RedBlackTree<T>>
split(RedBlackTree<T> tree, T value)

private static String
public String
toString()

Overrides java.lang.Object.toString.

Implements io.vavr.collection.RedBlackTree.toString.

Returns a Lisp like representation of this tree.

private static <T> Tuple2<RedBlackTreeModule.Node<T>, Boolean>
unbalancedLeft(RedBlackTree.Color color, int blackHeight, RedBlackTree<T> left, T value, RedBlackTree<T> right, RedBlackTreeModule.Empty<T> empty)

private static <T> Tuple2<RedBlackTreeModule.Node<T>, Boolean>
unbalancedRight(RedBlackTree.Color color, int blackHeight, RedBlackTree<T> left, T value, RedBlackTree<T> right, RedBlackTreeModule.Empty<T> empty)

public T
value()

Implements io.vavr.collection.RedBlackTree.value.

Returns the value of the current tree node or throws if this is empty.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

blackHeightback to summary
pack-priv final int blackHeight
colorback to summary
pack-priv final RedBlackTree.Color color
emptyback to summary
pack-priv final RedBlackTreeModule.Empty<T> empty
leftback to summary
pack-priv final RedBlackTree<T> left
rightback to summary
pack-priv final RedBlackTree<T> right
serialVersionUIDback to summary
private static final long serialVersionUID

Hides io.vavr.collection.RedBlackTree.serialVersionUID.

sizeback to summary
pack-priv final int size
valueback to summary
pack-priv final T value
Annotations
@SuppressWarnings:serial

Constructor Detail

Nodeback to summary
pack-priv Node(RedBlackTree.Color color, int blackHeight, RedBlackTree<T> left, T value, RedBlackTree<T> right, RedBlackTreeModule.Empty<T> empty)

Method Detail

balanceLeftback to summary
private static <T> RedBlackTreeModule.Node<T> balanceLeft(RedBlackTree.Color color, int blackHeight, RedBlackTree<T> left, T value, RedBlackTree<T> right, RedBlackTreeModule.Empty<T> empty)
balanceRightback to summary
private static <T> RedBlackTreeModule.Node<T> balanceRight(RedBlackTree.Color color, int blackHeight, RedBlackTree<T> left, T value, RedBlackTree<T> right, RedBlackTreeModule.Empty<T> empty)
blackifyback to summary
private static <T> Tuple2<? extends RedBlackTree<T>, Boolean> blackify(RedBlackTree<T> tree)
colorback to summary
public RedBlackTree.Color color()

Implements io.vavr.collection.RedBlackTree.color.

Doc from io.vavr.collection.RedBlackTree.color.

Return the Color of this Red/Black Tree node.

An empty node is BLACK by definition.

Returns:RedBlackTree.Color

Either RED or BLACK.

Annotations
@Override
colorback to summary
pack-priv RedBlackTreeModule.Node<T> color(RedBlackTree.Color color)
colorback to summary
pack-priv static <T> RedBlackTree<T> color(RedBlackTree<T> tree, RedBlackTree.Color color)
comparatorback to summary
public Comparator<T> comparator()

Implements io.vavr.collection.RedBlackTree.comparator.

Doc from io.vavr.collection.RedBlackTree.comparator.

Returns the underlying java.util.Comparator of this RedBlackTree.

Returns:Comparator<T>

The comparator.

Annotations
@Override
containsback to summary
public boolean contains(T value)

Implements io.vavr.collection.RedBlackTree.contains.

Doc from io.vavr.collection.RedBlackTree.contains.

Checks, if this RedBlackTree contains the given value.

Parameters
value:T

A value.

Returns:boolean

true, if this tree contains the value, false otherwise.

Annotations
@Override
deleteback to summary
pack-priv static <T> Tuple2<? extends RedBlackTree<T>, Boolean> delete(RedBlackTree<T> tree, T value)
deleteMinback to summary
private static <T> Tuple3<? extends RedBlackTree<T>, Boolean, T> deleteMin(RedBlackTreeModule.Node<T> node)
emptyInstanceback to summary
public RedBlackTreeModule.Empty<T> emptyInstance()

Implements io.vavr.collection.RedBlackTree.emptyInstance.

Doc from io.vavr.collection.RedBlackTree.emptyInstance.

Returns the empty instance of this RedBlackTree.

Returns:RedBlackTreeModule.Empty<T>

An empty ReadBlackTree

Annotations
@Override
findback to summary
public Option<T> find(T value)

Implements io.vavr.collection.RedBlackTree.find.

Doc from io.vavr.collection.RedBlackTree.find.

Finds the value stored in this tree, if exists, by applying the underlying comparator to the tree elements and the given element.

Especially the value returned may differ from the given value, even if the underlying comparator states that both are equal.

Parameters
value:T

A value

Returns:Option<T>

Some value, if this tree contains a value equal to the given value according to the underlying comparator. Otherwise None.

Annotations
@Override
insertback to summary
pack-priv static <T> RedBlackTreeModule.Node<T> insert(RedBlackTree<T> tree, T value)
isEmptyback to summary
public boolean isEmpty()

Implements io.vavr.collection.RedBlackTree.isEmpty.

Doc from io.vavr.collection.RedBlackTree.isEmpty.

Checks if this RedBlackTree is empty, i.e. an instance of Leaf.

Returns:boolean

true, if it is empty, false otherwise.

Annotations
@Override
isLeafback to summary
private boolean isLeaf()
isRedback to summary
private static boolean isRed(RedBlackTree<?> tree)
joinback to summary
pack-priv static <T> RedBlackTree<T> join(RedBlackTree<T> t1, T value, RedBlackTree<T> t2)
joinGTback to summary
private static <T> RedBlackTreeModule.Node<T> joinGT(RedBlackTreeModule.Node<T> n1, T value, RedBlackTreeModule.Node<T> n2, int h2)
joinLTback to summary
private static <T> RedBlackTreeModule.Node<T> joinLT(RedBlackTreeModule.Node<T> n1, T value, RedBlackTreeModule.Node<T> n2, int h1)
leftback to summary
public RedBlackTree<T> left()

Implements io.vavr.collection.RedBlackTree.left.

Doc from io.vavr.collection.RedBlackTree.left.

Returns the left child if this is a non-empty node, otherwise throws.

Returns:RedBlackTree<T>

The left child.

Annotations
@Override
maximumback to summary
pack-priv static <T> T maximum(RedBlackTreeModule.Node<T> node)
mergeback to summary
pack-priv static <T> RedBlackTree<T> merge(RedBlackTree<T> t1, RedBlackTree<T> t2)
mergeEQback to summary
private static <T> RedBlackTreeModule.Node<T> mergeEQ(RedBlackTreeModule.Node<T> n1, RedBlackTreeModule.Node<T> n2)
mergeGTback to summary
private static <T> RedBlackTreeModule.Node<T> mergeGT(RedBlackTreeModule.Node<T> n1, RedBlackTreeModule.Node<T> n2, int h2)
mergeLTback to summary
private static <T> RedBlackTreeModule.Node<T> mergeLT(RedBlackTreeModule.Node<T> n1, RedBlackTreeModule.Node<T> n2, int h1)
minimumback to summary
pack-priv static <T> T minimum(RedBlackTreeModule.Node<T> node)
rightback to summary
public RedBlackTree<T> right()

Implements io.vavr.collection.RedBlackTree.right.

Doc from io.vavr.collection.RedBlackTree.right.

Returns the right child if this is a non-empty node, otherwise throws.

Returns:RedBlackTree<T>

The right child.

Annotations
@Override
sizeback to summary
public int size()

Implements io.vavr.collection.RedBlackTree.size.

Doc from io.vavr.collection.RedBlackTree.size.

Returns the size of this tree.

Returns:int

the number of nodes of this tree and 0 if this is the empty tree

Annotations
@Override
splitback to summary
pack-priv static <T> Tuple2<RedBlackTree<T>, RedBlackTree<T>> split(RedBlackTree<T> tree, T value)
toLispStringback to summary
private static String toLispString(RedBlackTree<?> tree)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Implements io.vavr.collection.RedBlackTree.toString.

Doc from io.vavr.collection.RedBlackTree.toString.

Returns a Lisp like representation of this tree.

Returns:String

This Tree as Lisp like String.

Annotations
@Override
unbalancedLeftback to summary
private static <T> Tuple2<RedBlackTreeModule.Node<T>, Boolean> unbalancedLeft(RedBlackTree.Color color, int blackHeight, RedBlackTree<T> left, T value, RedBlackTree<T> right, RedBlackTreeModule.Empty<T> empty)
unbalancedRightback to summary
private static <T> Tuple2<RedBlackTreeModule.Node<T>, Boolean> unbalancedRight(RedBlackTree.Color color, int blackHeight, RedBlackTree<T> left, T value, RedBlackTree<T> right, RedBlackTreeModule.Empty<T> empty)
valueback to summary
public T value()

Implements io.vavr.collection.RedBlackTree.value.

Doc from io.vavr.collection.RedBlackTree.value.

Returns the value of the current tree node or throws if this is empty.

Returns:T

The value.

Annotations
@Override