/// <summary> /// Compares this structure object with given copy of old data and applies simplify limit when new memory entry is bigger than given simplify limit. /// </summary> /// <param name="oldValue">The old value.</param> /// <param name="simplifyLimit">The simplify limit.</param> /// <param name="assistant">The assistant.</param> /// <returns><c>true</c> if the data are same; otherwise, <c>false</c>.</returns> private bool compareDataAndSimplify(SnapshotStructure oldValue, int simplifyLimit, MemoryAssistantBase assistant) { HashSet <MemoryIndex> usedIndexes = new HashSet <MemoryIndex>(); HashSetTools.AddAll(usedIndexes, this.IndexData.Keys); HashSetTools.AddAll(usedIndexes, oldValue.IndexData.Keys); IndexData emptyStructure = new CopyMemoryModel.IndexData(null, null, null); bool areEqual = true; foreach (MemoryIndex index in usedIndexes) { if (index is TemporaryIndex) { continue; } IndexData newStructure = getDataOrUndefined(index, this, emptyStructure); IndexData oldStructure = getDataOrUndefined(index, oldValue, emptyStructure); if (!newStructure.DataEquals(oldStructure)) { areEqual = false; } if (!Data.DataEqualsAndSimplify(oldValue.Data, index, simplifyLimit, assistant)) { areEqual = false; } } return(areEqual); }
/// <summary> /// Compares this structure object with given copy of old data. /// </summary> /// <param name="oldValue">The old value.</param> /// <returns><c>true</c> if the data are same; otherwise, <c>false</c>.</returns> private bool compareData(SnapshotStructure oldValue) { HashSet <MemoryIndex> usedIndexes = new HashSet <MemoryIndex>(); HashSetTools.AddAll(usedIndexes, this.IndexData.Keys); HashSetTools.AddAll(usedIndexes, oldValue.IndexData.Keys); IndexData emptyStructure = new CopyMemoryModel.IndexData(null, null, null); foreach (MemoryIndex index in usedIndexes) { if (index is TemporaryIndex) { continue; } IndexData newStructure = getDataOrUndefined(index, this, emptyStructure); IndexData oldStructure = getDataOrUndefined(index, oldValue, emptyStructure); if (!newStructure.DataEquals(oldStructure)) { return(false); } if (!Data.DataEquals(oldValue.Data, index)) { return(false); } } return(true); }