Пример #1
0
 public boolean isFilterInTable(Filter filter) {
   Collection val = data.values();
   synchronized (data) {
     Iterator it = val.iterator();
     Collection c;
     while (it.hasNext()) {
       c = (Collection) it.next();
       if (c.contains(filter)) return true;
     }
   }
   return false;
 }
Пример #2
0
 public Collection getAllFiltersExcept(boolean duplicate, NodeDescriptor n) {
   Collection result = new ArrayList();
   Set keys = data.keySet();
   synchronized (data) {
     Iterator it = keys.iterator();
     NodeDescriptor currentNeighbor;
     while (it.hasNext()) {
       currentNeighbor = (NodeDescriptor) it.next();
       if (currentNeighbor.equals(n)) continue; // skip neighbor n
       Collection filters = (Collection) data.get(currentNeighbor);
       if (duplicate) result.addAll(filters);
       else {
         Iterator it1 = filters.iterator();
         while (it1.hasNext()) {
           Filter f = (Filter) it1.next();
           if (!result.contains(f)) result.add(f);
         }
       }
     }
   }
   return result;
 }