Program: 12363
Project: 12363
Buggy source:
@Override public AbstractFeature build() throws JATEException {
  List<ContextWindow> contextWindows=new ArrayList<>(ref_frequencyCtxBased.getMapCtx2TTF().keySet());
  int cores=properties.getMaxCPUCores();
  cores=cores == 0 ? 1 : cores;
  int maxPerThread=contextWindows.size() / cores;
  if (maxPerThread == 0)   maxPerThread=50;
  StringBuilder sb=new StringBuilder("String_Node_Str");
  sb.append(cores).append("String_Node_Str").append(contextWindows.size()).append("String_Node_Str").append(maxPerThread);
  LOG.info(sb.toString());
  LOG.info("String_Node_Str" + minTTF + "String_Node_Str"+ minTCF);
  Set<String> termsPassingPrefilter=new HashSet<>();
  for (  ContextWindow ctx : contextWindows) {
    Map<String,Integer> termsInContext=frequencyCtxBased.getTFIC(ctx);
    if (minTTF == 0 && minTCF == 0)     termsPassingPrefilter.addAll(termsInContext.keySet());
 else {
      for (      String term : termsInContext.keySet()) {
        if (frequencyTermBased.getTTF(term) >= minTTF && frequencyCtxBased.getContexts(term).size() >= minTCF)         termsPassingPrefilter.add(term);
      }
    }
  }
  Cooccurrence feature=new Cooccurrence(termsPassingPrefilter.size(),ref_frequencyCtxBased.getMapTerm2Ctx().size());
  LOG.info("String_Node_Str" + termsPassingPrefilter.size() + "String_Node_Str"+ contextWindows.size());
  CooccurrenceFBWorker worker=new CooccurrenceFBWorker(feature,contextWindows,frequencyTermBased,minTTF,frequencyCtxBased,ref_frequencyCtxBased,minTCF,maxPerThread);
  ForkJoinPool forkJoinPool=new ForkJoinPool(cores);
  int total=forkJoinPool.invoke(worker);
  List<String> col=new ArrayList<>(frequencyCtxBased.getCtxOverlapZones().keySet());
  col.removeAll(ref_frequencyCtxBased.getCtxOverlapZones().keySet());
  System.out.println(col.size());
  Map<String,ContextOverlap> overlaps=frequencyCtxBased.getCtxOverlapZones();
  if (overlaps.size() > 0) {
    LOG.info("String_Node_Str" + overlaps.size());
    for (    Map.Entry<String,ContextOverlap> en : overlaps.entrySet()) {
      String key=en.getKey();
      ContextOverlap co=en.getValue();
      Map<String,Integer> freq=new HashMap<>();
      for (      String t : co.getTerms()) {
        Integer f=freq.get(t);
        f=f == null ? 0 : f;
        f++;
        freq.put(t,f);
      }
      if (freq.size() <= 1)       continue;
      ContextOverlap ref_co=ref_frequencyCtxBased.getCtxOverlapZones().get(key);
      Map<String,Integer> ref_freq=new HashMap<>();
      if (ref_co != null) {
        for (        String t : ref_co.getTerms()) {
          Integer f=ref_freq.get(t);
          f=f == null ? 0 : f;
          f++;
          ref_freq.put(t,f);
        }
      }
      if (ref_freq.size() <= 1)       continue;
      for (      Map.Entry<String,Integer> term_in_co : freq.entrySet()) {
        int f=term_in_co.getValue();
        for (        Map.Entry<String,Integer> term_in_ref_co : ref_freq.entrySet()) {
          int rf=term_in_ref_co.getValue();
          if (term_in_co.getKey().equals(term_in_ref_co.getKey()))           continue;
          int deduce=f < rf ? f : rf;
          int tid=feature.lookupTerm(term_in_co.getKey());
          int tid_f=feature.lookupRefTerm(term_in_ref_co.getKey());
          if (tid == -1 || tid_f == -1)           continue;
          feature.deduce(tid,tid_f,deduce);
        }
      }
    }
  }
  sb=new StringBuilder("String_Node_Str" + total);
  LOG.info(sb.toString());
  return feature;
}

