コード例 #1
0
        public Prefix ExtendLeft()
        {
            var newBits = new BitArray(Bits.Count + 1);

            foreach (int i in Enumerable.Range(0, Bits.Count))
            {
                newBits[i] = Bits[i];
            }

            var left = new Prefix
            {
                Bits = newBits
            };

            left.SetKey();

            return(left);
        }
コード例 #2
0
        public Prefix Sibling()
        {
            var s = new Prefix
            {
                Bits = Bits
            };

            if (s.Bits.Count == 0)
            {
                Console.WriteLine("Warning: There should be no calling of Sibling on empty prefix!");
            }
            else
            {
                s.Bits[s.Bits.Count - 1] = !s.Bits[s.Bits.Count - 1];
            }

            s.SetKey();
            return(s);
        }
コード例 #3
0
        public Prefix ExtendRight()
        {
            var newBits = new BitArray(Bits.Count + 1);

            foreach (int i in Enumerable.Range(0, Bits.Count))
            {
                newBits[i] = Bits[i];
            }

            newBits[newBits.Count - 1] = true;

            var right = new Prefix
            {
                Bits = newBits
            };

            right.SetKey();

            return(right);
        }
コード例 #4
0
        internal Prefix Parent()
        {
            if (Bits.Count == 0)
            {
                Console.WriteLine("Warning: There should be no calling of Parent on empty prefix!");
            }

            var newBits = new BitArray(Math.Max(0, Bits.Count - 1));

            foreach (int i in Enumerable.Range(0, newBits.Count))
            {
                newBits[i] = Bits[i];
            }

            var a = new Prefix
            {
                Bits = newBits
            };

            a.SetKey();
            return(a);
        }