Example #1
0
        public bool Equals(ECGData other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(StartDateTime.EqualsUpToMilliseconds(other.StartDateTime) &&
                   EndDateTime.EqualsUpToMilliseconds(other.EndDateTime) &&
                   SamplingRate == other.SamplingRate &&


                   UnfilteredSignal.Rank == other.UnfilteredSignal.Rank &&
                   Enumerable.Range(0, UnfilteredSignal.Rank).All(dimension =>
                                                                  UnfilteredSignal.GetLength(dimension) == other.UnfilteredSignal.GetLength(dimension)) &&
                   UnfilteredSignal.Cast <double>().SequenceEqual(other.UnfilteredSignal.Cast <double>()) &&

                   FilteredSignal.Rank == other.FilteredSignal.Rank &&
                   Enumerable.Range(0, FilteredSignal.Rank).All(dimension =>
                                                                FilteredSignal.GetLength(dimension) == other.FilteredSignal.GetLength(dimension)) &&
                   FilteredSignal.Cast <double>().SequenceEqual(other.FilteredSignal.Cast <double>()) &&
                   Timestamps.Rank == other.Timestamps.Rank &&
                   Enumerable.Range(0, Timestamps.Rank).All(dimension =>
                                                            Timestamps.GetLength(dimension) == other.Timestamps.GetLength(dimension)) &&
                   Timestamps.Cast <long>().SequenceEqual(other.Timestamps.Cast <long>()));
        }
Example #2
0
        public bool Equals(EITEntry other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            var equal = Configuration == other.Configuration &&
                        StartDateTime.EqualsUpToMilliseconds(other.StartDateTime) &&
                        EndDateTime.EqualsUpToMilliseconds(other.EndDateTime) &&

                        VoltagesReal.Rank == other.VoltagesReal.Rank &&
                        Enumerable.Range(0, VoltagesReal.Rank).All(dimension =>
                                                                   VoltagesReal.GetLength(dimension) == other.VoltagesReal.GetLength(dimension)) &&
                        VoltagesReal.Cast <float>().SequenceEqual(other.VoltagesReal.Cast <float>()) &&

                        VoltagesIm.Rank == other.VoltagesIm.Rank &&
                        Enumerable.Range(0, VoltagesIm.Rank).All(dimension =>
                                                                 VoltagesIm.GetLength(dimension) == other.VoltagesIm.GetLength(dimension)) &&
                        VoltagesIm.Cast <float>().SequenceEqual(other.VoltagesIm.Cast <float>()) &&

                        CurrentsReal.Rank == other.CurrentsReal.Rank &&
                        Enumerable.Range(0, VoltagesIm.Rank).All(dimension =>
                                                                 CurrentsReal.GetLength(dimension) == other.CurrentsReal.GetLength(dimension)) &&
                        CurrentsReal.Cast <float>().SequenceEqual(other.CurrentsReal.Cast <float>()) &&

                        CurrentsIm.Rank == other.CurrentsIm.Rank &&
                        Enumerable.Range(0, CurrentsIm.Rank).All(dimension =>
                                                                 CurrentsIm.GetLength(dimension) == other.CurrentsIm.GetLength(dimension)) &&
                        CurrentsIm.Cast <float>().SequenceEqual(other.CurrentsIm.Cast <float>()) &&

                        Saturation.Rank == other.Saturation.Rank &&
                        Enumerable.Range(0, Saturation.Rank).All(dimension =>
                                                                 Saturation.GetLength(dimension) == other.Saturation.GetLength(dimension)) &&
                        Saturation.Cast <ulong>().SequenceEqual(other.Saturation.Cast <ulong>()) &&


                        Timestamps.Rank == other.Timestamps.Rank &&
                        Enumerable.Range(0, Timestamps.Rank).All(dimension =>
                                                                 Timestamps.GetLength(dimension) == other.Timestamps.GetLength(dimension)) &&
                        Timestamps.Cast <long>().SequenceEqual(other.Timestamps.Cast <long>());

            if (PacketIds != null && other.PacketIds != null)
            {
                equal = equal && PacketIds.Rank == other.PacketIds.Rank &&
                        Enumerable.Range(0, PacketIds.Rank).All(dimension =>
                                                                PacketIds.GetLength(dimension) == other.PacketIds.GetLength(dimension)) &&
                        PacketIds.Cast <ulong>().SequenceEqual(other.PacketIds.Cast <ulong>());
            }
            return(equal);
        }