Revision: 541
Author: allain.lalonde
Date: Tue Jul 21 07:33:17 2009
Log: Made PNotificationCenter matchingKeys use NotificationKey.equals as  
opposed to reproducing the logic.
http://code.google.com/p/piccolo2d/source/detail?r=541

Modified:
   
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/event/PNotificationCenter.java

=======================================
---  
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/event/PNotificationCenter.java
    
Tue Jul 21 07:24:46 2009
+++  
/piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/event/PNotificationCenter.java
    
Tue Jul 21 07:33:17 2009
@@ -216,7 +216,8 @@
                  if (listenersList != null) {
                      mergedListeners.addAll(listenersList);
                  }
-            } else { // both are specified
+            }
+            else { // both are specified
                  listenersList = (List) listenersMap.get(new  
NotificationKey(name, object));
                  if (listenersList != null) {
                      mergedListeners.addAll(listenersList);
@@ -228,7 +229,7 @@
                  listenersList = (List) listenersMap.get(new  
NotificationKey(NULL_MARKER, object));
                  if (listenersList != null) {
                      mergedListeners.addAll(listenersList);
-                }
+                }
              }
          }
          else if (object != null) { // name is null
@@ -279,13 +280,12 @@
      protected List matchingKeys(String name, Object object) {
          List result = new LinkedList();

+        NotificationKey searchKey = new NotificationKey(name, object);
          Iterator it = listenersMap.keySet().iterator();
          while (it.hasNext()) {
              NotificationKey key = (NotificationKey) it.next();
-            if (name == null || name.equals(key.name())) {
-                if ((object == null) || (object == key.get())) {
-                    result.add(key);
-                }
+            if (searchKey.equals(key)) {
+                result.add(key);
              }
          }

@@ -400,7 +400,7 @@
                  return false;

              Object o = get();
-
+
              return (o != null) && (o == target.get());
          }


--~--~---------~--~----~------------~-------~--~----~
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to