Exemplo n.º 1
0
        public BranchNode(int prefix, int branchingBit, PatriciaTrieNode <T> left, PatriciaTrieNode <T> right)
        {
            Prefix       = prefix;
            BranchingBit = branchingBit;
            Left         = left;
            Right        = right;

            count = left.Count + right.Count;
        }
Exemplo n.º 2
0
        protected static IImmutableIntMap <T> Join(PatriciaTrieNode <T> left, PatriciaTrieNode <T> right)
        {
            int keyLeft  = left.Key;
            int keyRight = right.Key;

            int branchingBit = BranchingBit(keyLeft, keyRight);
            var prefix       = MaskWithBit(keyLeft, branchingBit);

            if (IsZeroBitAt(keyLeft, branchingBit))
            {
                return(new BranchNode <T>(prefix, branchingBit, left, right));
            }

            return(new BranchNode <T>(prefix, branchingBit, right, left));
        }