예제 #1
0
        private bool Until<T1>(PatternMatcher matcher, Func<T1, bool> callback, bool breakCondition) where T1 : class, IInDictElement {
            bool result = !breakCondition;

            var en = _Elements.GetEnumerator();
            while (en.MoveNext()) {
                if (en.Current.Value is T1) {
                    bool matched = (matcher == null) ||matcher.IsMatched(en.Current.Key);
                    if (matched) {
                        if (callback(en.Current.Value as T1) == breakCondition) {
                            result = breakCondition;
                            break;
                        }
                    }
                }
            }
            return result;
        }
예제 #2
0
 public List<T> Matched(PatternMatcher matcher) {
     return Matched<T>(matcher);
 }
예제 #3
0
 public bool UntilFalse(PatternMatcher matcher, Func<T, bool> callback) {
     return Until<T>(matcher, callback, false);
 }
예제 #4
0
 public bool UntilTrue(PatternMatcher matcher, Func<T, bool> callback) {
     return Until<T>(matcher, callback, true);
 }
예제 #5
0
 public void ForEach(PatternMatcher matcher, Action<T> callback) {
     ForEach<T>(matcher, callback);
 }
예제 #6
0
 public bool UntilFalse<T1>(PatternMatcher matcher, Func<T1, bool> callback) where T1 : class, IInDictElement {
     return Until(matcher, callback, false);
 }
예제 #7
0
 public void ForEach<T1>(PatternMatcher matcher, Action<T1> callback) where T1 : class, IInDictElement {
     UntilTrue<T1>(matcher, (T1 element) => {
         callback(element);
         return false;
     });
 }