Lines Matching refs:node
94 let node = RBTreeNode { in new() localVariable
102 NodePtr(Box::into_raw(Box::new(node))) in new()
274 let mut node = NodePtr::new((*self.0).key.clone(), (*self.0).value.clone()); in deep_clone() localVariable
276 node.set_left(self.left().deep_clone()); in deep_clone()
277 node.left().set_parent(node); in deep_clone()
280 node.set_right(self.right().deep_clone()); in deep_clone()
281 node.right().set_parent(node); in deep_clone()
283 node in deep_clone()
378 fn tree_print(&self, node: NodePtr<K, V>, direction: i32) { in tree_print()
379 if node.is_null() { in tree_print()
384 kdebug!("'{:?}' is root node", (*node.0)); in tree_print()
391 (*node.0), in tree_print()
392 *node.parent().0, in tree_print()
397 self.tree_print(node.left(), -1); in tree_print()
398 self.tree_print(node.right(), 1); in tree_print()
877 unsafe fn left_rotate(&mut self, mut node: NodePtr<K, V>) { in left_rotate()
878 let mut temp = node.right(); in left_rotate()
879 node.set_right(temp.left()); in left_rotate()
882 temp.left().set_parent(node.clone()); in left_rotate()
885 temp.set_parent(node.parent()); in left_rotate()
886 if node == self.root { in left_rotate()
888 } else if node == node.parent().left() { in left_rotate()
889 node.parent().set_left(temp.clone()); in left_rotate()
891 node.parent().set_right(temp.clone()); in left_rotate()
894 temp.set_left(node.clone()); in left_rotate()
895 node.set_parent(temp.clone()); in left_rotate()
912 unsafe fn right_rotate(&mut self, mut node: NodePtr<K, V>) { in right_rotate()
913 let mut temp = node.left(); in right_rotate()
914 node.set_left(temp.right()); in right_rotate()
917 temp.right().set_parent(node.clone()); in right_rotate()
920 temp.set_parent(node.parent()); in right_rotate()
921 if node == self.root { in right_rotate()
923 } else if node == node.parent().right() { in right_rotate()
924 node.parent().set_right(temp.clone()); in right_rotate()
926 node.parent().set_left(temp.clone()); in right_rotate()
929 temp.set_right(node.clone()); in right_rotate()
930 node.set_parent(temp.clone()); in right_rotate()
947 let node = self.find_node(&k); in replace_or_insert() localVariable
948 if node.is_null() { in replace_or_insert()
954 mem::swap(&mut v, &mut (*node.0).value); in replace_or_insert()
961 unsafe fn insert_fixup(&mut self, mut node: NodePtr<K, V>) { in insert_fixup()
965 while node.parent().is_red_color() { in insert_fixup()
966 parent = node.parent(); in insert_fixup()
976 node = gparent; in insert_fixup()
981 if parent.right() == node { in insert_fixup()
984 parent = node; in insert_fixup()
985 node = temp; in insert_fixup()
999 node = gparent; in insert_fixup()
1004 if parent.left() == node { in insert_fixup()
1007 parent = node; in insert_fixup()
1008 node = temp; in insert_fixup()
1023 let mut node = NodePtr::new(k, v); in insert() localVariable
1029 match node.cmp(&&mut x) { in insert()
1038 node.set_parent(y); in insert()
1041 self.root = node; in insert()
1043 match node.cmp(&&mut y) { in insert()
1045 y.set_left(node); in insert()
1048 y.set_right(node); in insert()
1053 node.set_red_color(); in insert()
1055 self.insert_fixup(node); in insert()
1163 let node = self.find_node(k); in get() localVariable
1164 if node.is_null() { in get()
1168 unsafe { Some(&(*node.0).value) } in get()
1173 let node = self.find_node(k); in get_mut() localVariable
1174 if node.is_null() { in get_mut()
1178 unsafe { Some(&mut (*node.0).value) } in get_mut()
1183 let node = self.find_node(k); in contains_key() localVariable
1184 if node.is_null() { in contains_key()
1216 let node = self.find_node(k); in remove() localVariable
1217 if node.is_null() { in remove()
1220 unsafe { Some(self.delete(node).1) } in remove()
1224 unsafe fn delete_fixup(&mut self, mut node: NodePtr<K, V>, mut parent: NodePtr<K, V>) { in delete_fixup()
1226 while node != self.root && node.is_black_color() { in delete_fixup()
1227 if parent.left() == node { in delete_fixup()
1240 node = parent; in delete_fixup()
1241 parent = node.parent(); in delete_fixup()
1255 node = self.root; in delete_fixup()
1271 node = parent; in delete_fixup()
1272 parent = node.parent(); in delete_fixup()
1286 node = self.root; in delete_fixup()
1292 node.set_black_color(); in delete_fixup()
1296 unsafe fn delete(&mut self, node: NodePtr<K, V>) -> (K, V) { in delete()
1303 if !node.left().is_null() && !node.right().is_null() { in delete()
1306 let mut replace = node.right().min_node(); in delete()
1307 if node == self.root { in delete()
1310 if node.parent().left() == node { in delete()
1311 node.parent().set_left(replace); in delete()
1313 node.parent().set_right(replace); in delete()
1322 if parent == node { in delete()
1329 replace.set_right(node.right()); in delete()
1330 node.right().set_parent(replace); in delete()
1333 replace.set_parent(node.parent()); in delete()
1334 replace.set_color(node.get_color()); in delete()
1335 replace.set_left(node.left()); in delete()
1336 node.left().set_parent(replace); in delete()
1342 let obj = Box::from_raw(node.0); in delete()
1346 if !node.left().is_null() { in delete()
1347 child = node.left(); in delete()
1349 child = node.right(); in delete()
1352 parent = node.parent(); in delete()
1353 color = node.get_color(); in delete()
1358 if self.root == node { in delete()
1361 if parent.left() == node { in delete()
1372 let obj = Box::from_raw(node.0); in delete()