コード例 #1
0
 private DbAnalyzerCorpus sortByFrequency() {
   final MultiMap<Integer, StatementPopulationType> byFrequency =
       new MultiMap<Integer, StatementPopulationType>();
   for (final StatementPopulationType spt : corpus.getPopulation()) {
     byFrequency.put(spt.getFreq(), spt);
   }
   final List<Integer> freqs = new ArrayList<Integer>(byFrequency.keySet());
   Collections.sort(freqs, Collections.reverseOrder());
   corpus.getPopulation().clear();
   for (final Integer i : freqs) {
     final Collection<StatementPopulationType> sub = byFrequency.get(i);
     if ((sub == null) || sub.isEmpty()) {
       continue;
     }
     corpus.getPopulation().addAll(sub);
   }
   return corpus;
 }
コード例 #2
0
 public InsertEntry(
     DbAnalyzerCorpus reportObject, String prefix, int colwidth, String kind, String db) {
   this.populationObject = new StatementInsertIntoValuesType();
   this.populationObject.setInsertPrefix(prefix);
   this.populationObject.setKind(kind);
   this.populationObject.setDb(db);
   this.populationObject.setColWidth(colwidth);
   reportObject.getPopulation().add(populationObject);
   byWidth = new HashMap<Integer, InsertTuples>();
 }
コード例 #3
0
 public NonInsertEntry(
     DbAnalyzerCorpus reportObject,
     String rep,
     String kind,
     String db,
     int literals,
     DMLCounters incCounter) {
   this.populationObject = new StatementNonInsertType();
   this.populationObject.setStmt(rep);
   this.populationObject.setKind(kind);
   this.populationObject.setDb(db);
   this.populationObject.setLiteralCount(literals);
   reportObject.getPopulation().add(populationObject);
   dmlCategory = incCounter;
 }
コード例 #4
0
 private void trackOther(String sql) {
   StatementNonDMLType nd = null;
   final String shrunk = CandidateParser.shrinkAnything(sql);
   if (shrunk != null) {
     nd = otherByShrunk.get(shrunk);
   }
   if (nd == null) {
     nd = otherByInput.get(sql);
   }
   if (nd == null) {
     nd = new StatementNonDMLType();
     nd.setStmt(sql);
     otherByInput.put(sql, nd);
     if (shrunk != null) {
       otherByShrunk.put(shrunk, nd);
     }
     corpus.getNonDml().add(nd);
   }
   nd.setFreq(nd.getFreq() + 1);
 }
コード例 #5
0
 @Override
 public void setSource(AnalyzerSource as) {
   if (as != null) {
     corpus.setDescription(as.getDescription());
   }
 }