public bool MoveNext() { if (LeftToRight) { CurrentValue = CurrentNode?.Values.Count > _i ? CurrentNode.Values[_i] : null; } else { CurrentValue = _i >= 0 ? CurrentNode.Values[_i] : null; } if (CurrentValue == null) { if ((LeftToRight && CurrentNode?.RightSibling != null) || (!LeftToRight && CurrentNode?.LeftSibling != null)) { CurrentNode = LeftToRight ? CurrentNode.RightSibling : CurrentNode.LeftSibling; if (LeftToRight) { _i = 0; } else { _i = CurrentNode.Values.Count - 1; } CurrentValue = CurrentNode.Values.Count >= _i ? CurrentNode.Values[_i] : null; } } if (LeftToRight) { _i++; } else { _i--; } if (CurrentValue != null && Condition != null) { CustomTuple tuple = new CustomTuple(Relation); tuple.AddValueFor(Condition.Column.Name, (int)CurrentValue.Value); if (!Condition.SatisfiesCondition(tuple)) { return(MoveNext()); } } return(CurrentValue != null); }