/// <summary> /// Performs a deep copy of the target <see cref="SynchrophasorAnalytics.Measurements.PhasorBase"/> object /// </summary> /// <returns>A deep copy of the <see cref="SynchrophasorAnalytics.Measurements.PhasorBase"/> object.</returns> public PhasorBase DeepCopy() { PhasorBase copy = (PhasorBase)this.MemberwiseClone(); copy.BaseKV = m_baseKV.DeepCopy(); copy.Type = m_type; return(copy); }
/// <summary> /// Determines equality between to <see cref="SynchrophasorAnalytics.Measurements.PhasorBase"/> objects /// </summary> /// <param name="target">The target object for equality testing.</param> /// <returns>A bool representing the result of the equality check.</returns> public override bool Equals(object target) { // If parameter is null return false. if (target == null) { return(false); } // If parameter cannot be cast to PhasorBase return false. PhasorBase phasorBase = target as PhasorBase; if ((object)phasorBase == null) { return(false); } // Return true if the fields match: if (this.m_type != phasorBase.Type) { return(false); } else if (!this.BaseKV.Equals(phasorBase.BaseKV)) { return(false); } else if (this.m_magnitude != phasorBase.Magnitude) { return(false); } else if (this.m_angleInDegrees != phasorBase.AngleInDegrees) { return(false); } else if (this.m_magnitudeKey != phasorBase.MagnitudeKey) { return(false); } else if (this.m_angleKey != phasorBase.AngleKey) { return(false); } else { return(true); } }