LLVM 19.0.0git
Public Types | Public Member Functions | Friends | List of all members
llvm::ImutAVLTree< ImutInfo > Class Template Reference

#include "llvm/ADT/ImmutableSet.h"

Public Types

using key_type_ref = typename ImutInfo::key_type_ref
 
using value_type = typename ImutInfo::value_type
 
using value_type_ref = typename ImutInfo::value_type_ref
 
using Factory = ImutAVLFactory< ImutInfo >
 
using iterator = ImutAVLTreeInOrderIterator< ImutInfo >
 

Public Member Functions

ImutAVLTreegetLeft () const
 Return a pointer to the left subtree.
 
ImutAVLTreegetRight () const
 Return a pointer to the right subtree.
 
unsigned getHeight () const
 getHeight - Returns the height of the tree.
 
const value_typegetValue () const
 getValue - Returns the data value associated with the tree node.
 
ImutAVLTreefind (key_type_ref K)
 find - Finds the subtree associated with the specified key value.
 
ImutAVLTreegetMaxElement ()
 getMaxElement - Find the subtree associated with the highest ranged key value.
 
unsigned size () const
 size - Returns the number of nodes in the tree, which includes both leaves and non-leaf nodes.
 
iterator begin () const
 begin - Returns an iterator that iterates over the nodes of the tree in an inorder traversal.
 
iterator end () const
 end - Returns an iterator for the tree that denotes the end of an inorder traversal.
 
bool isElementEqual (value_type_ref V) const
 
bool isElementEqual (const ImutAVLTree *RHS) const
 
bool isEqual (const ImutAVLTree &RHS) const
 isEqual - Compares two trees for structural equality and returns true if they are equal.
 
bool isNotEqual (const ImutAVLTree &RHS) const
 isNotEqual - Compares two trees for structural inequality.
 
bool contains (key_type_ref K)
 contains - Returns true if this tree contains a subtree (node) that has an data element that matches the specified key.
 
unsigned validateTree () const
 validateTree - A utility method that checks that the balancing and ordering invariants of the tree are satisfied.
 
void retain ()
 
void release ()
 
void destroy ()
 

Friends

class ImutAVLFactory< ImutInfo >
 
class ImutIntervalAVLFactory< ImutInfo >
 
class ImutAVLTreeGenericIterator< ImutInfo >
 

Detailed Description

template<typename ImutInfo>
class llvm::ImutAVLTree< ImutInfo >

Definition at line 43 of file ImmutableSet.h.

Member Typedef Documentation

◆ Factory

template<typename ImutInfo >
using llvm::ImutAVLTree< ImutInfo >::Factory = ImutAVLFactory<ImutInfo>

Definition at line 48 of file ImmutableSet.h.

◆ iterator

template<typename ImutInfo >
using llvm::ImutAVLTree< ImutInfo >::iterator = ImutAVLTreeInOrderIterator<ImutInfo>

Definition at line 49 of file ImmutableSet.h.

◆ key_type_ref

template<typename ImutInfo >
using llvm::ImutAVLTree< ImutInfo >::key_type_ref = typename ImutInfo::key_type_ref

Definition at line 45 of file ImmutableSet.h.

◆ value_type

template<typename ImutInfo >
using llvm::ImutAVLTree< ImutInfo >::value_type = typename ImutInfo::value_type

Definition at line 46 of file ImmutableSet.h.

◆ value_type_ref

template<typename ImutInfo >
using llvm::ImutAVLTree< ImutInfo >::value_type_ref = typename ImutInfo::value_type_ref

Definition at line 47 of file ImmutableSet.h.

Member Function Documentation

◆ begin()

template<typename ImutInfo >
iterator llvm::ImutAVLTree< ImutInfo >::begin ( ) const
inline

begin - Returns an iterator that iterates over the nodes of the tree in an inorder traversal.

The returned iterator thus refers to the the tree node with the minimum data element.

Definition at line 113 of file ImmutableSet.h.

Referenced by llvm::ImutAVLTree< ImutInfo >::isEqual().

◆ contains()

template<typename ImutInfo >
bool llvm::ImutAVLTree< ImutInfo >::contains ( key_type_ref  K)
inline

contains - Returns true if this tree contains a subtree (node) that has an data element that matches the specified key.

Complexity is logarithmic in the size of the tree.

Definition at line 171 of file ImmutableSet.h.

References llvm::ImutAVLTree< ImutInfo >::find().

◆ destroy()

template<typename ImutInfo >
void llvm::ImutAVLTree< ImutInfo >::destroy ( )
inline

◆ end()

template<typename ImutInfo >
iterator llvm::ImutAVLTree< ImutInfo >::end ( ) const
inline

end - Returns an iterator for the tree that denotes the end of an inorder traversal.

Definition at line 117 of file ImmutableSet.h.

Referenced by llvm::ImutAVLTree< ImutInfo >::isEqual().

◆ find()

template<typename ImutInfo >
ImutAVLTree * llvm::ImutAVLTree< ImutInfo >::find ( key_type_ref  K)
inline

find - Finds the subtree associated with the specified key value.

This method returns NULL if no matching subtree is found.

Definition at line 76 of file ImmutableSet.h.

References T.

Referenced by llvm::ImutAVLTree< ImutInfo >::contains().

◆ getHeight()

template<typename ImutInfo >
unsigned llvm::ImutAVLTree< ImutInfo >::getHeight ( ) const
inline

getHeight - Returns the height of the tree.

A tree with no subtrees has a height of 1.

Definition at line 69 of file ImmutableSet.h.

Referenced by llvm::ImutAVLTree< ImutInfo >::validateTree().

◆ getLeft()

template<typename ImutInfo >
ImutAVLTree * llvm::ImutAVLTree< ImutInfo >::getLeft ( ) const
inline

