Coverage Report - eu.simuline.octave.exception.OctaveException
 
Classes in this File Line Coverage Branch Coverage Complexity
OctaveException
83%
10/12
N/A
1
 
 1  
 /*
 2  
  * Copyright 2008, 2009 Ange Optimization ApS
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *     http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package eu.simuline.octave.exception;
 17  
 
 18  
 import eu.simuline.octave.exec.OctaveExec; // for javadoc only 
 19  
 
 20  
 /**
 21  
  * Base exception class for the JavaOctave project. 
 22  
  * RuntimeException which handles the destroyed marker. 
 23  
  * Special methods: {@link #setDestroyed(boolean)} and {@link #isDestroyed()}. 
 24  
  * Note that derived classes shall implement all constructors ****. 
 25  
  */
 26  
 public abstract class OctaveException extends RuntimeException {
 27  
 
 28  
     /**
 29  
      * Set to true on exceptions thrown from an Octave object 
 30  
      * when the reason for the exception is that the object has 
 31  
      * been asked to destroy its octave process. 
 32  
      */
 33  72
     private boolean destroyed = false;
 34  
 
 35  
     /**
 36  
      * Constructor. 
 37  
      *
 38  
      * @see Throwable
 39  
      */
 40  0
     public OctaveException() {
 41  
         // Do nothing
 42  0
     }
 43  
 
 44  
     /**
 45  
      * Constructor. 
 46  
      *
 47  
      * @param message
 48  
      * @see Throwable
 49  
      */
 50  
     public OctaveException(final String message) {
 51  10
         super(message);
 52  10
     }
 53  
 
 54  
     /**
 55  
      * Constructor. 
 56  
      *
 57  
      * @param cause
 58  
      * @see Throwable
 59  
      */
 60  
     public OctaveException(final Throwable cause) {
 61  4
         super(cause);
 62  4
     }
 63  
 
 64  
     /**
 65  
      * Constructor 
 66  
      * required by {@link  OctaveExec#reInstException(OctaveException)}. 
 67  
      *
 68  
      * @param message
 69  
      * @param cause
 70  
      * @see Throwable
 71  
      */
 72  
     public OctaveException(final String message, final Throwable cause) {
 73  58
         super(message, cause);
 74  58
     }
 75  
 
 76  
     /**
 77  
      * @return destroyed
 78  
      */
 79  
     public final boolean isDestroyed() {
 80  26
         return this.destroyed;
 81  
     }
 82  
 
 83  
     /**
 84  
      * @param destroyed
 85  
      */
 86  
     public final void setDestroyed(final boolean destroyed) {
 87  12
         this.destroyed = destroyed;
 88  12
     }
 89  
 
 90  
 }