public static ValueOrError <CrontabField> TryParse(CrontabFieldKind kind, string expression, ExceptionHandler onError) { var field = new CrontabField(CrontabFieldImpl.FromKind(kind)); var error = field._impl.TryParse(expression, field.Accumulate, onError); return(error == null ? field : (ValueOrError <CrontabField>)error); }
public static T TryParse <T>(CrontabFieldKind kind, string expression, Func <CrontabField, T> valueSelector, Func <ExceptionProvider, T> errorSelector) { var field = new CrontabField(CrontabFieldImpl.FromKind(kind)); var error = field._impl.TryParse(expression, field.Accumulate, null, e => e); return(error == null?valueSelector(field) : errorSelector(error)); }
private CrontabField(CrontabFieldImpl impl) { if (impl == null) { throw new ArgumentNullException("impl"); } _impl = impl; _bits = new BitArray(impl.ValueCount); _bits.SetAll(false); _minValueSet = int.MaxValue; _maxValueSet = -1; }