natix.CompactDS.WaveletTree.Access C# (CSharp) Method

Access() public method

public Access ( int position ) : int
position int
return int
        public int Access(int position)
        {
            var node = this.Root;
            WT_Inner tmp;
            for (int i = 0; true; i++) {
                if (node.B.Access(position)) {
                    tmp = node.Right as WT_Inner;
                    if (tmp == null) {
                        return (node.Right as WT_Leaf).Symbol;
                    }
                    position = node.B.Rank1 (position) - 1;
                    node = tmp;

                } else {
                    tmp = node.Left as WT_Inner;
                    if (tmp == null) {
                        return (node.Left as WT_Leaf).Symbol;
                    }
                    position = node.B.Rank0 (position) - 1;
                    node = tmp;
                }
            }
        }