DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Properties | Private Member Functions | Private Attributes | List of all members
Deveel.Data.Index.BlockIndexBase< T >.Enumerator Class Reference
Inheritance diagram for Deveel.Data.Index.BlockIndexBase< T >.Enumerator:
Deveel.Data.Index.IIndexEnumerator< T >

Public Member Functions

 Enumerator (BlockIndexBase< T > index, int startOffset, int endOffset)
 
void Dispose ()
 
bool MoveNext ()
 
void Reset ()
 
bool MoveBack ()
 Reverses the direction of the enumerator to the previous element within the list. /summary> returns> Returns true if the enumerator has more elements when traversing the index in the reverse direction, otherwise it returns false. More...
 
void Remove ()
 

Properties

Current [get]
 
object IEnumerator. Current [get]
 

Private Member Functions

void SetupVars (int offset)
 
void WalkBack ()
 

Private Attributes

readonly BlockIndexBase< T > index
 
readonly int startOffset
 
int endOffset
 
IIndexBlock< T > currentBlock
 
int currentBlockSize
 
int blockIndex
 
int blockOffset
 
int currentOffset
 

Detailed Description

Definition at line 826 of file BlockIndexBase_T.cs.

Constructor & Destructor Documentation

Deveel.Data.Index.BlockIndexBase< T >.Enumerator.Enumerator ( BlockIndexBase< T >  index,
int  startOffset,
int  endOffset 
)
inline

Member Function Documentation

void Deveel.Data.Index.BlockIndexBase< T >.Enumerator.Dispose ( )
inline

Definition at line 869 of file BlockIndexBase_T.cs.

869  {
870  }
bool Deveel.Data.Index.BlockIndexBase< T >.Enumerator.MoveBack ( )
inline

Reverses the direction of the enumerator to the previous element within the list. /summary> returns> Returns true if the enumerator has more elements when traversing the index in the reverse direction, otherwise it returns false.

summary> Removes from the underlying index the current element this enumerator is positioned at. /summary>

This method can be called only once per call to IEnumerator<T>.Current. The behavior of an iterator is unspecified if the underlying index is modified while the iteration is in progress in any way other than by calling this method.

Some implementations of IIndexEnumerator<T> may choose to not implement this method, in which case an appropriate exception is generated.

Implements Deveel.Data.Index.IIndexEnumerator< T >.

Definition at line 919 of file BlockIndexBase_T.cs.

919  {
920  if (currentOffset > startOffset) {
921  WalkBack();
922  return true;
923  }
924 
925  return false;
926  }
bool Deveel.Data.Index.BlockIndexBase< T >.Enumerator.MoveNext ( )
inline
void Deveel.Data.Index.BlockIndexBase< T >.Enumerator.Remove ( )
inline

Implements Deveel.Data.Index.IIndexEnumerator< T >.

Definition at line 928 of file BlockIndexBase_T.cs.

928  {
929  index.CheckImmutable();
930 
931  // NOT ELEGANT: We check 'blocks' size to determine if the value
932  // deletion caused blocks to be removed. If it did, we set up the
933  // internal variables afresh with a call to 'setupVars'.
934  int origBlockCount = index.Blocks.Count;
935  index.RemoveFromBlock(blockIndex, currentBlock, blockOffset);
936 
937  // Did the number of blocks in the list change?
938  if (origBlockCount == index.Blocks.Count) {
939  // HACK: Evaluate the current cached block size
941  WalkBack();
942  } else {
943  --currentOffset;
945  }
946  --endOffset;
947  }
void Deveel.Data.Index.BlockIndexBase< T >.Enumerator.Reset ( )
inline

Definition at line 889 of file BlockIndexBase_T.cs.

889  {
891 
892  if (endOffset >= startOffset) {
893  // Setup variables to 1 before the start
894  SetupVars(startOffset - 1);
895  }
896  }
void Deveel.Data.Index.BlockIndexBase< T >.Enumerator.SetupVars ( int  offset)
inlineprivate

Definition at line 846 of file BlockIndexBase_T.cs.

846  {
847  int size = index.Blocks.Count;
848  int start = 0;
849  for (blockIndex = 0; blockIndex < size; ++blockIndex) {
850  var block = index.Blocks[blockIndex];
851  int bsize = block.Count;
852  if (offset < start + bsize) {
853  blockOffset = offset - start;
854  if (blockOffset < 0)
855  blockOffset = -1;
856 
857  currentBlock = block;
858  currentBlockSize = bsize;
859  return;
860  }
861  start += bsize;
862  }
863 
864  throw new IndexOutOfRangeException("'index' (" + offset + ") out of bounds.");
865  }
void Deveel.Data.Index.BlockIndexBase< T >.Enumerator.WalkBack ( )
inlineprivate

Member Data Documentation

int Deveel.Data.Index.BlockIndexBase< T >.Enumerator.blockIndex
private

Definition at line 833 of file BlockIndexBase_T.cs.

int Deveel.Data.Index.BlockIndexBase< T >.Enumerator.blockOffset
private

Definition at line 834 of file BlockIndexBase_T.cs.

IIndexBlock<T> Deveel.Data.Index.BlockIndexBase< T >.Enumerator.currentBlock
private

Definition at line 831 of file BlockIndexBase_T.cs.

int Deveel.Data.Index.BlockIndexBase< T >.Enumerator.currentBlockSize
private

Definition at line 832 of file BlockIndexBase_T.cs.

int Deveel.Data.Index.BlockIndexBase< T >.Enumerator.currentOffset
private

Definition at line 836 of file BlockIndexBase_T.cs.

int Deveel.Data.Index.BlockIndexBase< T >.Enumerator.endOffset
private

Definition at line 829 of file BlockIndexBase_T.cs.

readonly BlockIndexBase<T> Deveel.Data.Index.BlockIndexBase< T >.Enumerator.index
private

Definition at line 827 of file BlockIndexBase_T.cs.

readonly int Deveel.Data.Index.BlockIndexBase< T >.Enumerator.startOffset
private

Definition at line 828 of file BlockIndexBase_T.cs.

Property Documentation

T Deveel.Data.Index.BlockIndexBase< T >.Enumerator.Current
get

Definition at line 898 of file BlockIndexBase_T.cs.

object IEnumerator. Deveel.Data.Index.BlockIndexBase< T >.Enumerator.Current
getprivate

Definition at line 902 of file BlockIndexBase_T.cs.


The documentation for this class was generated from the following file: