View Javadoc
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  
19  import java.text.MessageFormat;
20  
21  /**
22   * Exception class with constants for frequently used messages.
23   * Class is package-private (for internal use only).
24   */
25  class TransformException extends IllegalArgumentException {
26      /** Error message for "out of range" condition. */
27      public static final String FIRST_ELEMENT_NOT_ZERO = "First element ({0}) must be 0";
28      /** Error message for "not strictly positive" condition. */
29      public static final String NOT_STRICTLY_POSITIVE = "Number {0} is not strictly positive";
30      /** Error message for "too large" condition. */
31      public static final String TOO_LARGE = "Number {0} is larger than {1}";
32      /** Error message for "size mismatch" condition. */
33      public static final String SIZE_MISMATCH = "Size mismatch: {0} != {1}";
34      /** Error message for "pow(2, n) + 1". */
35      public static final String NOT_POWER_OF_TWO_PLUS_ONE = "{0} is not equal to 1 + pow(2, n), for some n";
36      /** Error message for "pow(2, n)". */
37      public static final String NOT_POWER_OF_TWO = "{0} is not equal to pow(2, n), for some n";
38  
39      /** Serializable version identifier. */
40      private static final long serialVersionUID = 20210522L;
41  
42      /**
43       * Create an exception where the message is constructed by applying
44       * the {@code format()} method from {@code java.text.MessageFormat}.
45       *
46       * @param message Message format (with replaceable parameters).
47       * @param formatArguments Actual arguments to be displayed in the message.
48       */
49      TransformException(String message, Object... formatArguments) {
50          super(MessageFormat.format(message, formatArguments));
51      }
52  }