public void ReadBinary(BinaryReader r) { // Read as ImmutableMemberIndex only _addedIndex = null; _existingIndex = new ImmutableMemberIndex(); _existingIndex.ReadBinary(r); }
/// <summary> /// Associate an item with a given word in the index. /// </summary> /// <param name="wordIdentifier">Identifier of word to map to item.</param> /// <param name="itemIndex">Index of item word maps to.</param> public void AddItem(int wordIdentifier, int itemIndex) { if (_addedIndex == null) { _addedIndex = new MutableMemberIndex(); } _addedIndex.AddItem(wordIdentifier, itemIndex); }
public void ConvertToImmutable(StringStore strings) { if (_addedIndex != null) { if (_existingIndex != null) { // Need to implement index merging for this throw new NotImplementedException(); } else { // Convert AddedIndex to Immutable form _addedIndex.UpdateIdentifiers(strings); _existingIndex = _addedIndex.ConvertToImmutable(strings); _addedIndex = null; } } // If nothing was indexed, write an empty index for serialization to load if (_existingIndex == null) { _existingIndex = ImmutableMemberIndex.Empty; } }