Esempio n. 1
0
            public bool MoveNext()
            {
                ///if in duplicate mode.
                if (inDuplicateMode)
                {
                    Int64 nextdup = duplicatereader.ReadNext();
                    if (nextdup > 0)
                    {
                        this.currentValue = nextdup;
                        return(true);
                    }
                    else
                    {
                        // end of duplicate.
                        this.inDuplicateMode = false;
                        this.duplicatereader = null;
                        // cotinue with the getnextpointer;
                    }
                }

                NodePointer pointer = getnextpointer();

                if (pointer == null)
                {
                    return(false);
                }

                /// else
                ///
                if (pointer.Indicator == EnumValues.TypeIndicator.block)
                {
                    this.currentValue = pointer.PositionPointer;
                    return(true);
                }
                else if (pointer.Indicator == EnumValues.TypeIndicator.duplicate)
                {
                    duplicatereader = this.treefile.duplicate.getReader(pointer.PositionPointer);
                    Int64 nextdup = duplicatereader.ReadNext();

                    if (nextdup > 0)
                    {
                        this.currentValue    = nextdup;
                        this.inDuplicateMode = true;
                        return(true);
                    }
                    else
                    {
                        // there is no item in the duplicate, should not be possible, just to make sure.
                        this.duplicatereader = null;
                        this.inDuplicateMode = false;
                        // go to the next record again.
                        return(MoveNext());
                    }
                }
                else
                {
                    /// should not be possible.
                    return(false);
                }
            }