Esempio n. 1
0
        public TBuilder Append(TFrom value)
        {
            var convertedVal = ConvertTo(value);
            var temp         = new DictionaryEntry(convertedVal, Comparer, HashFunction);

            if (!Entries.TryGetValue(temp, out var index))
            {
                index = NextIndex++;
                Entries.Add(temp, index);
                ValuesBuffer.Append(convertedVal);
            }

            IndicesBuffer.Append(index);
            return(Instance);
        }
Esempio n. 2
0
            /// <inheritdoc />
            public StringDictionaryBuilder Append(string value)
            {
                if (value == null)
                {
                    NullBitmap.Append(0);
                    IndicesBuffer.Append(-1); // need something in the indices buffer to make sure it makes sense
                    NullCount++;
                    return(this);
                }


                var temp = new DictionaryEntry(value, Comparer, HashFunction);

                if (!Entries.TryGetValue(temp, out var index))
                {
                    index = NextIndex++;
                    Entries.Add(temp, index);
                    AppendStringToBuffer(value);
                }

                NullBitmap.Append(1);
                IndicesBuffer.Append(index);
                return(this);
            }