Exemplo n.º 1
0
        public void ClearTest()
        {
            var rb = new RecordBuilder( 1 );
            rb.Add( "1" );
            rb.Add( "2" );
            rb.Clear();
            var array = rb.ToArray();

            Assert.AreEqual( 0, rb.Length );
            Assert.AreEqual( 2, rb.Capacity );
            Assert.AreEqual( 0, array.Length );
        }
Exemplo n.º 2
0
        public void ClearTest()
        {
            var rb = new RecordBuilder(1);

            rb.Add("1");
            rb.Add("2");
            rb.Clear();
            var array = rb.ToArray();

            Assert.AreEqual(0, rb.Length);
            Assert.AreEqual(2, rb.Capacity);
            Assert.AreEqual(0, array.Length);
        }
Exemplo n.º 3
0
        public void ResizeTest()
        {
            var rb = new RecordBuilder(2);

            rb.Add("1");
            Assert.AreEqual(1, rb.Length);
            Assert.AreEqual(2, rb.Capacity);

            rb.Add("2");
            Assert.AreEqual(2, rb.Length);
            Assert.AreEqual(2, rb.Capacity);

            rb.Add("3");
            Assert.AreEqual(3, rb.Length);
            Assert.AreEqual(4, rb.Capacity);
        }
Exemplo n.º 4
0
        public void ResizeTest()
        {
            var rb = new RecordBuilder( 2 );

            rb.Add( "1" );
            Assert.AreEqual( 1, rb.Length );
            Assert.AreEqual( 2, rb.Capacity );

            rb.Add( "2" );
            Assert.AreEqual( 2, rb.Length );
            Assert.AreEqual( 2, rb.Capacity );

            rb.Add( "3" );
            Assert.AreEqual( 3, rb.Length );
            Assert.AreEqual( 4, rb.Capacity );
        }
Exemplo n.º 5
0
        internal Record ToAggShellRecord(SpoolSpace Memory)
        {
            RecordBuilder rb = new RecordBuilder();

            foreach (Expression x in this._Values.Values)
            {
                if (x.IsAggregate)
                {
                    rb.Add(x.Initialize(Memory));
                }
                else
                {
                    rb.Add(x.Evaluate(Memory));
                }
            }
            return(rb.ToRecord());
        }
Exemplo n.º 6
0
        public Record Initialize(SpoolSpace Memory)
        {
            RecordBuilder rb = new RecordBuilder();

            foreach (Expression x in this._Values)
            {
                rb.Add(x.Initialize(Memory));
            }
            return(rb.ToRecord());
        }
Exemplo n.º 7
0
        public Record ToRecord(SpoolSpace Memory)
        {
            RecordBuilder rb = new RecordBuilder();

            foreach (Expression sx in this._Values.Values)
            {
                rb.Add(sx.Evaluate(Memory));
            }
            return(rb.ToRecord());
        }
Exemplo n.º 8
0
        public Record AggRender(Record Work)
        {
            RecordBuilder rb = new RecordBuilder();

            for (int i = 0; i < Work.Count; i++)
            {
                rb.Add(this._Values[i].AggRender(Work[i]));
            }
            return(rb.ToRecord());
        }
Exemplo n.º 9
0
        public Record Accumulate(SpoolSpace Memory, Record Work)
        {
            RecordBuilder rb = new RecordBuilder();

            for (int i = 0; i < this._Values.Count; i++)
            {
                rb.Add(this._Values[i].Accumulate(Memory, Work[i]));
            }
            return(rb.ToRecord());
        }
Exemplo n.º 10
0
        public void ToArrayTest()
        {
            var rb = new RecordBuilder();

            var array = rb.ToArray();
            Assert.AreEqual( 0, array.Length );

            rb.Add( "1" );
            array = rb.ToArray();
            Assert.AreEqual( 1, array.Length );
        }
Exemplo n.º 11
0
        public void ToArrayTest()
        {
            var rb = new RecordBuilder();

            var array = rb.ToArray();

            Assert.AreEqual(0, array.Length);

            rb.Add("1");
            array = rb.ToArray();
            Assert.AreEqual(1, array.Length);
        }
Exemplo n.º 12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Value"></param>
        /// <param name="Columns"></param>
        /// <param name="Delim"></param>
        /// <param name="Escape"></param>
        /// <returns></returns>
        public static Record Parse(string Value, Schema Columns, char Delim, char Escape)
        {
            string[] t = Util.StringUtil.Split(Value, Delim, Escape);
            if (t.Length != Columns.Count)
            {
                throw new Exception();
            }
            RecordBuilder rb = new RecordBuilder();

            for (int i = 0; i < t.Length; i++)
            {
                rb.Add(Parse(t[i], Columns.ColumnAffinity(i)));
            }
            return(rb.ToRecord());
        }
Exemplo n.º 13
0
        // Records //
        public static Record ToRecord(string Text, Schema Columns, char[] Delims, char Escape)
        {
            // SplitUpper the data //
            string[] t = StringUtil.Split(Text, Delims, Escape, false);

            // Check the length //
            if (t.Length != Columns.Count)
            {
                throw new ArgumentException(string.Format("BString has {0} fields, but schema has {1} fields", t.Length, Columns.Count));
            }

            // Build the record //
            RecordBuilder rb = new RecordBuilder();

            for (int i = 0; i < t.Length; i++)
            {
                rb.Add(CellParser.Parse(t[i], Columns.ColumnAffinity(i)));
            }

            return(rb.ToRecord());
        }