1 18 19 package alt.jiapi.reflect; 20 21 import java.util.LinkedList ; 22 23 import alt.jiapi.reflect.Instruction; 24 import alt.jiapi.reflect.InstructionList; 25 26 33 public class TryBlock { 34 private InstructionList instructions; 35 private LinkedList exceptionHandlers = new LinkedList (); 36 37 TryBlock(InstructionList instructions) { 39 this.instructions = instructions; 40 } 41 42 void addExceptionHandler(String name, Instruction handlerStart) { 44 exceptionHandlers.add(new ExceptionHandler(name, handlerStart)); 45 } 46 47 51 public ExceptionHandler[] getExceptionHandlers() { 52 ExceptionHandler[] handlers = 53 new ExceptionHandler[exceptionHandlers.size()]; 54 handlers = (ExceptionHandler[])exceptionHandlers.toArray(handlers); 55 56 return handlers; 57 } 58 59 64 public InstructionList getInstructionList() { 65 return instructions; 66 } 67 68 72 public class ExceptionHandler { 73 private Instruction handlerStart; 74 private String name; 75 76 ExceptionHandler(String name, Instruction handlerStart) { 78 this.name = name; 79 this.handlerStart = handlerStart; 80 } 81 82 91 public Instruction getHandlerStart() { 92 return handlerStart; 93 } 94 95 99 public String getName() { 100 return name; 101 } 102 } 103 } 104 105 | Popular Tags |