mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-13 06:42:35 +00:00
30 lines
547 B
Ruby
30 lines
547 B
Ruby
# frozen_string_literal: true
|
|
|
|
class IMICFPS
|
|
# Gets included into AABBTree
|
|
module AABBTreeDebug
|
|
def inspect
|
|
@branches = 0
|
|
@leaves = 0
|
|
if @root
|
|
node = @root
|
|
|
|
debug_search(node.a)
|
|
debug_search(node.b)
|
|
end
|
|
|
|
puts "<#{self.class}:#{object_id}> has #{@branches} branches and #{@leaves} leaves"
|
|
end
|
|
|
|
def debug_search(node)
|
|
if node.leaf?
|
|
@leaves += 1
|
|
else
|
|
@branches += 1
|
|
debug_search(node.a)
|
|
debug_search(node.b)
|
|
end
|
|
end
|
|
end
|
|
end
|