mev-4.0.01/source/org/tigr/microarray/mev/cluster/algorithm/AlgorithmException.java

Code
Comments
Other
Rev Date Author Line
2 26 Feb 07 jari 1 /*
2 26 Feb 07 jari 2 Copyright @ 1999-2003, The Institute for Genomic Research (TIGR).
2 26 Feb 07 jari 3 All rights reserved.
2 26 Feb 07 jari 4 */
2 26 Feb 07 jari 5 /*
2 26 Feb 07 jari 6  * $RCSfile: AlgorithmException.java,v $
2 26 Feb 07 jari 7  * $Revision: 1.3 $
2 26 Feb 07 jari 8  * $Date: 2005/03/10 15:46:10 $
2 26 Feb 07 jari 9  * $Author: braistedj $
2 26 Feb 07 jari 10  * $State: Exp $
2 26 Feb 07 jari 11  */
2 26 Feb 07 jari 12 package org.tigr.microarray.mev.cluster.algorithm;
2 26 Feb 07 jari 13
2 26 Feb 07 jari 14 /**
2 26 Feb 07 jari 15  * Signals that an algorithm exception of some sort has occurred. This
2 26 Feb 07 jari 16  * class is the general class of exceptions produced by failed or
2 26 Feb 07 jari 17  * interrupted calculation operations.
2 26 Feb 07 jari 18  *
2 26 Feb 07 jari 19  * @version 1.0
2 26 Feb 07 jari 20  * @author Aleksey D.Rezantsev
2 26 Feb 07 jari 21  */
2 26 Feb 07 jari 22 public class AlgorithmException extends Exception {
2 26 Feb 07 jari 23     
2 26 Feb 07 jari 24     /**
2 26 Feb 07 jari 25      * Field exception specifies a wrapped exception. May be null.
2 26 Feb 07 jari 26      */
2 26 Feb 07 jari 27     private Exception exception;
2 26 Feb 07 jari 28     
2 26 Feb 07 jari 29     /**
2 26 Feb 07 jari 30      * Constructs an <code>AlgorithmException</code> with the specified detail
2 26 Feb 07 jari 31      * message.
2 26 Feb 07 jari 32      *
2 26 Feb 07 jari 33      * @param s the detail message.
2 26 Feb 07 jari 34      */
2 26 Feb 07 jari 35     public AlgorithmException(String s) {
2 26 Feb 07 jari 36   super(s);
2 26 Feb 07 jari 37     }
2 26 Feb 07 jari 38     
2 26 Feb 07 jari 39     /**
2 26 Feb 07 jari 40      * Create a new <code>AlgorithmException</code> wrapping an existing exception.
2 26 Feb 07 jari 41      *
2 26 Feb 07 jari 42      * @param exception the exception to be wrapped.
2 26 Feb 07 jari 43      */
2 26 Feb 07 jari 44     public AlgorithmException(Exception exception) {
2 26 Feb 07 jari 45   this.exception = exception;
2 26 Feb 07 jari 46     }
2 26 Feb 07 jari 47     
2 26 Feb 07 jari 48     /**
2 26 Feb 07 jari 49      * Returns the error message string.
2 26 Feb 07 jari 50      */
2 26 Feb 07 jari 51     public String getMessage() {
2 26 Feb 07 jari 52   if (isInternal()) {
2 26 Feb 07 jari 53       return getInternal().getMessage();
2 26 Feb 07 jari 54   }
2 26 Feb 07 jari 55   return super.getMessage();
2 26 Feb 07 jari 56     }
2 26 Feb 07 jari 57     
2 26 Feb 07 jari 58     /**
2 26 Feb 07 jari 59      * Returns true if the wrapped exception is not null.
2 26 Feb 07 jari 60      */
2 26 Feb 07 jari 61     public boolean isInternal() {
2 26 Feb 07 jari 62   return exception != null;
2 26 Feb 07 jari 63     }
2 26 Feb 07 jari 64     
2 26 Feb 07 jari 65     /**
2 26 Feb 07 jari 66      * Returns the wrapped exception.
2 26 Feb 07 jari 67      */
2 26 Feb 07 jari 68     public Exception getInternal() {
2 26 Feb 07 jari 69   return exception;
2 26 Feb 07 jari 70     }
2 26 Feb 07 jari 71     
2 26 Feb 07 jari 72     /**
2 26 Feb 07 jari 73      * Prints this <code>AlgorithmException</code> and its backtrace to the
2 26 Feb 07 jari 74      * specified print stream.
2 26 Feb 07 jari 75      *
2 26 Feb 07 jari 76      * @param s <code>PrintStream</code> to use for output.
2 26 Feb 07 jari 77      */
2 26 Feb 07 jari 78     public void printStackTrace(java.io.PrintStream s) {
2 26 Feb 07 jari 79   super.printStackTrace(s);
2 26 Feb 07 jari 80   if (isInternal()) {
2 26 Feb 07 jari 81       getInternal().printStackTrace(s);
2 26 Feb 07 jari 82   }
2 26 Feb 07 jari 83     }
2 26 Feb 07 jari 84 }