//Matrix/src/main/java/com/mattrixwv/exceptions/InvalidCoordinatesException.java //Mattrixwv // Created: 02-01-22 //Modified: 08-08-24 package com.mattrixwv.matrix.exceptions; /** * Exception thrown to indicate that a set of coordinates is invalid for a given matrix. * * @author Mattrixwv */ public class InvalidCoordinatesException extends RuntimeException{ /** * Serialization identifier for this class. */ public static final long serialVersionUID = 1; /** * Constructs a new {@code InvalidCoordinatesException} with {@code null} as its detail message. * The cause is not initialized, and may subsequently be initialized by a call to {@link #initCause}. */ public InvalidCoordinatesException(){ super(); } /** * Constructs a new {@code InvalidCoordinatesException} with the specified detail message. * The cause is not initialized, and may subsequently be initialized by a call to {@link #initCause}. * * @param message the detail message, which is saved for later retrieval by the {@link #getMessage()} method. */ public InvalidCoordinatesException(String message){ super(message); } /** * Constructs a new {@code InvalidCoordinatesException} with the specified cause and a detail message of * {@code (cause==null ? null : cause.toString())} (which typically contains the class and detail message * of {@code cause}). This constructor is useful for exceptions that are wrappers for other exceptions. * * @param throwable the cause (which is saved for later retrieval by the {@link #getCause()} method). * (A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.) */ public InvalidCoordinatesException(Throwable throwable){ super(throwable); } /** * Constructs a new {@code InvalidCoordinatesException} with the specified detail message and cause. * * @param message the detail message, which is saved for later retrieval by the {@link #getMessage()} method. * @param throwable the cause (which is saved for later retrieval by the {@link #getCause()} method). * (A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.) */ public InvalidCoordinatesException(String message, Throwable throwable){ super(message, throwable); } /** * Constructs a new {@code InvalidCoordinatesException} with a default message indicating an invalid number * of elements provided. The message is constructed using the given number of elements and the maximum * allowed number of elements. * * @param givenElements the number of elements that were provided and deemed invalid. * @param neededElements the maximum number of elements that was expected or allowed. */ public InvalidCoordinatesException(int givenElements, int neededElements){ super("Invalid number of elements " + givenElements + " must be at most " + neededElements); } }