public boolean equals(Object obj) { if (obj == null || (obj instanceof ListenerRegistration) == false) return false; ListenerRegistration other = (ListenerRegistration) obj; if (getRegisteredListener().equals(other.getRegisteredListener()) == false) return false; NotificationFilter myFilter = getRegisteredFilter(); NotificationFilter otherFilter = other.getRegisteredFilter(); if (myFilter != null && myFilter.equals(otherFilter) == false) return false; else if (myFilter == null && otherFilter != null) return false; Object myHandback = getHandback(); Object otherHandback = other.getHandback(); if (myHandback != null && myHandback.equals(otherHandback) == false) return false; else if (myHandback == null && otherHandback != null) return false; return true; }
public void sendNotification(Notification notification) { ListenerRegistry.ListenerRegistrationIterator iterator = registry.iterator(); while (iterator.hasNext()) { ListenerRegistration registration = iterator.nextRegistration(); NotificationFilter filter = registration.getFilter(); if (filter == null) handleNotification(registration.getListener(), notification, registration.getHandback()); else if (filter.isNotificationEnabled(notification)) handleNotification(registration.getListener(), notification, registration.getHandback()); } }