Example #1
0
        public void ReadBinary(BinaryReader r)
        {
            // All values are serialized in immutable form, so only an ImmutableStringStore is created on load
            ImmutableStringStore store = new ImmutableStringStore();

            store.ReadBinary(r);

            _addedValues    = null;
            _existingValues = store;
        }
Example #2
0
        public int FindOrAddString(string value)
        {
            // If this value was previously written, return the existing identifier
            Range matches;

            if (_existingValues != null && _existingValues.TryFindString(value, out matches))
            {
                return(matches.Start);
            }

            // Otherwise, add to the AddedStrings
            if (_addedValues == null)
            {
                _addedValues = new MutableStringStore();
            }
            return(-_addedValues.FindOrAddString(value));
        }
Example #3
0
        public bool ConvertToImmutable()
        {
            // If there are added values, we need to convert for serialization
            if (_addedValues != null)
            {
                if (_existingValues != null)
                {
                    // Need to implement index merging for this
                    throw new NotImplementedException();
                }
                else
                {
                    // Convert AddedValues to immutable form
                    _existingValues = _addedValues.ConvertToImmutable(out _addedIdentifierToExistingIdentifier);
                    _addedValues    = null;
                    return(true);
                }
            }

            return(false);
        }
Example #4
0
 public void Clear()
 {
     _existingValues = null;
     _addedValues    = null;
     _addedIdentifierToExistingIdentifier = null;
 }