public int SelectorCount() { var query = SelectorTuple .Where(x => x.IsReservedValue()); return(query.Count()); }
public NioEventLoop(NioEventLoopGroup parent, Executor executor, SelectorProvider provider) : base(parent, executor, false, DEFAULT_MAX_PENDING_TASKS) { if (provider == null) { throw new NullReferenceException("selectorProvider"); } this.provider = provider; SelectorTuple selectorTuple = openSelector(); selector = selectorTuple.selector; _unwrappedSelector = selectorTuple.unwrappedSelector; }
private IEnumerable <Tuple <KeyValuePair <T, T>, KeyValuePair <T, T> > > GetSelectorPairs() { var list = SelectorTuple. Select((x, i) => new { Tup = x, Index = i, IsSelector = x.IsReservedValue() }) .ToList(); foreach (var item in list) { if (item.IsSelector) { yield return(new Tuple <KeyValuePair <T, T>, KeyValuePair <T, T> >(list[item.Index - 1].Tup, item.Tup)); } } }
public KeyValuePair <T, T>?GetSelector(KeyValuePair <T, T> value) { var query = SelectorTuple.ToList(); var index = query .FindIndex(x => value.Key.Equals(x.Key) && value.Value.Equals(x.Value)); if (index + 1 < SelectorTuple.Length) { var result = SelectorTuple[index + 1]; if (result.IsReservedValue()) { return(result); } } return(null); }