Esempio n. 1
0
        /// <summary>
        /// Adds a value/ordering key pair to the list.
        /// </summary>
        /// <param name="value">value to add</param>
        /// <param name="orderKey">ordering key</param>
        /// <returns>if true, the internal memory has changed</returns>
        /// <remarks>
        /// As this is a value type, if the internal memory changes,
        /// then the changes need to be reflected (to a HashLookup, for example)
        /// as necessary
        /// </remarks>
        internal bool Add(TElement value, TOrderKey orderKey)
        {
            bool requiresMemoryChange = (_tail == null);

            if (requiresMemoryChange)
            {
                _tail = new ListChunk <Pair <TElement, TOrderKey> >(INITIAL_CHUNK_SIZE);
            }
            _tail.Add(CreatePair(value, orderKey));

            return(requiresMemoryChange);
        }
        /// <summary>
        /// Add an element
        /// </summary>
        internal void Add(TElement value, TOrderKey orderKey)
        {
            Debug.Assert(_values != null);

            _values.Add(new Pair <TOrderKey, TElement>(orderKey, value));
        }