Ejemplo n.º 1
0
 public String debug() {
   String ret = this.getClass().getSimpleName() + ": {\n";
   for (CatalogPair pair : this) {
     ret += StringUtil.SPACER + pair.toString() + "\n";
   } // FOR
   ret += "}";
   return (ret);
 }
Ejemplo n.º 2
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);
 }
Ejemplo n.º 3
0
 /**
  * @param search_keys
  * @return
  */
 public Collection<CatalogPair> findAll(CatalogType... search_keys) {
   List<CatalogPair> found = new ArrayList<CatalogPair>();
   for (CatalogPair entry : this) {
     for (CatalogType key : search_keys) {
       if (entry.contains(key)) {
         found.add(entry);
       }
     } // FOR
   } // FOR
   return (found);
 }
Ejemplo n.º 4
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);
 }
Ejemplo n.º 5
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);
 }
Ejemplo n.º 6
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);
 }
Ejemplo n.º 7
0
 /**
  * @param element0
  * @param element1
  * @param comparison_exp
  * @param catalog_stmts
  * @return
  */
 public boolean add(
     CatalogType element0,
     CatalogType element1,
     ExpressionType comparison_exp,
     Collection<Statement> catalog_stmts) {
   Set<QueryType> query_types = new HashSet<QueryType>();
   for (Statement catalog_stmt : catalog_stmts) {
     query_types.add(QueryType.get(catalog_stmt.getQuerytype()));
   } // FOR
   boolean ret = this.add(CatalogPair.factory(element0, element1, comparison_exp, query_types));
   if (ret) this.catalog_stmts.addAll(catalog_stmts);
   return (ret);
 }