[Overview][Classes][Index] | Reference for unit 'AVL_Tree' (#fcl)

# TAVLTree.ConsistencyCheck

Check the consistency of the tree

## Declaration

Source position: avl_tree.pp line 91

`public function TAVLTree.ConsistencyCheck: Integer;`

## Function result

0 if the tree is OK, a negative number if something is wrong.

## Description

ConsistencyCheck checks the correctness of the tree. It returns 0 if the tree is internally consistent, and a negative number if the tree contais an error somewhere.

-1
  The Count property doesn't match the actual node count
-2
  A left node does not point to the correct parent
-3
  A left node is larger than parent node
-4
  A right node does not point to the correct parent
-5
  A right node is less than parent node
-6
  The balance of a node is not calculated correctly

## See also

TAVLTree.WriteReportToStream |  | Write the contents of the tree consistency check to the stream

The latest version of this document can be found at lazarus-ccr.sourceforge.net.