/// <summary> /// Checks that an object is not null. /// </summary> /// <param name="o"> Object to be checked. </param> /// <param name="pattern"> Message pattern. </param> /// <param name="args"> Arguments to replace the placeholders in {@code pattern}. </param> /// <exception cref="NullArgumentException"> if {@code o} is {@code null}. </exception> public static void CheckNotNull(object o, Localizable pattern, params object[] args) { if (o == null) { throw new NullArgumentException(pattern, args); } }
/// <summary> /// Construct an exception from the mismatched dimensions. /// </summary> /// <param name="specific"> Message pattern providing the specific context of /// the error. </param> /// <param name="wrong"> Wrong dimensions. </param> /// <param name="expected"> Expected dimensions. </param> public MultiDimensionMismatchException(Localizable specific, Integer[] wrong, Integer[] expected) : base(specific, wrong, expected) { this.wrong = wrong.Clone(); this.expected = expected.Clone(); }
/// <summary> /// Construct the exception with a specific context. /// </summary> /// <param name="specific"> Contextual information on what caused the exception. </param> public NoDataException(Localizable specific) : base(specific) { }
/// <summary> /// Constructor with a specific message. /// </summary> /// <param name="pattern"> Message pattern providing the specific context of /// the error. </param> /// <param name="args"> Arguments. </param> public MathArithmeticException(Localizable pattern, params object[] args) { context = new ExceptionContext(this); context.AddMessage(pattern, args); }
/// <summary> /// Construct the exception with a specific context. /// </summary> /// <param name="specific"> Specific context where the error occurred. </param> /// <param name="value"> Argument. </param> public NotStrictlyPositiveException(Localizable specific, Number value) : base(specific, value, INTEGER_ZERO, false) { }
/// <summary> /// Construct the exception with a specific context. /// </summary> /// <param name="specific"> Specific context pattern. </param> /// <param name="arguments"> Arguments. </param> public ZeroException(Localizable specific, params object[] arguments) : base(specific, INTEGER_ZERO, arguments) { }
/// <summary> /// Construct an exception from the mismatched dimensions with a /// specific context information. /// </summary> /// <param name="specific"> Context information. </param> /// <param name="wrong"> Requested value. </param> /// <param name="lo"> Lower bound. </param> /// <param name="hi"> Higher bound. </param> public OutOfRangeException(Localizable specific, Number wrong, Number lo, Number hi) : base(specific, wrong, lo, hi) { this.lo = lo; this.hi = hi; }
/// <summary> /// Construct the exception with a specific context. /// </summary> /// <param name="specific"> Specific context pattern. </param> /// <param name="max"> Maximum. </param> /// <param name="args"> Additional arguments. </param> public MaxCountExceededException(Localizable specific, Number max, params object[] args) { GetContext().AddMessage(specific, max, args); this.max = max; }
/// <summary> /// Construct the exception with a specific context. /// </summary> /// <param name="specific"> Specific context pattern. </param> /// <param name="wrong"> Value that is smaller than the minimum. </param> /// <param name="min"> Minimum. </param> /// <param name="boundIsAllowed"> Whether {@code min} is included in the allowed range. </param> public NumberIsTooSmallException(Localizable specific, Number wrong, Number min, bool boundIsAllowed) : base(specific, wrong, min) { this.min = min; this.boundIsAllowed = boundIsAllowed; }
/// <summary> /// Construct the exception with a specific context. /// </summary> /// <param name="pattern"> Message pattern providing the specific context of the error. </param> /// <param name="arguments"> Values for replacing the placeholders in {@code pattern}. </param> public InsufficientDataException(Localizable pattern, params object[] arguments) : base(pattern, arguments) { }
/// <summary> /// Construct the exception with a specific context. /// </summary> /// <param name="specific"> Specific context pattern. </param> /// <param name="wrong"> Value that is infinite or NaN. </param> /// <param name="args"> Optional arguments. </param> public NotFiniteNumberException(Localizable specific, Number wrong, params object[] args) : base(specific, wrong, args) { }
/// <summary> /// Construct an exception from the mismatched dimensions. /// </summary> /// <param name="specific"> Message pattern providing the specific context of /// the error. </param> /// <param name="wrong"> Wrong dimensions. </param> /// <param name="expected"> Expected dimensions. </param> public MultiDimensionMismatchException(Localizable specific, int[] wrong, int[] expected) : base(specific, wrong, expected) { this.wrong = (int[])wrong.Clone(); this.expected = (int[])expected.Clone(); }
/// <param name="pattern"> Message pattern providing the specific context of /// the error. </param> /// <param name="args"> Arguments. </param> public MathUnsupportedOperationException(Localizable pattern, params object[] args) { context = new ExceptionContext(this); context.AddMessage(pattern, args); }
/// <summary> /// Construct the exception with a specific context. /// </summary> /// <param name="specific"> Specific context where the error occurred. </param> /// <param name="value"> Argument. </param> public NotPositiveException(Localizable specific, Number value) : base(specific, value, INTEGER_ZERO, true) { }
/// <param name="pattern"> Message pattern providing the specific context of /// the error. </param> /// <param name="arguments"> Values for replacing the placeholders in {@code pattern}. </param> public NullArgumentException(Localizable pattern, params object[] arguments) : base(pattern, arguments) { }
/// <summary> /// Construct the exception with a specific context. /// </summary> /// <param name="specific"> Specific context pattern. </param> /// <param name="wrong"> Value that is larger than the maximum. </param> /// <param name="max"> Maximum. </param> /// <param name="boundIsAllowed"> if true the maximum is included in the allowed range. </param> public NumberIsTooLargeException(Localizable specific, Number wrong, Number max, bool boundIsAllowed) : base(specific, wrong, max) { this.max = max; this.boundIsAllowed = boundIsAllowed; }
/// <summary> /// Construct the exception with a specific context and arguments. /// </summary> /// <param name="pattern"> Message pattern providing the specific context of /// the error. </param> /// <param name="args"> Arguments. </param> public ConvergenceException(Localizable pattern, params object[] args) { GetContext().AddMessage(pattern, args); }
/// <param name="pattern"> Message pattern explaining the cause of the error. </param> /// <param name="args"> Arguments. </param> public MathIllegalArgumentException(Localizable pattern, params object[] args) { context = new ExceptionContext(this); context.AddMessage(pattern, args); }