@@ -0,0 +1,2317 @@
+package de.darthpumpkin.pkmnlib;%0A%0A/**%0A * Thrown to indicate that a %7B@link Team%7D has been expanded above its allowed%0A * maximum size.%0A * %0A * @author dominik%0A * %0A */%0Apublic class MaximumSizeExceededException extends RuntimeException %7B%0A%0A%09private final Integer maxSize;%0A%09private final Integer previousSize;%0A%09private final Integer newElements;%0A%0A%09/**%0A%09 * Constructs a MaximumSizeExceededException with a message telling what was%0A%09 * the allowed maximum size.%0A%09 * %0A%09 * @param maxSize%0A%09 *            the exceeded maximum size.%0A%09 */%0A%09public MaximumSizeExceededException(Integer maxSize) %7B%0A%09%09super(%22Maximum size of %22 + maxSize + %22 exceeded%22);%0A%09%09this.maxSize = maxSize;%0A%09%09this.previousSize = null;%0A%09%09this.newElements = null;%0A%09%7D%0A%0A%09/**%0A%09 * Constructs a MaximumSizeExceededException with a message telling what was%0A%09 * the allowed maximum size and how many elements were added to the team as%0A%09 * well as how large the team was before the addition.%0A%09 * %0A%09 * @param maxSize%0A%09 *            the exceeded maximum size.%0A%09 * @param previousSize%0A%09 *            the size before the insertion.%0A%09 * @param newElements%0A%09 *            the amount of new elements added to the team.%0A%09 */%0A%09public MaximumSizeExceededException(Integer maxSize, Integer previousSize,%0A%09%09%09Integer newElements) %7B%0A%09%09super(%22Maximum size of %22 + maxSize + %22 exceeded when trying to add %22%0A%09%09%09%09+ newElements + (newElements == 1 ? %22 element%22 : %22 elements%22)%0A%09%09%09%09+ %22 to a team of size %22 + previousSize);%0A%09%09this.maxSize = maxSize;%0A%09%09this.previousSize = previousSize;%0A%09%09this.newElements = newElements;%0A%09%7D%0A%0A%09/**%0A%09 * Returns the maximum size of the Collection whose size was exceeded.%0A%09 * %0A%09 * @return the maximum size%0A%09 */%0A%09public Integer maxSize() %7B%0A%09%09return this.maxSize;%0A%09%7D%0A%0A%09/**%0A%09 * Returns the amount of elements in the Collection before the attempt to%0A%09 * perform the manipulation that caused this Exception.%0A%09 * %0A%09 * @return the amount of elements in the Collection or null if it has not%0A%09 *         been set%0A%09 */%0A%09public Integer previousSize() %7B%0A%09%09return this.previousSize;%0A%09%7D%0A%0A%09/**%0A%09 * Returns the amount of elements that were attempted to insert into the%0A%09 * Collection that cauesed this Exception.%0A%09 * %0A%09 * @return the amount of elements attempted to insert or null if it has not%0A%09 *         been set%0A%09 */%0A%09public Integer newElements() %7B%0A%09%09return this.newElements;%0A%09%7D%0A%7D%0A

Define exception for exceeding the maximum size of a UniqueBoundedList