| 1 | /* |
| 2 | * JTiger Unit Testing Framework for J2SE 1.5 |
| 3 | * Copyright (C) 2005 Tony Morris |
| 4 | * |
| 5 | * This software is licenced under the |
| 6 | * Common Public Licence version 1.0 |
| 7 | * http://www.opensource.org/licenses/cpl1.0.php |
| 8 | * |
| 9 | * You received a copy of this licence with this software. |
| 10 | */ |
| 11 | package org.jtiger.framework; |
| 12 | |
| 13 | /** |
| 14 | * An exception that is thrown when a structure's position is specified that is outside of the permissible bounds for |
| 15 | * that structure. |
| 16 | * |
| 17 | * @author %javadoc.author.tag% |
| 18 | * @version %version%<br/> |
| 19 | * <i>Build Number %build.number%</i><br/> |
| 20 | * <i>Build Time %build.time%</i> |
| 21 | */ |
| 22 | public final class PositionOutOfBoundsException extends RuntimeException implements Positionable |
| 23 | { |
| 24 | private int position; |
| 25 | |
| 26 | /** |
| 27 | * Construct a <tt>PositionOutOfBoundsException</tt> with the given position. |
| 28 | * |
| 29 | * @param position The position that is outside of the permissible bounds. |
| 30 | */ |
| 31 | public PositionOutOfBoundsException(final int position) |
| 32 | { |
| 33 | this.position = position; |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Construct a <tt>PositionOutOfBoundsException</tt> with the given position and message. |
| 38 | * |
| 39 | * @param position The position that is outside of the permissible bounds. |
| 40 | * @param message The exception message. |
| 41 | */ |
| 42 | public PositionOutOfBoundsException(final int position, final String message) |
| 43 | { |
| 44 | super(message); |
| 45 | |
| 46 | this.position = position; |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Construct a <tt>PositionOutOfBoundsException</tt> with the given position and cause. |
| 51 | * |
| 52 | * @param position The position that is outside of the permissible bounds. |
| 53 | * @param cause The cause of this exception. |
| 54 | */ |
| 55 | public PositionOutOfBoundsException(final int position, final Throwable cause) |
| 56 | { |
| 57 | super(cause); |
| 58 | |
| 59 | this.position = position; |
| 60 | } |
| 61 | |
| 62 | |
| 63 | /** |
| 64 | * Construct a <tt>PositionOutOfBoundsException</tt> with the given position, message and cause. |
| 65 | * |
| 66 | * @param position The position that is outside of the permissible bounds. |
| 67 | * @param message The exception message. |
| 68 | * @param cause The cause of this exception. |
| 69 | */ |
| 70 | public PositionOutOfBoundsException(final int position, final String message, final Throwable cause) |
| 71 | { |
| 72 | super(message, cause); |
| 73 | |
| 74 | this.position = position; |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Returns the position that is outside of the permissible bounds for this structure. |
| 79 | * |
| 80 | * @return The position that is outside of the permissible bounds for this structure. |
| 81 | */ |
| 82 | public int getPosition() |
| 83 | { |
| 84 | return position; |
| 85 | } |
| 86 | } |