public ByteArrayValidator(bool allowNull, int limit, BoundLimit type) { this.allowNull = allowNull; if (type == BoundLimit.Maximum) { this.minLength = 0; if (limit < 0) { this.maxLength = 0; } else { this.maxLength = limit; } } else { this.maxLength = int.MaxValue; if (limit < 0) { this.minLength = 0; } else { this.minLength = limit; } } }
public T this[int dimension, BoundLimit boundEnd] { get { if (boundEnd == BoundLimit.Minimum) { if (dimension == 0) { return(this.MinX); } else if (dimension == 1) { return(this.MinY); } } else { if (dimension == 0) { return(this.MaxX); } else if (dimension == 1) { return(this.MaxY); } } throw new ArgumentOutOfRangeException(); } }
public StringValidator(bool allowNull, int lengthLimit, BoundLimit BoundLimit) { this.allowNull = allowNull; if (BoundLimit == BoundLimit.Maximum) { this.maxLength = lengthLimit; this.minLength = 0; } else { this.minLength = lengthLimit; this.maxLength = int.MaxValue; } }
/// <summary> /// Creates a UInt64Validator instance with only a Minimum or a Maximum value. /// </summary> /// <param name="limit">ULong value to be set as the minimum or maximum value.</param> /// <param name="type">Type of limit, based on enumeration BoundLimit, to be set for this instance.</param> public UInt64Validator(ulong limit, BoundLimit type) { if (type == BoundLimit.Maximum) { this.hasMax = true; this.max = limit; this.hasMin = false; } else { this.hasMin = true; this.min = limit; this.hasMax = false; } }
/// <summary> /// Creates a SingleValidator instance with only a Minimum or a Maximum value. /// </summary> /// <param name="limit">Float value to be set as the minimum or maximum value.</param> /// <param name="type">Type of limit, based on enumeration BoundLimit, to be set for this instance.</param> public SingleValidator(float limit, BoundLimit type) { if (type == BoundLimit.Maximum) { this.hasMax = true; this.max = limit; this.hasMin = false; } else { this.hasMin = true; this.min = limit; this.hasMax = false; } }
/// <summary> /// Creates a Int16Validator instance with only a Minimum or a Maximum value. /// </summary> /// <param name="limit">Short to be set as the minimum or maximum value.</param> /// <param name="type">Type of limit, based on enumeration BoundLimit, to be set for this instance.</param> public Int16Validator(short limit, BoundLimit type) { if (type == BoundLimit.Maximum) { this.hasMax = true; this.max = limit; this.hasMin = false; } else { this.hasMin = true; this.min = limit; this.hasMax = false; } }
/// <summary> /// Creates a DecimalValidator instance with only a Minimum or a Maximum value. /// </summary> /// <param name="limit">Decimal value to be set as the minimum or maximum value.</param> /// <param name="type">Type of limit, based on enumeration BoundLimit, to be set for this instance.</param> public DecimalValidator(decimal limit, BoundLimit type) { if (type == BoundLimit.Maximum) { this.hasMax = true; this.max = limit; this.hasMin = false; } else { this.hasMin = true; this.min = limit; this.hasMax = false; } }
/// <summary> /// Creates a DateTimeValidator instance with only a Minimum or a Maximum value and without a DateTime Kind. /// </summary> /// <param name="limit">DateTime value to be set as the minimum or maximum value.</param> /// <param name="type">Type of limit, based on enumeration BoundLimit, to be set for this instance.</param> public DateTimeValidator(DateTime limit, BoundLimit type) { this.hasKind = false; if (type == BoundLimit.Maximum) { this.hasMax = true; this.max = limit; this.hasMin = false; } else { this.hasMin = true; this.min = limit; this.hasMax = false; } }
/// <summary> /// Creates a TimeSpanValidator instance where the time interval value is set to the parameter provided and either the minimum or maximum time interval is established. /// </summary> /// <param name="allowZero">Value to be set as the time interval variable.</param> /// <param name="limit">Time interval value to be set as the minimum or maximum value.</param> /// <param name="type">Type of limit, based on enumeration BoundLimit, to be set for this instance.</param> public TimeSpanValidator(bool allowZero, TimeSpan limit, BoundLimit type) { this.allowZero = allowZero; if (type == BoundLimit.Maximum) { this.hasMax = true; this.max = limit; this.hasMin = false; } else { this.hasMin = true; this.min = limit; this.hasMax = false; } }
public T this[int dimension, BoundLimit boundEnd] { get { if (boundEnd == BoundLimit.Minimum) { if (dimension < this.ordinateMaxs.Length) { return(this.ordinateMins[dimension]); } } else { if (dimension < this.ordinateMaxs.Length) { return(this.ordinateMaxs[dimension]); } } throw new ArgumentOutOfRangeException(); } }
public ByteArrayValidator(int limit, BoundLimit type) : this(false, limit, type) { }
public StringValidator(int lengthLimit, BoundLimit BoundLimit) : this(true, lengthLimit, BoundLimit) { }
/// <summary> /// Creates a TimeSpanValidator instance where a time interval must be greater than 0 (zero) and either the minimum or maximum time interval is established. /// </summary> /// <param name="limit">Time interval value to be set as the minimum or maximum value.</param> /// <param name="type">Type of limit, based on enumeration BoundLimit, to be set for this instance.</param> public TimeSpanValidator(TimeSpan limit, BoundLimit type) : this(false, limit, type) { }