/// <exclude/> /// <summary> /// Compares the equality of two compact array objects. /// </summary> /// /// <param name="obj">the compact array object to be compared with this.</param> /// <returns>true if the current compact array object is the same as the /// compact array object obj; false otherwise.</returns> public override bool Equals(Object obj) { if (obj == null) { return(false); } if ((Object)this == obj) // quick check { return(true); } if ((Object)GetType() != (Object)obj.GetType()) // same class? { return(false); } CompactByteArray other = (CompactByteArray)obj; for (int i = 0; i < UNICODECOUNT; i++) { // could be sped up later if (ElementAt((char)i) != other.ElementAt((char)i)) { return(false); } } return(true); // we made it through the guantlet. }
/// <exclude/> /// <summary> /// Overrides Cloneable /// </summary> /// public Object Clone() { try { CompactByteArray other = (CompactByteArray)base.MemberwiseClone(); other.values = (sbyte[])values.Clone(); other.indices = (char[])indices.Clone(); if (hashes != null) { other.hashes = (int[])hashes.Clone(); } return(other); } catch (Exception e) { throw new InvalidOperationException(); } }