public void InitializeWithProperty() { _operation = (RealIntervalValidatorOperation)Operation; _checkValue = (double)Value; _operationFunc = new Dictionary <RealIntervalValidatorOperation, Func <RealInterval, bool> > { [RealIntervalValidatorOperation.InfimumGreater] = new Func <RealInterval, bool>(x => x.From > _checkValue), [RealIntervalValidatorOperation.InfimumGreaterOrEqual] = new Func <RealInterval, bool>(x => x.From >= _checkValue), [RealIntervalValidatorOperation.InfimumLess] = new Func <RealInterval, bool>(x => x.From < _checkValue), [RealIntervalValidatorOperation.InfimumLessOrEqual] = new Func <RealInterval, bool>(x => x.From <= _checkValue), [RealIntervalValidatorOperation.SupremumGreater] = new Func <RealInterval, bool>(x => x.To > _checkValue), [RealIntervalValidatorOperation.SupremumGreaterOrEqual] = new Func <RealInterval, bool>(x => x.To >= _checkValue), [RealIntervalValidatorOperation.SupremumLess] = new Func <RealInterval, bool>(x => x.To < _checkValue), [RealIntervalValidatorOperation.SupremumLessOrEqual] = new Func <RealInterval, bool>(x => x.To <= _checkValue) }; }
public RealIntervalValidator(RealIntervalValidatorOperation operation, double value) { _operation = operation; _checkValue = value; Value = value; Operation = (int)operation; _operationFunc = new Dictionary <RealIntervalValidatorOperation, Func <RealInterval, bool> > { [RealIntervalValidatorOperation.InfimumGreater] = new Func <RealInterval, bool>(x => x.From > _checkValue), [RealIntervalValidatorOperation.InfimumGreaterOrEqual] = new Func <RealInterval, bool>(x => x.From >= _checkValue), [RealIntervalValidatorOperation.InfimumLess] = new Func <RealInterval, bool>(x => x.From < _checkValue), [RealIntervalValidatorOperation.InfimumLessOrEqual] = new Func <RealInterval, bool>(x => x.From <= _checkValue), [RealIntervalValidatorOperation.SupremumGreater] = new Func <RealInterval, bool>(x => x.To > _checkValue), [RealIntervalValidatorOperation.SupremumGreaterOrEqual] = new Func <RealInterval, bool>(x => x.To >= _checkValue), [RealIntervalValidatorOperation.SupremumLess] = new Func <RealInterval, bool>(x => x.To < _checkValue), [RealIntervalValidatorOperation.SupremumLessOrEqual] = new Func <RealInterval, bool>(x => x.To <= _checkValue) }; }