Enhanced C#
Language of your choice: library documentation
Nested classes | Properties | Public Member Functions | Protected fields | List of all members
Loyc.Collections.Impl.SparseAListLeaf< T > Class Template Reference

Internal implementation class. Leaf node of SparseAList<T>. More...


Source file:
Inheritance diagram for Loyc.Collections.Impl.SparseAListLeaf< T >:
Loyc.Collections.Impl.AListNode< int, T >

Remarks

Internal implementation class. Leaf node of SparseAList<T>.

This node consists of a certain number of virtual slots (_totalCount) and a certain number of real slots (_list.Count). Node splitting/joining behavior is based entirely on the number of real slots. There can be any number of empty spaces anywhere in the list. If there are empty spaces at the beginning, _list[0].Offset > 0; if there are empty spaces at the end, _totalCount > _list.Last.Offset + 1. _list.Count == 0 only if the entire list consists of empty space and there is only a single node.

Nested classes

struct  Entry
 

Properties

override bool IsLeaf [get]
 
override uint TotalCount [get]
 
override int LocalCount [get]
 
override bool IsFullLeaf [get]
 
override bool IsUndersized [get]
 
override T this[uint index] [get]
 
override int CapacityLeft [get]
 
- Properties inherited from Loyc.Collections.Impl.AListNode< int, T >
abstract bool IsLeaf [get]
 
abstract uint TotalCount [get]
 Gets the total number of (T) items in this node and all children More...
 
abstract int LocalCount [get]
 Gets the number of items (slots) used this node only. More...
 
abstract bool IsFullLeaf [get]
 Returns true if the node is full and is a leaf node. More...
 
abstract bool IsUndersized [get]
 Returns true if the node is undersized, meaning it would prefer to have more immediate children. More...
 
abstract T this[uint index] [get]
 Gets an item at the specified sub-index. More...
 
bool IsFrozen [get]
 Returns true if the node is explicitly marked read-only. Conceptually, the node can still be changed, but when any change needs to be made, a clone of the node is created and modified instead. More...
 
abstract int CapacityLeft [get]
 

Public Member Functions

 SparseAListLeaf (ushort maxNodeSize)
 
 SparseAListLeaf (SparseAListLeaf< T > original)
 
override T GetLastItem ()
 Gets the last item in the last leaf node (needed by B+ trees, but is also called by AListBase<K,T>.Last). More...
 
override void SetAt (uint index, T item, IAListTreeObserver< int, T > tob)
 
override bool RemoveAt (uint index, uint count, IAListTreeObserver< int, T > tob)
 
override void Freeze ()
 
override AListNode< int, T > DetachedClone ()
 Creates an unfrozen shallow duplicate copy of this node. The child nodes (if this is an inner node) are frozen so that they will require duplication if they are to be modified. The name "DetachedClone" is intended to emphasize that the AListNodeObserver (if any) is not notified, and the clone is effectively independent of the list that it came from. More...
 
override AListNode< int, T > CopySection (uint index, uint count, AListBase< int, T > list)
 
override uint GetImmutableCount (bool excludeSparse)
 Diagnostic method. See AListBase<K,T>.GetImmutableCount(). More...
 
override AListNode< int, T > Insert (uint index, T item, out AListNode< int, T > splitRight, IAListTreeObserver< int, T > tob)
 
override AListNode< int, T > InsertRange (uint index, IListSource< T > source, ref int sourceIndex, out AListNode< int, T > splitRight, IAListTreeObserver< int, T > tob)
 
override uint GetRealItemCount ()
 For sparse lists: counts the number of non-sparse items. More...
 
- Public Member Functions inherited from Loyc.Collections.Impl.AListNode< int, T >
virtual AListNode< K, T > Insert (uint index, T item, out AListNode< K, T > splitRight, IAListTreeObserver< K, T > tob)
 Inserts an item at the specified index. This method can only be called for ALists, since other tree types don't allow insertion at a specific index. More...
 
virtual AListNode< K, T > InsertRange (uint index, IListSource< T > source, ref int sourceIndex, out AListNode< K, T > splitRight, IAListTreeObserver< K, T > tob)
 Inserts a list of items at the specified index. This method may not insert all items at once, so there is a sourceIndex parameter which points to the next item to be inserted. When sourceIndex reaches source.Count, the insertion is complete. More...
 
abstract void SetAt (uint index, T item, IAListTreeObserver< K, T > tob)
 Sets an item at the specified sub-index. More...
 
abstract bool RemoveAt (uint index, uint count, IAListTreeObserver< K, T > tob)
 Removes an item at the specified index. More...
 
abstract AListNode< K, T > CopySection (uint index, uint count, AListBase< K, T > list)
 Extracts and returns, as fast as possible, a subrange of the list that this node represents. More...
 

Protected fields

InternalDList< Entry_list
 
uint _totalCount
 
- Protected fields inherited from Loyc.Collections.Impl.AListNode< int, T >
ushort _maxNodeSize
 Maximum number of slots in this node More...
 
bool _isFrozen
 Whether the node is knowingly cloned an therefore frozen. More...
 
byte _childCount
 Number of children, if this is an inner node. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Loyc.Collections.Impl.AListNode< int, T >
static bool AutoClone (ref AListNode< K, T > node, AListInnerBase< K, T > parent, IAListTreeObserver< K, T > tob)
 Checks whether 'node' is frozen and if so, replaces it with an unfrozen copy. More...
 
- Protected Member Functions inherited from Loyc.Collections.Impl.AListNode< int, T >
IAListTreeObserver< K, T > GetObserver (AListBase< K, T > tree)
 Allows derived classes of AListNode to access AListBase._observer. More...
 
bool HasListChanging (AListBase< K, T > tree)
 Allows derived classes of AListNode to fire the AListBase.ListChanging event. More...
 
void CallListChanging (AListBase< K, T > tree, ListChangeInfo< T > listChangeInfo)
 Allows derived classes of AListNode to fire the AListBase.ListChanging event properly. More...
 
- Static Protected Member Functions inherited from Loyc.Collections.Impl.AListNode< int, T >
static void Verify (bool condition)
 Same as Assert(), except that the condition expression can have side-effects because it is evaluated even in Release builds. More...
 

Member Function Documentation

override AListNode<int, T> Loyc.Collections.Impl.SparseAListLeaf< T >.DetachedClone ( )
inlinevirtual

Creates an unfrozen shallow duplicate copy of this node. The child nodes (if this is an inner node) are frozen so that they will require duplication if they are to be modified. The name "DetachedClone" is intended to emphasize that the AListNodeObserver (if any) is not notified, and the clone is effectively independent of the list that it came from.

Implements Loyc.Collections.Impl.AListNode< int, T >.

override uint Loyc.Collections.Impl.SparseAListLeaf< T >.GetImmutableCount ( bool  excludeSparse)
inlinevirtual

Diagnostic method. See AListBase<K,T>.GetImmutableCount().

Parameters
excludeSparseShould be false for normal ALists. If true, the count is of real items only.

Implements Loyc.Collections.Impl.AListNode< int, T >.

override T Loyc.Collections.Impl.SparseAListLeaf< T >.GetLastItem ( )
inlinevirtual

Gets the last item in the last leaf node (needed by B+ trees, but is also called by AListBase<K,T>.Last).

Implements Loyc.Collections.Impl.AListNode< int, T >.

override uint Loyc.Collections.Impl.SparseAListLeaf< T >.GetRealItemCount ( )
inlinevirtual

For sparse lists: counts the number of non-sparse items.

Reimplemented from Loyc.Collections.Impl.AListNode< int, T >.