Home / Function/ Context() — netty Function Reference

Context() — netty Function Reference

Architecture documentation for the Context() function in AhoCorasicSearchProcessorFactory.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  24cc4ebd_ede3_1677_9180_99c2eb476679["Context()"]
  2bbcf65c_43ea_8f43_fbbd_a4d039d021d0["AhoCorasicSearchProcessorFactory"]
  24cc4ebd_ede3_1677_9180_99c2eb476679 -->|defined in| 2bbcf65c_43ea_8f43_fbbd_a4d039d021d0
  style 24cc4ebd_ede3_1677_9180_99c2eb476679 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/main/java/io/netty/buffer/search/AhoCorasicSearchProcessorFactory.java lines 99–145

    private static Context buildTrie(byte[][] needles) {

        ArrayList<Integer> jumpTableBuilder = new ArrayList<Integer>(ALPHABET_SIZE);
        for (int i = 0; i < ALPHABET_SIZE; i++) {
            jumpTableBuilder.add(-1);
        }

        ArrayList<Integer> matchForBuilder = new ArrayList<Integer>();
        matchForBuilder.add(-1);

        for (int needleId = 0; needleId < needles.length; needleId++) {
            byte[] needle = needles[needleId];
            int currentPosition = 0;

            for (byte ch0: needle) {

                final int ch = ch0 & 0xff;
                final int next = currentPosition + ch;

                if (jumpTableBuilder.get(next) == -1) {
                    jumpTableBuilder.set(next, jumpTableBuilder.size());
                    for (int i = 0; i < ALPHABET_SIZE; i++) {
                        jumpTableBuilder.add(-1);
                    }
                    matchForBuilder.add(-1);
                }

                currentPosition = jumpTableBuilder.get(next);
            }

            matchForBuilder.set(currentPosition >> BITS_PER_SYMBOL, needleId);
        }

        Context context = new Context();

        context.jumpTable = new int[jumpTableBuilder.size()];
        for (int i = 0; i < jumpTableBuilder.size(); i++) {
            context.jumpTable[i] = jumpTableBuilder.get(i);
        }

        context.matchForNeedleId = new int[matchForBuilder.size()];
        for (int i = 0; i < matchForBuilder.size(); i++) {
            context.matchForNeedleId[i] = matchForBuilder.get(i);
        }

        return context;
    }

Domain

Subdomains

Frequently Asked Questions

What does Context() do?
Context() is a function in the netty codebase, defined in buffer/src/main/java/io/netty/buffer/search/AhoCorasicSearchProcessorFactory.java.
Where is Context() defined?
Context() is defined in buffer/src/main/java/io/netty/buffer/search/AhoCorasicSearchProcessorFactory.java at line 99.

Analyze Your Own Codebase

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

Try Supermodel Free