public static IntervalRange GetaHalfRange(IntervalRange inputRange) { var mid = inputRange.interval_max - inputRange.interval_min; var newMin_Interval = mid - (mid / 2); var newMax_Interval = mid + (mid / 2); mid = inputRange.bigSmaLen_max - inputRange.bigSmaLen_min; var newBigsmaMin = mid - (mid / 2); var newBigsmaMax = mid + (mid / 2); mid = inputRange.smallSmaLen_max - inputRange.smallSmaLen_min; var newSmallSmaLen_min = mid - (mid / 2); var newSmallSmaLen_max = mid + (mid / 2); mid = inputRange.SignalLen_max - inputRange.SignalLen_min; var newSignalLen_min = mid - (mid / 2); var newSignalLen_max = mid + (mid / 2); return(new IntervalRange { interval_min = (newMin_Interval < 1)? 1 : newMin_Interval, interval_max = (newMax_Interval < 1) ? 1 : newMax_Interval, bigSmaLen_min = (newBigsmaMin < 1) ? 1 : newBigsmaMin, bigSmaLen_max = (newBigsmaMax < 1) ? 1 : newBigsmaMax, smallSmaLen_min = (newSmallSmaLen_min < 1) ? 1 : newSmallSmaLen_min, smallSmaLen_max = (newSmallSmaLen_max < 1) ? 1 : newSmallSmaLen_max, SignalLen_min = (newSignalLen_min < 1) ? 1 : newSignalLen_min, SignalLen_max = (newSignalLen_max < 1) ? 1 : newSignalLen_max }); }
public static IntervalRange GetaHalfRange(IntervalRange inputCurRange, IntervalData inputCurInterval) { var mid = (inputCurRange.interval_max - inputCurRange.interval_min) / 2; var curBest = inputCurInterval.interval; var newMin_Interval = curBest - (mid / 2); var newMax_Interval = curBest + (mid / 2); mid = (inputCurRange.bigSmaLen_max - inputCurRange.bigSmaLen_min) / 2; curBest = inputCurInterval.bigSmaLen; var newBigsmaMin = curBest - (mid / 2); var newBigsmaMax = curBest + (mid / 2); mid = (inputCurRange.smallSmaLen_max - inputCurRange.smallSmaLen_min) / 2; curBest = inputCurInterval.smallSmaLen; var newSmallSmaLen_min = curBest - (mid / 2); var newSmallSmaLen_max = curBest + (mid / 2); mid = (inputCurRange.SignalLen_max - inputCurRange.SignalLen_min) / 2; curBest = inputCurInterval.SignalLen; var newSignalLen_min = curBest - (mid / 2); var newSignalLen_max = curBest + (mid / 2); return(new IntervalRange { interval_min = (newMin_Interval < 1) ? 1 : newMin_Interval, interval_max = (newMax_Interval < 1) ? 1 : newMax_Interval, bigSmaLen_min = (newBigsmaMin < 1) ? 1 : newBigsmaMin, bigSmaLen_max = (newBigsmaMax < 1) ? 1 : newBigsmaMax, smallSmaLen_min = (newSmallSmaLen_min < 1) ? 1 : newSmallSmaLen_min, smallSmaLen_max = (newSmallSmaLen_max < 1) ? 1 : newSmallSmaLen_max, SignalLen_min = (newSignalLen_min < 1) ? 1 : newSignalLen_min, SignalLen_max = (newSignalLen_max < 1) ? 1 : newSignalLen_max }); }