| 1 | package desmoj.core.exception; |
| 2 | |
| 3 | import desmoj.core.report.ErrorMessage; |
| 4 | import desmoj.core.simulator.Model; |
| 5 | import desmoj.core.simulator.TimeInstant; |
| 6 | |
| 7 | /** |
| 8 | * Exception is thrown to indicate that the simulation has finished properly. It |
| 9 | * is needed to unlock all threads still alive after the simulation has reached |
| 10 | * its criterium to stop. Users must not make use of it nor is this exception |
| 11 | * supposed to be caught by users. Its use inside the DESMOJ framework is |
| 12 | * transparent because it is derived from <code>RuntimeException</code> which |
| 13 | * isthe root for a tree of exceptions that are automatically rethrown by any |
| 14 | * Java method thus not needing to be rethrown by the user, too. |
| 15 | * |
| 16 | * @version DESMO-J, Ver. 2.3.3 copyright (c) 2011 |
| 17 | * @author Tim Lechler |
| 18 | * |
| 19 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 20 | * you may not use this file except in compliance with the License. You |
| 21 | * may obtain a copy of the License at |
| 22 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 23 | * |
| 24 | * Unless required by applicable law or agreed to in writing, software |
| 25 | * distributed under the License is distributed on an "AS IS" |
| 26 | * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
| 27 | * or implied. See the License for the specific language governing |
| 28 | * permissions and limitations under the License. |
| 29 | * |
| 30 | */ |
| 31 | public class SimFinishedException extends DESMOJException { |
| 32 | /** |
| 33 | * Constructs a SimFinishedException inserting the given position String and |
| 34 | * the given simulation time in the ErrorMessage documenting this exception. |
| 35 | * |
| 36 | * @param position |
| 37 | * java.lang.String : contains the position, i.e. Object and |
| 38 | * method that throws this exception |
| 39 | * @param time |
| 40 | * TimeInstant : The point in simulation time that this exception is |
| 41 | * thrown |
| 42 | */ |
| 43 | public SimFinishedException(Model origin, String position, TimeInstant time) { |
| 44 | |
| 45 | super(new ErrorMessage(origin, "SimFinishedException thrown!", |
| 46 | "Position " + position, "Simulation has come to an end.", |
| 47 | "No Error.", time)); |
| 48 | |
| 49 | } |
| 50 | } |