Example #1
0
        /// <summary>
        /// Adds the intensities from the other TimeIntensities to the intensities in this.
        /// The returned TimeIntensities whill have a set of times which is the union of the
        /// times in this and <paramref name="other"/>.
        /// </summary>
        public TimeIntensities MergeTimesAndAddIntensities(TimeIntensities other)
        {
            if (Times.Equals(other.Times))
            {
                return(AddIntensities(other));
            }
            var mergedTimes = ImmutableList.ValueOf(Times.Concat(other.Times).Distinct().OrderBy(time => time));

            if (mergedTimes.Equals(Times))
            {
                return(AddIntensities(other));
            }
            return(Interpolate(mergedTimes, false).AddIntensities(other));
        }