Browse Source

Useful function to search through Distributed Object collection by class type

Abhishek Nath 16 years ago
parent
commit
a36f345131
1 changed files with 11 additions and 1 deletions
  1. 11 1
      direct/src/distributed/DoCollectionManager.py

+ 11 - 1
direct/src/distributed/DoCollectionManager.py

@@ -79,7 +79,17 @@ class DoCollectionManager:
             if re.search(str,`value`):
             if re.search(str,`value`):
                 matches.append(value)
                 matches.append(value)
         return matches
         return matches
-
+        
+    def doFindAllOfType(self, query):
+        """
+        Useful method for searching through the Distributed Object collection 
+        for objects of a particular type
+        """
+        matches = []
+        for value in self.doId2do.values():
+            if query in str(value.__class__):
+                matches.append(value)
+        return matches, len(matches)
 
 
     def _getDistanceFromLA(self, do):
     def _getDistanceFromLA(self, do):
         if hasattr(do, 'getPos'):
         if hasattr(do, 'getPos'):