Class: ConsistentCluster::RedBlackTree::Node::EmptyNode

Inherits:
ConsistentCluster::RedBlackTree::Node show all
Defined in:
lib/consistent-cluster/consistent_hashing/red_black_tree.rb

Constant Summary

Constants inherited from ConsistentCluster::RedBlackTree::Node

UNDEFINED

Instance Attribute Summary

Attributes inherited from ConsistentCluster::RedBlackTree::Node

#color, #key, #left, #right, #value

Instance Method Summary collapse

Methods inherited from ConsistentCluster::RedBlackTree::Node

#black?, #check_height, #each_key, #each_value, #keys, #red?, #set_root, #values

Constructor Details

#initializeEmptyNode

Returns a new instance of EmptyNode.



386
387
388
389
# File 'lib/consistent-cluster/consistent_hashing/red_black_tree.rb', line 386

def initialize
  @value = nil
  @color = :BLACK
end

Instance Method Details

#delete(key) ⇒ Object

returns [deleted_node, new_root, is_rebalance_needed]



414
415
416
# File 'lib/consistent-cluster/consistent_hashing/red_black_tree.rb', line 414

def delete(key)
  [self, self, false]
end

#dump_sexpObject



422
423
424
# File 'lib/consistent-cluster/consistent_hashing/red_black_tree.rb', line 422

def dump_sexp
  # intentionally blank
end

#dump_tree(io, indent = '') ⇒ Object



418
419
420
# File 'lib/consistent-cluster/consistent_hashing/red_black_tree.rb', line 418

def dump_tree(io, indent = '')
  # intentionally blank
end

#each(&block) ⇒ Object



399
400
401
# File 'lib/consistent-cluster/consistent_hashing/red_black_tree.rb', line 399

def each(&block)
  # intentionally blank
end

#empty?Boolean

Returns:

  • (Boolean)


391
392
393
# File 'lib/consistent-cluster/consistent_hashing/red_black_tree.rb', line 391

def empty?
  true
end

#insert(key, value) ⇒ Object

returns new_root



404
405
406
# File 'lib/consistent-cluster/consistent_hashing/red_black_tree.rb', line 404

def insert(key, value)
  Node.new(key, value, self, self)
end

#retrieve(key) ⇒ Object

returns value



409
410
411
# File 'lib/consistent-cluster/consistent_hashing/red_black_tree.rb', line 409

def retrieve(key)
  UNDEFINED
end

#sizeObject



395
396
397
# File 'lib/consistent-cluster/consistent_hashing/red_black_tree.rb', line 395

def size
  0
end