예제 #1
0
        private static void RegisterHooks <T>()
        {
            var value = default(T);
            var range = new Range <T>(value, value);

            ExpressionProcessor.RegisterCustomMethodCall(() => range.Equal(range), e => ProcessCompare <T>(e, RangeOperator.Equal));
            ExpressionProcessor.RegisterCustomMethodCall(() => range.NotEqual(range), e => ProcessCompare <T>(e, RangeOperator.NotEqual));
            ExpressionProcessor.RegisterCustomMethodCall(() => range.GreaterThan(range), e => ProcessCompare <T>(e, RangeOperator.GreaterThan));
            ExpressionProcessor.RegisterCustomMethodCall(() => range.LessThan(range), e => ProcessCompare <T>(e, RangeOperator.LessThan));
            ExpressionProcessor.RegisterCustomMethodCall(() => range.GreaterThanOrEqual(range), e => ProcessCompare <T>(e, RangeOperator.GreaterThanOrEqual));
            ExpressionProcessor.RegisterCustomMethodCall(() => range.LessThanOrEqual(range), e => ProcessCompare <T>(e, RangeOperator.LessThanOrEqual));
            ExpressionProcessor.RegisterCustomMethodCall(() => range.Contains(range), e => ProcessCompare <T>(e, RangeOperator.Contains));
            ExpressionProcessor.RegisterCustomMethodCall(() => range.Contains(value), e => ProcessCompare <T>(e, RangeOperator.Contains));
            ExpressionProcessor.RegisterCustomMethodCall(() => range.ContainedBy(range), e => ProcessCompare <T>(e, RangeOperator.ContainedBy));
            ExpressionProcessor.RegisterCustomMethodCall(() => value.ContainedBy(range), (e) => ProcessCompare <T>(e, RangeOperator.ContainedBy));
            ExpressionProcessor.RegisterCustomMethodCall(() => range.Overlaps(range), e => ProcessCompare <T>(e, RangeOperator.Overlaps));
            ExpressionProcessor.RegisterCustomMethodCall(() => range.StrictlyLeftOf(range), e => ProcessCompare <T>(e, RangeOperator.StrictlyLeftOf));
            ExpressionProcessor.RegisterCustomMethodCall(() => range.StrictlyRightOf(range), e => ProcessCompare <T>(e, RangeOperator.StrictlyRightOf));
            ExpressionProcessor.RegisterCustomMethodCall(() => range.NotExtendLeftOf(range), e => ProcessCompare <T>(e, RangeOperator.NotExtendLeftOf));
            ExpressionProcessor.RegisterCustomMethodCall(() => range.NotExtendRightOf(range), e => ProcessCompare <T>(e, RangeOperator.NotExtendRightOf));
            ExpressionProcessor.RegisterCustomMethodCall(() => range.AdjacentTo(range), e => ProcessCompare <T>(e, RangeOperator.AdjacentTo));
        }