Program: 144011
Project: 144011
Buggy source:
Builder addRule(int[] variableIndexes,boolean[] variableNegations,double power,double weight){
  RulePart internalRepresentation=convertRulePartToInternalRepresentation(variableIndexes,variableNegations);
  double ruleMaximumValue=1 + internalRepresentation.observedConstant;
  if (ruleMaximumValue <= 0)   return this;
  if (internalRepresentation.variableIndexes.length == 0)   return this;
  int indexTerm=this.functionTerms.size();
  LinearFunction linearFunction=new LinearFunction(Vectors.dense(internalRepresentation.variableIndexes.length),ruleMaximumValue);
  for (int variable=0; variable < internalRepresentation.variableIndexes.length; variable++) {
    List<Integer> predicateTermIndices=this.externalPredicateIdToTerms.getOrDefault(internalRepresentation.variableIndexes[variable],null);
    if (predicateTermIndices == null) {
      predicateTermIndices=new ArrayList<>(200);
      this.externalPredicateIdToTerms.put(internalRepresentation.variableIndexes[variable],predicateTermIndices);
    }
    predicateTermIndices.add(indexTerm);
    Vector coefficients=Vectors.dense(internalRepresentation.variableIndexes.length);
    if (internalRepresentation.negations[variable]) {
      coefficients.set(variable,1);
      linearFunction=linearFunction.add(new LinearFunction(coefficients,-1));
    }
 else {
      coefficients.set(variable,-1);
      linearFunction=linearFunction.add(new LinearFunction(coefficients,0));
    }
  }
  for (int variable=0; variable < variableIndexes.length; ++variable) {
    List<Integer> predicateTermIndices=this.externalPredicateIdToTerms.getOrDefault(variableIndexes[variable],null);
    if (predicateTermIndices == null) {
      predicateTermIndices=new ArrayList<>(200);
      this.externalPredicateIdToTerms.put(variableIndexes[variable],predicateTermIndices);
    }
    predicateTermIndices.add(indexTerm);
  }
  FunctionTerm term=new FunctionTerm(internalRepresentation.variableIndexes,linearFunction,weight,power);
  functionTerms.add(term);
  return this;
}

Fixed version (ground truth):
Builder addRule(int[] variableIndexes,boolean[] variableNegations,double power,double weight){
  RulePart internalRepresentation=convertRulePartToInternalRepresentation(variableIndexes,variableNegations);
  double ruleMaximumValue=1 + internalRepresentation.observedConstant;
  if (ruleMaximumValue <= 0)   return this;
  if (internalRepresentation.variableIndexes.length == 0)   return this;
  int indexTerm=this.functionTerms.size();
  LinearFunction linearFunction=new LinearFunction(Vectors.dense(internalRepresentation.variableIndexes.length),ruleMaximumValue);
  for (int variable=0; variable < internalRepresentation.variableIndexes.length; variable++) {
    List<Integer> predicateTermIndices=this.externalPredicateIdToTerms.getOrDefault(internalRepresentation.variableIndexes[variable],null);
    if (predicateTermIndices == null) {
      predicateTermIndices=new ArrayList<>(200);
      this.externalPredicateIdToTerms.put(internalRepresentation.variableIndexes[variable],predicateTermIndices);
    }
    predicateTermIndices.add(indexTerm);
    Vector coefficients=Vectors.dense(internalRepresentation.variableIndexes.length);
    if (internalRepresentation.negations[variable]) {
      coefficients.set(variable,1);
      linearFunction=linearFunction.add(new LinearFunction(coefficients,-1));
    }
 else {
      coefficients.set(variable,-1);
      linearFunction=linearFunction.add(new LinearFunction(coefficients,0));
    }
  }
  FunctionTerm term=new FunctionTerm(internalRepresentation.variableIndexes,linearFunction,weight,power);
  functionTerms.add(term);
  return this;
}