Пример #1
0
 @SuppressWarnings("unchecked")
 public <T extends CatalogType> Histogram<T> buildHistogramForType(Class<T> search_key) {
   Histogram<T> h = new ObjectHistogram<T>();
   for (CatalogPair e : this) {
     if (ClassUtil.getSuperClasses(e.getFirst().getClass()).contains(search_key)) {
       h.put((T) e.getFirst());
     }
     if (ClassUtil.getSuperClasses(e.getSecond().getClass()).contains(search_key)) {
       h.put((T) e.getSecond());
     }
   } // FOR
   return (h);
 }
Пример #2
0
 @SuppressWarnings("unchecked")
 public <T extends CatalogType> Collection<T> findAllForType(Class<T> search_key) {
   List<T> found = new ArrayList<T>();
   for (CatalogPair e : this) {
     if (ClassUtil.getSuperClasses(e.getFirst().getClass()).contains(search_key)) {
       found.add((T) e.getFirst());
     }
     if (ClassUtil.getSuperClasses(e.getSecond().getClass()).contains(search_key)) {
       found.add((T) e.getSecond());
     }
   } // FOR
   return (found);
 }
Пример #3
0
 /**
  * @param match_class
  * @param search_key
  * @return
  */
 public PredicatePairs createPredicatePairsForParent(
     Class<? extends CatalogType> match_class, CatalogType parent_search_key) {
   PredicatePairs ret = new PredicatePairs(this.catalog_stmts);
   // We're looking for Pairs where one of the elements matches the search_key,
   // and the other element is of the same type of match_class
   for (CatalogPair e : this) {
     if (e.getFirst().getClass().equals(match_class)
         && e.getSecond().getParent().equals(parent_search_key)) {
       ret.add(
           CatalogPair.factory(
               e.getSecond(), e.getFirst(), e.getComparisonExp(), e.getQueryTypes()));
     } else if (e.getSecond().getClass().equals(match_class)
         && e.getFirst().getParent().equals(parent_search_key)) {
       ret.add(e);
     }
   } // FOR
   return (ret);
 }
Пример #4
0
 /**
  * @param search_key
  * @return
  */
 public Collection<CatalogPair> findAllForParent(CatalogType search_key) {
   List<CatalogPair> found = new ArrayList<CatalogPair>();
   for (CatalogPair entry : this) {
     if (entry.getFirst().getParent().equals(search_key)
         || entry.getSecond().getParent().equals(search_key)) {
       found.add(entry);
     }
   } // FOR
   return (found);
 }