Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

TargetLostException.java

00001 package de.fub.bytecode.generic;
00002 
00003 /**
00004  * Thrown by InstructionList.remove() when one or multiple disposed instruction
00005  * are still being referenced by a InstructionTargeter object. I.e. the
00006  * InstructionTargeter has to be notified that (one of) the InstructionHandle it
00007  * is referencing is being removed from the InstructionList and thus not valid anymore.
00008  *
00009  * Making this an exception instead of a return value forces the user to handle
00010  * these case explicitely in a try { ... } catch. The following code illustrates
00011  * how this may be done:
00012  *
00013  * <PRE>
00014  *     ...
00015  *     try {
00016  *  il.delete(start_ih, end_ih);
00017  *     } catch(TargetLostException e) {
00018  *       InstructionHandle[] targets = e.getTargets();
00019  *   for(int i=0; i < targets.length; i++) {
00020  *     InstructionTargeter[] targeters = targets[i].getTargeters();
00021  *     
00022  *     for(int j=0; j < targeters.length; j++)
00023  *       targeters[j].updateTarget(targets[i], new_target);
00024  *       }
00025  *     }
00026  * </PRE>
00027  *
00028  * @see InstructionHandle
00029  * @see InstructionList
00030  * @see InstructionTargeter
00031  * @version $Id: TargetLostException.java,v 1.1.1.1 2002/01/24 03:44:04 pserver Exp $
00032  * @author  <A HREF="http://www.inf.fu-berlin.de/~dahm">M. Dahm</A>
00033  */
00034 public final class TargetLostException extends Exception {
00035   private InstructionHandle[] targets;
00036 
00037   TargetLostException(InstructionHandle[] t, String mesg) {
00038     super(mesg);
00039     targets = t;
00040   }  
00041   /**
00042    * @return list of instructions still being targeted.
00043    */
00044   public InstructionHandle[] getTargets() { return targets; }  
00045 }

Generated at Thu Feb 7 06:56:13 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001