public static boolean containsType(VMListener listener, Class<?> type) {
    if (listener == null) {
      return false;
    }

    if (listener instanceof VMListenerMulticaster) {
      VMListenerMulticaster l = (VMListenerMulticaster) listener;
      while (l != null) {
        if (type.isAssignableFrom(l.tail.getClass())) {
          return true;
        }
        if (l.head instanceof VMListenerMulticaster) {
          l = (VMListenerMulticaster) l.head;
        } else {
          return type.isAssignableFrom(l.head.getClass());
        }
      }
      return false;

    } else {
      return type.isAssignableFrom(listener.getClass());
    }
  }
 public void exceptionBailout(JVM vm) {
   head.exceptionBailout(vm);
   tail.exceptionBailout(vm);
 }
 public void exceptionThrown(JVM vm) {
   head.exceptionThrown(vm);
   tail.exceptionThrown(vm);
 }
 public void gcEnd(JVM vm) {
   head.gcEnd(vm);
   tail.gcEnd(vm);
 }
 public void instructionExecuted(JVM vm) {
   head.instructionExecuted(vm);
   tail.instructionExecuted(vm);
 }
 public void choiceGeneratorProcessed(JVM vm) {
   head.choiceGeneratorProcessed(vm);
   tail.choiceGeneratorProcessed(vm);
 }
 public void choiceGeneratorSet(JVM vm) {
   head.choiceGeneratorSet(vm);
   tail.choiceGeneratorSet(vm);
 }
 public void objectWait(JVM vm) {
   head.objectWait(vm);
   tail.objectWait(vm);
 }
 public void threadScheduled(JVM vm) {
   head.threadScheduled(vm);
   tail.threadScheduled(vm);
 }
 public void threadTerminated(JVM vm) {
   head.threadTerminated(vm);
   tail.threadTerminated(vm);
 }
 public void threadBlocked(JVM vm) {
   head.threadBlocked(vm);
   tail.threadBlocked(vm);
 }
 public void threadInterrupted(JVM vm) {
   head.threadInterrupted(vm);
   tail.threadInterrupted(vm);
 }
 public void threadNotified(JVM vm) {
   head.threadNotified(vm);
   tail.threadNotified(vm);
 }
 public void threadWaiting(JVM vm) {
   head.threadWaiting(vm);
   tail.threadWaiting(vm);
 }
 public void threadStarted(JVM vm) {
   head.threadStarted(vm);
   tail.threadStarted(vm);
 }
 public void exceptionHandled(JVM vm) {
   head.exceptionHandled(vm);
   tail.exceptionHandled(vm);
 }
 public void objectUnlocked(JVM vm) {
   head.objectUnlocked(vm);
   tail.objectUnlocked(vm);
 }
 public void classLoaded(JVM vm) {
   head.classLoaded(vm);
   tail.classLoaded(vm);
 }
 public void objectNotifyAll(JVM vm) {
   head.objectNotifyAll(vm);
   tail.objectNotifyAll(vm);
 }
 public void objectCreated(JVM vm) {
   head.objectCreated(vm);
   tail.objectCreated(vm);
 }
 public void choiceGeneratorAdvanced(JVM vm) {
   head.choiceGeneratorAdvanced(vm);
   tail.choiceGeneratorAdvanced(vm);
 }
 public void objectReleased(JVM vm) {
   head.objectReleased(vm);
   tail.objectReleased(vm);
 }
 public void gcBegin(JVM vm) {
   head.gcBegin(vm);
   tail.gcBegin(vm);
 }
 public void executeInstruction(JVM vm) {
   head.executeInstruction(vm);
   tail.executeInstruction(vm);
 }