コード例 #1
0
        private int Read(int position, out object cr)
        {
            //0 indicates start of a new row
            int      prl     = 0;
            int      read    = 0;
            var      result  = new TreeList(null);
            TreeList current = result;

            while (position < _data.Length)
            {
                int rl = _rls[position];

                if (rl == 0 && (current.HasValues || current != result))
                {
                    break;
                }

                int lmv = rl - prl;

                if (lmv != 0)
                {
                    current = current.Submerge(lmv);
                }

                object value = _data.GetValue(position);
                current.Add(value);
                read += 1;

                prl       = rl;
                position += 1;
            }

            cr = result.FinalValue(_field.ClrNullableIfHasNullsType);

            if (cr == null)
            {
                cr = Array.CreateInstance(_field.ClrNullableIfHasNullsType, 0);
            }

            return(read);
        }
コード例 #2
0
ファイル: TreeList.cs プロジェクト: aloncatz/parquet-dotnet-1
        public TreeList Submerge(int depth)
        {
            if (depth == 0)
            {
                return(this);
            }

            if (depth > 0)
            {
                TreeList result = this;
                while (depth-- > 0)
                {
                    var next = new TreeList(result);
                    if (result._children == null)
                    {
                        result._children = new List <TreeList>();
                    }
                    if (result._values != null)
                    {
                        foreach (object v in result._values)
                        {
                            next.Add(v);
                        }
                        result._values = null;
                    }
                    result._children.Add(next);
                    result = next;
                }
                return(result);
            }

            TreeList r2 = this;

            while (depth++ < 0)
            {
                r2 = r2._parent;
            }

            return(r2);
        }
コード例 #3
0
ファイル: TreeList.cs プロジェクト: aloncatz/parquet-dotnet-1
 public TreeList(TreeList parent)
 {
     _parent = parent;
 }