|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| CheckException.java | - | 33,3% | 25% | 30% |
|
||||||||||||||
| 1 | /* $Id: CheckException.java,v 1.5 2006/10/20 20:23:03 m31 Exp $ | |
| 2 | * | |
| 3 | * This file is part of the project "Hilbert II" - http://www.qedeq.org | |
| 4 | * | |
| 5 | * Copyright 2000-2006, Michael Meyling <mime@qedeq.org>. | |
| 6 | * | |
| 7 | * "Hilbert II" is free software; you can redistribute | |
| 8 | * it and/or modify it under the terms of the GNU General Public | |
| 9 | * License as published by the Free Software Foundation; either | |
| 10 | * version 2 of the License, or (at your option) any later version. | |
| 11 | * | |
| 12 | * This program is distributed in the hope that it will be useful, | |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | * GNU General Public License for more details. | |
| 16 | */ | |
| 17 | ||
| 18 | package org.qedeq.kernel.bo.logic; | |
| 19 | ||
| 20 | import org.qedeq.kernel.base.list.Element; | |
| 21 | import org.qedeq.kernel.bo.module.ModuleDataException; | |
| 22 | import org.qedeq.kernel.context.ModuleContext; | |
| 23 | ||
| 24 | /** | |
| 25 | * This is an exception for logical errors within a QEDEQ module. | |
| 26 | * | |
| 27 | * @version $Revision: 1.5 $ | |
| 28 | * @author Michael Meyling | |
| 29 | */ | |
| 30 | public abstract class CheckException extends ModuleDataException { | |
| 31 | ||
| 32 | /** | |
| 33 | * This element causes the error. | |
| 34 | */ | |
| 35 | private final Element element; | |
| 36 | ||
| 37 | /** | |
| 38 | * Constructs an exception. | |
| 39 | * | |
| 40 | * @param errorCode ErrorCode of this message. | |
| 41 | * @param message What is the problem. | |
| 42 | * @param element Problematic line. | |
| 43 | * @param context Error location. | |
| 44 | * @param referenceContext Reference location. | |
| 45 | */ | |
| 46 | 0 | public CheckException(final int errorCode, final String message, final Element element, |
| 47 | final ModuleContext context, final ModuleContext referenceContext) { | |
| 48 | 0 | super(errorCode, message, context, referenceContext); |
| 49 | 0 | this.element = element; |
| 50 | } | |
| 51 | ||
| 52 | /** | |
| 53 | * Constructs an exception. | |
| 54 | * | |
| 55 | * @param errorCode ErrorCode of this message. | |
| 56 | * @param message What is the problem. | |
| 57 | * @param element Problematic formula. | |
| 58 | * @param context Error location. | |
| 59 | */ | |
| 60 | 6539 | public CheckException(final int errorCode, final String message, |
| 61 | final Element element, final ModuleContext context) { | |
| 62 | 6539 | super(errorCode, message, context); |
| 63 | 6539 | this.element = element; |
| 64 | } | |
| 65 | ||
| 66 | /** | |
| 67 | * Get the element. | |
| 68 | * | |
| 69 | * @return element, that should have been a symbol | |
| 70 | */ | |
| 71 | 0 | public final Element getElement() { |
| 72 | 0 | return this.element; |
| 73 | } | |
| 74 | ||
| 75 | /** | |
| 76 | * Returns a short description of this throwable. | |
| 77 | * If this <code>Throwable</code> object was created with a non-null detail | |
| 78 | * message string, then the result is the concatenation of five strings: | |
| 79 | * <ul> | |
| 80 | * <li>The name of the actual class of this object | |
| 81 | * <li>": " (a colon and a space) | |
| 82 | * <li>The result of the {@link Throwable#getMessage()} method for this object | |
| 83 | * <li>"\n" (a newline) | |
| 84 | * <li>A string representation of the {@link #getElement()} method for this object | |
| 85 | * </ul> | |
| 86 | * | |
| 87 | * @return a string representation of this throwable. | |
| 88 | */ | |
| 89 | 0 | public final String toString() { |
| 90 | 0 | return super.toString() + "\n" + getElement().toString(); |
| 91 | } | |
| 92 | ||
| 93 | } |
|
||||||||||