Lines Matching refs:balance
91 gint8 balance; /* height (right) - height (left) */ member
124 node->balance = 0; in q_tree_node_new()
592 node->balance -= 1; in q_tree_insert_internal()
610 node->balance += 1; in q_tree_insert_internal()
630 if (node->balance < -1 || node->balance > 1) { in q_tree_insert_internal()
641 if (node->balance == 0 || bparent == NULL) { in q_tree_insert_internal()
646 bparent->balance -= 1; in q_tree_insert_internal()
648 bparent->balance += 1; in q_tree_insert_internal()
729 QTreeNode *node, *parent, *balance; in q_tree_remove_internal() local
770 balance = parent = path[--idx]; in q_tree_remove_internal()
781 parent->balance += 1; in q_tree_remove_internal()
785 parent->balance -= 1; in q_tree_remove_internal()
796 parent->balance += 1; in q_tree_remove_internal()
799 parent->balance -= 1; in q_tree_remove_internal()
812 parent->balance += 1; in q_tree_remove_internal()
815 parent->balance -= 1; in q_tree_remove_internal()
833 balance = path[idx]; in q_tree_remove_internal()
842 nextp->balance += 1; in q_tree_remove_internal()
847 node->balance -= 1; in q_tree_remove_internal()
859 next->balance = node->balance; in q_tree_remove_internal()
872 if (balance) { in q_tree_remove_internal()
876 bparent->left == balance || in q_tree_remove_internal()
877 bparent->right == balance); in q_tree_remove_internal()
878 left_node = (bparent && balance == bparent->left); in q_tree_remove_internal()
880 if (balance->balance < -1 || balance->balance > 1) { in q_tree_remove_internal()
881 balance = q_tree_node_balance(balance); in q_tree_remove_internal()
883 tree->root = balance; in q_tree_remove_internal()
885 bparent->left = balance; in q_tree_remove_internal()
887 bparent->right = balance; in q_tree_remove_internal()
891 if (balance->balance != 0 || !bparent) { in q_tree_remove_internal()
896 bparent->balance += 1; in q_tree_remove_internal()
898 bparent->balance -= 1; in q_tree_remove_internal()
901 balance = bparent; in q_tree_remove_internal()
1141 height += 1 + MAX(node->balance, 0); in q_tree_height()
1170 if (node->balance < -1) { in q_tree_node_balance()
1171 if (node->left->balance > 0) { in q_tree_node_balance()
1175 } else if (node->balance > 1) { in q_tree_node_balance()
1176 if (node->right->balance < 0) { in q_tree_node_balance()
1265 a_bal = node->balance; in q_tree_node_rotate_left()
1266 b_bal = right->balance; in q_tree_node_rotate_left()
1270 right->balance = b_bal - 1; in q_tree_node_rotate_left()
1272 right->balance = a_bal + b_bal - 2; in q_tree_node_rotate_left()
1274 node->balance = a_bal - 1; in q_tree_node_rotate_left()
1277 right->balance = a_bal - 2; in q_tree_node_rotate_left()
1279 right->balance = b_bal - 1; in q_tree_node_rotate_left()
1281 node->balance = a_bal - b_bal - 1; in q_tree_node_rotate_left()
1304 a_bal = node->balance; in q_tree_node_rotate_right()
1305 b_bal = left->balance; in q_tree_node_rotate_right()
1309 left->balance = b_bal + 1; in q_tree_node_rotate_right()
1311 left->balance = a_bal + 2; in q_tree_node_rotate_right()
1313 node->balance = a_bal - b_bal + 1; in q_tree_node_rotate_right()
1316 left->balance = b_bal + 1; in q_tree_node_rotate_right()
1318 left->balance = a_bal + b_bal + 2; in q_tree_node_rotate_right()
1320 node->balance = a_bal + 1; in q_tree_node_rotate_right()
1355 gint balance; in q_tree_node_check() local
1379 balance = right_height - left_height; in q_tree_node_check()
1380 g_assert(balance == node->balance); in q_tree_node_check()