NeuralNetException.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.neuralnet.internal;

  18. import java.text.MessageFormat;

  19. /**
  20.  * Exception class with constants for frequently used messages.
  21.  */
  22. public class NeuralNetException extends IllegalArgumentException {
  23.     /** Error message for "out of range" condition. */
  24.     public static final String OUT_OF_RANGE = "Number {0} is out of range [{1}, {2}]";
  25.     /** Error message for "not strictly positive" condition. */
  26.     public static final String NOT_STRICTLY_POSITIVE = "Number {0} is not strictly positive";
  27.     /** Error message for "too large" condition. */
  28.     public static final String TOO_LARGE = "Number {0} is larger than {1}";
  29.     /** Error message for "too small" condition. */
  30.     public static final String TOO_SMALL = "Number {0} is smaller than {1}";
  31.     /** Error message for "out of range" condition. */
  32.     public static final String NO_DATA = "No data";
  33.     /** Error message for "size mismatch" condition. */
  34.     public static final String SIZE_MISMATCH = "Size mismatch: {0} != {1}";
  35.     /** Error message for "identifier already used" condition. */
  36.     public static final String ID_IN_USE = "Identifier already in use: {0}";
  37.     /** Error message for "identifier not found" condition. */
  38.     public static final String ID_NOT_FOUND = "Identifier not found: {0}";

  39.     /** Serializable version identifier. */
  40.     private static final long serialVersionUID = 20210515L;

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