public static IEnumerable <int> BinarySearchAllWithTimeRange(this IList <IIndexedDict> items, int[] keysNdxs, object[] keysValues, ITimedObject timeRange) { if (items == null) { yield break; } int n = items.Count; if (n == 0) { yield break; } int i = BinarySearchWithTimeRange(items, keysNdxs, keysValues, timeRange); if (i < 0) { i = 0; yield break; } var Imax = i; while (i > 0 && Cmp.CompareKeysWithTimeRange(items[i - 1].ValuesList, keysNdxs, keysValues, timeRange) == 0) { i--; } var prevEndTime = DateTime.MinValue; while (i <= Imax) { #if CHECK_DATA_DUPS if (i < Imax && Cmp.CompareTimed(items[i].ValuesList, items[i + 1].ValuesList) == 0) { DupDataError(items[i]); i++; continue; } #endif yield return(i++); } while (i < n) { if (Cmp.CompareKeysWithTimeRange(items[i].ValuesList, keysNdxs, keysValues, timeRange) == 0) { #if CHECK_DATA_DUPS if (Cmp.CompareTimed(items[i - 1].ValuesList, items[i].ValuesList) == 0) { DupDataError(items[i]); i++; continue; } #endif yield return(i++); } else { yield break; } } }
//[DebuggerHidden] object Const(object arg) { IList arrA = arg as IList; if (arrA == null || acceptVector) { return(func(arg)); } try { int n = arrA.Count; ArrayList result; if (resultCanBeLazy) { result = new ListOfVals(n); } else { result = new ListOfConst(n); } object[] prev = null; for (int i = 0; i < n; i++) { var r = func(arrA[i]); if (r is IEnumerable <object[]> multiRes) { throw new NotImplementedException(); } else { if (r is object[] curr) { if (prev != null && Cmp.CompareTimed(prev, curr) == 0) { continue; } prev = curr; } result.Add(r); } } return(result); } catch (Exception ex) { return(ex.Wrap()); }// new Exception(string.Format("unaryOp: " + ex.Message)); } }