Fixed version (ground truth):
@Override public AbstractFeature build() throws JATEException {
  List<ContextWindow> contextWindows=new ArrayList<>(ref_frequencyCtxBased.getMapCtx2TTF().keySet());
  int cores=properties.getMaxCPUCores();
  cores=cores == 0 ? 1 : cores;
  int maxPerThread=contextWindows.size() / cores;
  if (maxPerThread == 0)   maxPerThread=50;
  StringBuilder sb=new StringBuilder("String_Node_Str");
  sb.append(cores).append("String_Node_Str").append(contextWindows.size()).append("String_Node_Str").append(maxPerThread);
  LOG.info(sb.toString());
  LOG.info("String_Node_Str" + minTTF + "String_Node_Str"+ minTCF);
  Set<String> termsPassingPrefilter=new HashSet<>();
  for (  ContextWindow ctx : contextWindows) {
    Map<String,Integer> termsInContext=frequencyCtxBased.getTFIC(ctx);
    if (minTTF == 0 && minTCF == 0)     termsPassingPrefilter.addAll(termsInContext.keySet());
 else {
      for (      String term : termsInContext.keySet()) {
        if (frequencyTermBased.getTTF(term) >= minTTF && frequencyCtxBased.getContexts(term).size() >= minTCF)         termsPassingPrefilter.add(term);
      }
    }
  }
  Cooccurrence feature=new Cooccurrence(termsPassingPrefilter.size(),ref_frequencyCtxBased.getMapTerm2Ctx().size());
  LOG.info("String_Node_Str" + termsPassingPrefilter.size() + "String_Node_Str"+ contextWindows.size());
  CooccurrenceFBWorker worker=new CooccurrenceFBWorker(feature,contextWindows,frequencyTermBased,minTTF,frequencyCtxBased,ref_frequencyCtxBased,minTCF,maxPerThread);
  ForkJoinPool forkJoinPool=new ForkJoinPool(cores);
  int total=forkJoinPool.invoke(worker);
  Map<String,ContextOverlap> overlaps=frequencyCtxBased.getCtxOverlapZones();
  if (overlaps.size() > 0) {
    LOG.info("String_Node_Str" + overlaps.size());
    for (    Map.Entry<String,ContextOverlap> en : overlaps.entrySet()) {
      String key=en.getKey();
      ContextOverlap co=en.getValue();
      Map<String,Integer> freq=new HashMap<>();
      for (      String t : co.getTerms()) {
        Integer f=freq.get(t);
        f=f == null ? 0 : f;
        f++;
        freq.put(t,f);
      }
      if (freq.size() <= 1)       continue;
      ContextOverlap ref_co=ref_frequencyCtxBased.getCtxOverlapZones().get(key);
      Map<String,Integer> ref_freq=new HashMap<>();
      if (ref_co != null) {
        for (        String t : ref_co.getTerms()) {
          Integer f=ref_freq.get(t);
          f=f == null ? 0 : f;
          f++;
          ref_freq.put(t,f);
        }
      }
      if (ref_freq.size() <= 1)       continue;
      for (      Map.Entry<String,Integer> term_in_co : freq.entrySet()) {
        int f=term_in_co.getValue();
        for (        Map.Entry<String,Integer> term_in_ref_co : ref_freq.entrySet()) {
          int rf=term_in_ref_co.getValue();
          if (term_in_co.getKey().equals(term_in_ref_co.getKey()))           continue;
          int deduce=f < rf ? f : rf;
          int tid=feature.lookupTerm(term_in_co.getKey());
          int tid_f=feature.lookupRefTerm(term_in_ref_co.getKey());
          if (tid == -1 || tid_f == -1)           continue;
          feature.deduce(tid,tid_f,deduce);
        }
      }
    }
  }
  sb=new StringBuilder("String_Node_Str" + total);
  LOG.info(sb.toString());
  return feature;
}