ICU 62.1 62.1
Public Member Functions | Static Public Member Functions | Protected Attributes
icu::StringTrieBuilder::Node Class Referenceabstract

#include <stringtriebuilder.h>

Inheritance diagram for icu::StringTrieBuilder::Node:
icu::UObject icu::UMemory icu::StringTrieBuilder::BranchNode icu::StringTrieBuilder::FinalValueNode icu::StringTrieBuilder::ValueNode icu::StringTrieBuilder::ListBranchNode icu::StringTrieBuilder::SplitBranchNode icu::StringTrieBuilder::BranchHeadNode icu::StringTrieBuilder::IntermediateValueNode icu::StringTrieBuilder::LinearMatchNode

Public Member Functions

 Node (int32_t initialHash)
 
int32_t hashCode () const
 
virtual UBool operator== (const Node &other) const
 
UBool operator!= (const Node &other) const
 
virtual int32_t markRightEdgesFirst (int32_t edgeNumber)
 Traverses the Node graph and numbers branch edges, with rightmost edges first.
 
virtual void write (StringTrieBuilder &builder)=0
 
void writeUnlessInsideRightEdge (int32_t firstRight, int32_t lastRight, StringTrieBuilder &builder)
 
int32_t getOffset () const
 
- Public Member Functions inherited from icu::UObject
virtual ~UObject ()
 Destructor.
 
virtual UClassID getDynamicClassID () const
 ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
 

Static Public Member Functions

static int32_t hashCode (const Node *node)
 

Protected Attributes

int32_t hash
 
int32_t offset
 

Detailed Description

Internal
Do not use. This API is for internal use only.

Definition at line 192 of file stringtriebuilder.h.

Constructor & Destructor Documentation

◆ Node()

icu::StringTrieBuilder::Node::Node ( int32_t initialHash)
inline

Definition at line 194 of file stringtriebuilder.h.

Member Function Documentation

◆ getOffset()

int32_t icu::StringTrieBuilder::Node::getOffset ( ) const
inline

Definition at line 243 of file stringtriebuilder.h.

◆ hashCode() [1/2]

int32_t icu::StringTrieBuilder::Node::hashCode ( ) const
inline

Definition at line 195 of file stringtriebuilder.h.

◆ hashCode() [2/2]

static int32_t icu::StringTrieBuilder::Node::hashCode ( const Node * node)
inlinestatic

Definition at line 197 of file stringtriebuilder.h.

◆ markRightEdgesFirst()

virtual int32_t icu::StringTrieBuilder::Node::markRightEdgesFirst ( int32_t edgeNumber)
virtual

Traverses the Node graph and numbers branch edges, with rightmost edges first.

This is to avoid writing a duplicate node twice.

Branch nodes in this trie data structure are not symmetric. Most branch edges "jump" to other nodes but the rightmost branch edges just continue without a jump. Therefore, write() must write the rightmost branch edge last (trie units are written backwards), and must write it at that point even if it is a duplicate of a node previously written elsewhere.

This function visits and marks right branch edges first. Edges are numbered with increasingly negative values because we share the offset field which gets positive values when nodes are written. A branch edge also remembers the first number for any of its edges.

When a further-left branch edge has a number in the range of the rightmost edge's numbers, then it will be written as part of the required right edge and we can avoid writing it first.

After root.markRightEdgesFirst(-1) the offsets of all nodes are negative edge numbers.

Parameters
edgeNumberThe first edge number for this node and its sub-nodes.
Returns
An edge number that is at least the maximum-negative of the input edge number and the numbers of this node and all of its sub-nodes.

Reimplemented in icu::StringTrieBuilder::IntermediateValueNode, icu::StringTrieBuilder::LinearMatchNode, icu::StringTrieBuilder::ListBranchNode, icu::StringTrieBuilder::SplitBranchNode, and icu::StringTrieBuilder::BranchHeadNode.

◆ operator!=()

UBool icu::StringTrieBuilder::Node::operator!= ( const Node & other) const
inline

Definition at line 200 of file stringtriebuilder.h.

◆ writeUnlessInsideRightEdge()

void icu::StringTrieBuilder::Node::writeUnlessInsideRightEdge ( int32_t firstRight,
int32_t lastRight,
StringTrieBuilder & builder )
inline

Definition at line 232 of file stringtriebuilder.h.

Field Documentation

◆ hash

int32_t icu::StringTrieBuilder::Node::hash
protected

Definition at line 245 of file stringtriebuilder.h.

◆ offset

int32_t icu::StringTrieBuilder::Node::offset
protected

Definition at line 246 of file stringtriebuilder.h.


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