Home / Function/ searchAttributeByKey() — netty Function Reference

searchAttributeByKey() — netty Function Reference

Architecture documentation for the searchAttributeByKey() function in DefaultAttributeMap.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  29dc4ae3_4501_cdff_abe5_6eb56b31bc3b["searchAttributeByKey()"]
  bbb6a8bc_5354_cb1a_513e_c44f549e2d8f["DefaultAttributeMap"]
  29dc4ae3_4501_cdff_abe5_6eb56b31bc3b -->|defined in| bbb6a8bc_5354_cb1a_513e_c44f549e2d8f
  c7821402_c1b3_d927_bcbd_43fa921be527["attr()"]
  c7821402_c1b3_d927_bcbd_43fa921be527 -->|calls| 29dc4ae3_4501_cdff_abe5_6eb56b31bc3b
  687147c8_8840_2da9_5463_2c0c3edffbdf["hasAttr()"]
  687147c8_8840_2da9_5463_2c0c3edffbdf -->|calls| 29dc4ae3_4501_cdff_abe5_6eb56b31bc3b
  36be273e_4a26_05a2_5f0e_7cf9398c207b["removeAttributeIfMatch()"]
  36be273e_4a26_05a2_5f0e_7cf9398c207b -->|calls| 29dc4ae3_4501_cdff_abe5_6eb56b31bc3b
  style 29dc4ae3_4501_cdff_abe5_6eb56b31bc3b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/main/java/io/netty/util/DefaultAttributeMap.java lines 39–62

    private static int searchAttributeByKey(DefaultAttribute[] sortedAttributes, AttributeKey<?> key) {
        int low = 0;
        int high = sortedAttributes.length - 1;

        while (low <= high) {
            int mid = low + high >>> 1;
            DefaultAttribute midVal = sortedAttributes[mid];
            AttributeKey midValKey = midVal.key;
            if (midValKey == key) {
                return mid;
            }
            int midValKeyId = midValKey.id();
            int keyId = key.id();
            assert midValKeyId != keyId;
            boolean searchRight = midValKeyId < keyId;
            if (searchRight) {
                low = mid + 1;
            } else {
                high = mid - 1;
            }
        }

        return -(low + 1);
    }

Domain

Subdomains

Frequently Asked Questions

What does searchAttributeByKey() do?
searchAttributeByKey() is a function in the netty codebase, defined in common/src/main/java/io/netty/util/DefaultAttributeMap.java.
Where is searchAttributeByKey() defined?
searchAttributeByKey() is defined in common/src/main/java/io/netty/util/DefaultAttributeMap.java at line 39.
What calls searchAttributeByKey()?
searchAttributeByKey() is called by 3 function(s): attr, hasAttr, removeAttributeIfMatch.

Analyze Your Own Codebase

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

Try Supermodel Free