Example #1
0
        public static Coordinates[] Locate <TItem, TKey>(
            this UniqueKeyQuery <TItem, TKey> self, ref ReferenceNode <TItem, TKey> node, bool ephemeral = false)
        {
            var coordinates =
                self.State.AcquireMap(ephemeral);

            return(self.Locate(ref node, coordinates));
        }
Example #2
0
        internal static Coordinates[] GetCoordinates <TItem, TKey>(UniqueKeyQuery <TItem, TKey> self, ref ReferenceNode <TItem, TKey> node, Coordinates[] coordinateSet, int lvlIndex, int lastOverallIndex, INode found, int rawIndex)
        {
            var index = rawIndex < 0 ? ~rawIndex : rawIndex;

            var coord =
                coordinateSet[lvlIndex];

            coord.Length        = node.Length;
            coord.Index         = index;
            coord.OverallLength = self.State.Levels[lvlIndex].TotalUsed;
            coord.OverallIndex  = (lastOverallIndex * self.State.MaxLengthPerNode) + index;

            lastOverallIndex = coord.OverallIndex;

            if (found is ReferenceNode <TItem, TKey> )
            {
                node = (ReferenceNode <TItem, TKey>)found;

                return(self.Locate(
                           ref node, coordinateSet, lvlIndex + 1, lastOverallIndex));
            }

            return(coordinateSet);
        }