Return a pointer to the left subtree.

This value is NULL if there is no left subtree.

Definition at line 61 of file ImmutableSet.h.

Referenced by llvm::ImutAVLTreeGenericIterator< ImutInfo >::operator++(), llvm::ImutAVLTreeGenericIterator< ImutInfo >::operator--(), llvm::ImutAVLTree< ImutInfo >::size(), and llvm::ImutAVLTree< ImutInfo >::validateTree().

◆ getMaxElement()

template<typename ImutInfo >
ImutAVLTree * llvm::ImutAVLTree< ImutInfo >::getMaxElement ( )
inline

getMaxElement - Find the subtree associated with the highest ranged key value.

Definition at line 92 of file ImmutableSet.h.

References llvm::Right, and T.

◆ getRight()

template<typename ImutInfo >
ImutAVLTree * llvm::ImutAVLTree< ImutInfo >::getRight ( ) const
inline

Return a pointer to the right subtree.

This value is NULL if there is no right subtree.

Definition at line 65 of file ImmutableSet.h.

Referenced by llvm::ImutAVLTreeGenericIterator< ImutInfo >::operator++(), llvm::ImutAVLTreeGenericIterator< ImutInfo >::operator--(), llvm::ImutAVLTree< ImutInfo >::size(), and llvm::ImutAVLTree< ImutInfo >::validateTree().

◆ getValue()

template<typename ImutInfo >
const value_type & llvm::ImutAVLTree< ImutInfo >::getValue ( ) const
inline

getValue - Returns the data value associated with the tree node.

Definition at line 72 of file ImmutableSet.h.

References value.

Referenced by llvm::ImutAVLTree< ImutInfo >::isElementEqual(), and llvm::ImutAVLTree< ImutInfo >::validateTree().

◆ isElementEqual() [1/2]

template<typename ImutInfo >
bool llvm::ImutAVLTree< ImutInfo >::isElementEqual ( const ImutAVLTree< ImutInfo > *  RHS) const
inline

Definition at line 133 of file ImmutableSet.h.

References llvm::ImutAVLTree< ImutInfo >::isElementEqual(), and RHS.

◆ isElementEqual() [2/2]

template<typename ImutInfo >
bool llvm::ImutAVLTree< ImutInfo >::isElementEqual ( value_type_ref  V) const
inline

◆ isEqual()

template<typename ImutInfo >
bool llvm::ImutAVLTree< ImutInfo >::isEqual ( const ImutAVLTree< ImutInfo > &  RHS) const
inline

isEqual - Compares two trees for structural equality and returns true if they are equal.

This worst case performance of this operation is

Definition at line 140 of file ImmutableSet.h.

References llvm::ImutAVLTree< ImutInfo >::begin(), llvm::ImutAVLTree< ImutInfo >::end(), llvm::ImutAVLTree< ImutInfo >::isElementEqual(), RHS, and llvm::ImutAVLTreeInOrderIterator< ImutInfo >::skipSubTree().

Referenced by llvm::ImutAVLTree< ImutInfo >::isNotEqual().

◆ isNotEqual()

template<typename ImutInfo >
bool llvm::ImutAVLTree< ImutInfo >::isNotEqual ( const ImutAVLTree< ImutInfo > &  RHS) const
inline

isNotEqual - Compares two trees for structural inequality.

Performance is the same is isEqual.

Definition at line 166 of file ImmutableSet.h.

References llvm::ImutAVLTree< ImutInfo >::isEqual(), and RHS.

◆ release()

template<typename ImutInfo >
void llvm::ImutAVLTree< ImutInfo >::release ( )
inline

◆ retain()

template<typename ImutInfo >
void llvm::ImutAVLTree< ImutInfo >::retain ( )
inline

◆ size()

template<typename ImutInfo >
unsigned llvm::ImutAVLTree< ImutInfo >::size ( ) const
inline

size - Returns the number of nodes in the tree, which includes both leaves and non-leaf nodes.

Definition at line 101 of file ImmutableSet.h.

References llvm::ImutAVLTree< ImutInfo >::getLeft(), and llvm::ImutAVLTree< ImutInfo >::getRight().

◆ validateTree()

template<typename ImutInfo >
unsigned llvm::ImutAVLTree< ImutInfo >::validateTree ( ) const
inline

validateTree - A utility method that checks that the balancing and ordering invariants of the tree are satisfied.

It is a recursive method that returns the height of the tree, which is then consumed by the enclosing validateTree call. External callers should ignore the return value. An invalid tree will cause an assertion to fire in a debug build.

Definition at line 179 of file ImmutableSet.h.

References assert(), llvm::ImutAVLTree< ImutInfo >::getHeight(), llvm::ImutAVLTree< ImutInfo >::getLeft(), llvm::ImutAVLTree< ImutInfo >::getRight(), llvm::ImutAVLTree< ImutInfo >::getValue(), and llvm::ImutAVLTree< ImutInfo >::validateTree().

Referenced by llvm::ImutAVLTree< ImutInfo >::validateTree().

Friends And Related Function Documentation

◆ ImutAVLFactory< ImutInfo >

template<typename ImutInfo >
friend class ImutAVLFactory< ImutInfo >
friend

Definition at line 1 of file ImmutableSet.h.

◆ ImutAVLTreeGenericIterator< ImutInfo >

template<typename ImutInfo >
friend class ImutAVLTreeGenericIterator< ImutInfo >
friend

Definition at line 1 of file ImmutableSet.h.

◆ ImutIntervalAVLFactory< ImutInfo >

template<typename ImutInfo >
friend class ImutIntervalAVLFactory< ImutInfo >
friend

Definition at line 1 of file ImmutableSet.h.


The documentation for this class was generated from the following file: