/// <summary> /// Compares this data structure with the given object. /// </summary> /// <param name="other">The other.</param> /// <returns>True whether this instance contains the same values as the given one.</returns> internal bool DataEquals(IndexData other) { if (this == other) { return(true); } if (this.Aliases != other.Aliases) { if (!MemoryAlias.AreEqual(Aliases, other.Aliases)) { return(false); } } if (this.Array != other.Array) { if (Array == null || other.Array == null || !this.Array.Equals(other.Array)) { return(false); } } if (this.Objects != other.Objects) { if (!ObjectValueContainer.AreEqual(Objects, other.Objects)) { return(false); } } return(true); }
/// <summary> /// Tries the get aliases for specified index. /// </summary> /// <param name="index">The index.</param> /// <param name="aliases">The aliases.</param> /// <returns>True whether specified index has aliases.</returns> internal bool TryGetAliases(MemoryIndex index, out MemoryAlias aliases) { IndexData data; if (IndexData.TryGetValue(index, out data)) { aliases = data.Aliases; return(data.Aliases != null); } else { aliases = null; return(false); } }
internal static bool AreEqual(MemoryAlias objA, MemoryAlias objB) { if (objA == objB) { return(true); } if (objA != null) { return(objA.DataEquals(objB)); } else { return(objB.DataEquals(objA)); } }
internal bool DataEquals(MemoryAlias other) { if (other == null) { return(this.MayAliasses.Count == 0 && this.MustAliasses.Count == 0); } if (this.MayAliasses.Count != other.MayAliasses.Count || this.MustAliasses.Count != other.MustAliasses.Count) { return(false); } return(HashSetTools.EqualsSet(this.MustAliasses, other.MustAliasses) || HashSetTools.EqualsSet(this.MayAliasses, other.MayAliasses)); }
/// <summary> /// Sets the alias to specified index. /// </summary> /// <param name="index">The index.</param> /// <param name="alias">The alias.</param> internal void SetAlias(MemoryIndex index, MemoryAlias alias) { lockedTest(); IndexData data; if (!IndexData.TryGetValue(index, out data)) { data = new IndexData(null, null, null); } IndexDataBuilder builder = data.Builder(); builder.Aliases = alias; IndexData[index] = builder.Build(); }
/// <summary> /// Initializes a new instance of the <see cref="IndexData"/> class. /// </summary> /// <param name="aliases">The aliases.</param> /// <param name="array">The array.</param> /// <param name="objects">The objects.</param> public IndexData(MemoryAlias aliases, AssociativeArray array, ObjectValueContainer objects) { Aliases = aliases; Array = array; Objects = objects; }
/// <summary> /// Initializes a new instance of the <see cref="MemoryAliasBuilder"/> class. /// </summary> /// <param name="MemoryAlias">The memory information.</param> public MemoryAliasBuilder(MemoryAlias MemoryAlias) { MayAliasses = new HashSet <MemoryIndex>(MemoryAlias.MayAliasses); MustAliasses = new HashSet <MemoryIndex>(MemoryAlias.MustAliasses); }