public static int waiting(int d,Predicate p){
  int count=0;
  SimEvent event;
  Iterator<SimEvent> iterator=deferred.iterator();
  while (iterator.hasNext()) {
    event=iterator.next();
    if ((event.getDestination() == d) && (p.match(event))) {
      count++;
    }
  }
  return count;
}

public static int waiting ( int d , Predicate p ) { int count = 0 ; SimEvent event ; Iterator < SimEvent > iterator = deferred . iterator ( ) ; while ( iterator . hasNext ( ) ) { event = iterator . next ( ) ; if ( ( event . getDestination ( ) == d ) && ( p . match ( event ) ) ) { count ++ ; } } return count ; }
checks if events for a specific entity are present in the deferred event queue .
