TransformException.java

  1. /*
  2.  * Licensed to the Apache Software Foundation (ASF) under one or more
  3.  * contributor license agreements.  See the NOTICE file distributed with
  4.  * this work for additional information regarding copyright ownership.
  5.  * The ASF licenses this file to You under the Apache License, Version 2.0
  6.  * (the "License"); you may not use this file except in compliance with
  7.  * the License.  You may obtain a copy of the License at
  8.  *
  9.  *      http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */
  17. package org.apache.commons.math4.transform;

  18. import java.text.MessageFormat;

  19. /**
  20.  * Exception class with constants for frequently used messages.
  21.  * Class is package-private (for internal use only).
  22.  */
  23. class TransformException extends IllegalArgumentException {
  24.     /** Error message for "out of range" condition. */
  25.     public static final String FIRST_ELEMENT_NOT_ZERO = "First element ({0}) must be 0";
  26.     /** Error message for "not strictly positive" condition. */
  27.     public static final String NOT_STRICTLY_POSITIVE = "Number {0} is not strictly positive";
  28.     /** Error message for "too large" condition. */
  29.     public static final String TOO_LARGE = "Number {0} is larger than {1}";
  30.     /** Error message for "size mismatch" condition. */
  31.     public static final String SIZE_MISMATCH = "Size mismatch: {0} != {1}";
  32.     /** Error message for "pow(2, n) + 1". */
  33.     public static final String NOT_POWER_OF_TWO_PLUS_ONE = "{0} is not equal to 1 + pow(2, n), for some n";
  34.     /** Error message for "pow(2, n)". */
  35.     public static final String NOT_POWER_OF_TWO = "{0} is not equal to pow(2, n), for some n";

  36.     /** Serializable version identifier. */
  37.     private static final long serialVersionUID = 20210522L;

  38.     /**
  39.      * Create an exception where the message is constructed by applying
  40.      * the {@code format()} method from {@code java.text.MessageFormat}.
  41.      *
  42.      * @param message Message format (with replaceable parameters).
  43.      * @param formatArguments Actual arguments to be displayed in the message.
  44.      */
  45.     TransformException(String message, Object... formatArguments) {
  46.         super(MessageFormat.format(message, formatArguments));
  47.     }
  48. }