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); } }
public BtreeIndexDuplicateReader getReader(Int64 SectionStartPosition) { JumpRecord start = getStartPointerRecord(SectionStartPosition); while (start != null && start.Buttom > 0) { start = getJumpRecord(start.Buttom); } BtreeIndexDuplicateReader reader = new BtreeIndexDuplicateReader(this, start); return(reader); }
public bool MoveNext() { /// if in duplicate mode. // TODO: this may not happend and should not care /// becaust it returns the keys only. if (inDuplicateMode) { byte[] nextdup = duplicatereader.ReadNextPointerBytes(); if (nextdup != null) { this.currentValue = nextdup; return(true); } else { // end of duplicate. this.inDuplicateMode = false; this.duplicatereader = null; // cotinue with the getnextpointer; } } var record = getnextpointer(); // NodePointer pointer = getnextpointer(); if (record == null) { return(false); } else { this.currentValue = record.Key; return(true); } ///// else //if (record.Pointer.Indicator == EnumValues.TypeIndicator.block) //{ // this.currentValue = record.Key; // return true; //} //else if (record.Pointer.Indicator == EnumValues.TypeIndicator.duplicate) //{ // duplicatereader = this.treefile.duplicate.getReader(record.Pointer.PositionPointer); // byte[] nextdup = duplicatereader.ReadNextPointerBytes(); // if (nextdup != null) // { // 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; //} }