Home / Function/ bubbleDown() — netty Function Reference

bubbleDown() — netty Function Reference

Architecture documentation for the bubbleDown() function in DefaultPriorityQueue.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  5bca67c4_7315_0584_7bc2_ff5459c9ec18["bubbleDown()"]
  346d98e4_880c_f43c_7c90_38ef8a6cab37["DefaultPriorityQueue"]
  5bca67c4_7315_0584_7bc2_ff5459c9ec18 -->|defined in| 346d98e4_880c_f43c_7c90_38ef8a6cab37
  ab1e0ef0_05b2_1a78_973c_447f7b876c24["T()"]
  ab1e0ef0_05b2_1a78_973c_447f7b876c24 -->|calls| 5bca67c4_7315_0584_7bc2_ff5459c9ec18
  6996c51b_528d_1b1c_08f8_4dfd8f453075["removeTyped()"]
  6996c51b_528d_1b1c_08f8_4dfd8f453075 -->|calls| 5bca67c4_7315_0584_7bc2_ff5459c9ec18
  49acf204_e2c9_dd83_a84a_8b98719246ca["priorityChanged()"]
  49acf204_e2c9_dd83_a84a_8b98719246ca -->|calls| 5bca67c4_7315_0584_7bc2_ff5459c9ec18
  style 5bca67c4_7315_0584_7bc2_ff5459c9ec18 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/main/java/io/netty/util/internal/DefaultPriorityQueue.java lines 242–271

    private void bubbleDown(int k, T node) {
        final int half = size >>> 1;
        while (k < half) {
            // Compare node to the children of index k.
            int iChild = (k << 1) + 1;
            T child = queue[iChild];

            // Make sure we get the smallest child to compare against.
            int rightChild = iChild + 1;
            if (rightChild < size && comparator.compare(child, queue[rightChild]) > 0) {
                child = queue[iChild = rightChild];
            }
            // If the bubbleDown node is less than or equal to the smallest child then we will preserve the min-heap
            // property by inserting the bubbleDown node here.
            if (comparator.compare(node, child) <= 0) {
                break;
            }

            // Bubble the child up.
            queue[k] = child;
            child.priorityQueueIndex(this, k);

            // Move down k down the tree for the next iteration.
            k = iChild;
        }

        // We have found where node should live and still satisfy the min-heap property, so put it in the queue.
        queue[k] = node;
        node.priorityQueueIndex(this, k);
    }

Domain

Subdomains

Frequently Asked Questions

What does bubbleDown() do?
bubbleDown() is a function in the netty codebase, defined in common/src/main/java/io/netty/util/internal/DefaultPriorityQueue.java.
Where is bubbleDown() defined?
bubbleDown() is defined in common/src/main/java/io/netty/util/internal/DefaultPriorityQueue.java at line 242.
What calls bubbleDown()?
bubbleDown() is called by 3 function(s): T, priorityChanged, removeTyped.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free