Ejemplo n.º 1
0
        public T Next()
        {
            InitializeList();


            this._readerPosition++;

            if (this._readerPosition > this._keyList.Count - 1)
            {
                TryExtendEnd();
            }

            T ret = default(T);

            while (ret == null)
            {
                CsvPimaryKey key = this._keyList[this._readerPosition];
                IRestriction r   = RestrictionFactory.CsvKeyRestriction(typeof(T), key);

                ret = this._serializer.Connector.Load <T>(r);

                if (ret == null)
                {
                    _readerPosition++;
                }
            }

            return(ret);
        }
Ejemplo n.º 2
0
        public int CountItems()
        {
            int position = -1;

            foreach (CsvPimaryKey key in this._keyList)
            {
                IRestriction r = RestrictionFactory.CsvKeyRestriction(typeof(T), key);

                T tmp = this._serializer.Connector.Load <T>(r);

                if (tmp != null)
                {
                    position++;
                }
            }

            return(position + 1);
        }
Ejemplo n.º 3
0
        public T[] ToArray()
        {
            InitializeList();
            TryExtendEnd();

            List <T> tmpList = new List <T>();

            foreach (CsvPimaryKey key in this._keyList)
            {
                IRestriction r = RestrictionFactory.CsvKeyRestriction(typeof(T), key);

                T tmp = this._serializer.Connector.Load <T>(r);

                if (tmp != null)
                {
                    tmpList.Add(tmp);
                }
            }

            return(tmpList.ToArray());
        }
Ejemplo n.º 4
0
        public T Prev()
        {
            InitializeList();

            this._readerPosition--;

            T ret = default(T);

            while (ret == null)
            {
                CsvPimaryKey key = this._keyList[this._readerPosition];
                IRestriction r   = RestrictionFactory.CsvKeyRestriction(typeof(T), key);

                ret = this._serializer.Connector.Load <T>(r);

                if (ret == null)
                {
                    _readerPosition--;
                }
            }

            return(ret);
        }
Ejemplo n.º 5
0
        public int CurrentPosition()
        {
            int position = -1;

            T ret = default(T);

            try
            {
                CsvPimaryKey key1     = this._keyList[this._readerPosition];
                IRestriction restrict = RestrictionFactory.CsvKeyRestriction(typeof(T), key1);
                ret = this._serializer.Connector.Load <T>(restrict);
            }
            catch (ArgumentOutOfRangeException)
            {
                return(0);
            }

            foreach (CsvPimaryKey key in this._keyList)
            {
                IRestriction r = RestrictionFactory.CsvKeyRestriction(typeof(T), key);

                T tmp = this._serializer.Connector.Load <T>(r);

                if (tmp != null)
                {
                    position++;

                    if (tmp.Equals(ret))
                    {
                        return(position + 1);
                    }
                }
            }

            return(0);
        }