private SchedulareState GetCurrentState(SortedArray <SchedulareState> openSet) { SchedulareState state = null; if (!_isWithTH) { _isWithTH = true; return(openSet.FindMin()); } state = openSet.FirstOrDefault(x => x.Weight > _threshold); if (state == null) { state = openSet.LastOrDefault(); } UpdateThreshold(state); _isWithTH = false; return(state); }