Program: 166738
Project: 166738
Buggy source:
/** 
 * Derived task comes from the inference rules.
 * @param task the derived task
 */
public boolean derivedTask(final Task task,final boolean revised,final boolean single,Sentence occurence,Sentence occurence2){
  if (task.sentence.content instanceof Operation) {
    if (((Operation)task.sentence.content).getPredicate() == memory.getOperator("String_Node_Str")) {
      boolean breakpoint=true;
    }
  }
  if (task.sentence.content instanceof Implication && ((Implication)task.sentence.content).getTemporalOrder() == TemporalRules.ORDER_BACKWARD) {
    return false;
  }
  if (!task.budget.aboveThreshold()) {
    memory.removeTask(task,"String_Node_Str");
    return false;
  }
  if (task.sentence != null && task.sentence.truth != null) {
    float conf=task.sentence.truth.getConfidence();
    if (conf == 0) {
      memory.removeTask(task,"String_Node_Str");
      return false;
    }
  }
  if (Parameters.DERIVE_ONLY_DEMANDED_TASKS) {
    if ((task.sentence.punctuation == Symbols.JUDGMENT_MARK) && !(task.sentence.content instanceof Operation)) {
      boolean noConcept=memory.concept(task.sentence.content) == null;
      if (noConcept) {
        memory.removeTask(task,"String_Node_Str");
        return false;
      }
    }
  }
  final Stamp stamp=task.sentence.stamp;
  if (occurence != null && !occurence.isEternal()) {
    stamp.setOccurrenceTime(occurence.getOccurenceTime());
  }
  if (occurence2 != null && !occurence2.isEternal()) {
    stamp.setOccurrenceTime(occurence2.getOccurenceTime());
  }
  if (stamp.latency > 0) {
    memory.logic.DERIVATION_LATENCY.commit(stamp.latency);
  }
  final Term currentTaskContent=getCurrentTask().getContent();
  if (getCurrentBelief() != null && getCurrentBelief().isJudgment()) {
    final Term currentBeliefContent=getCurrentBelief().content;
    stamp.chainRemove(currentBeliefContent);
    stamp.chainAdd(currentBeliefContent);
  }
  if (currentBelief == null && single && currentTask != null && currentTask.sentence.isJudgment()) {
    stamp.chainRemove(currentTaskContent);
    stamp.chainAdd(currentTaskContent);
  }
  if (currentTask != null && !single && currentTask.sentence.isJudgment()) {
    stamp.chainRemove(currentTaskContent);
    stamp.chainAdd(currentTaskContent);
  }
  if (!revised) {
    Term tc=task.getContent();
    if (task.sentence.isJudgment()) {
      Term ptc=task.getParentTask() != null ? task.getParentTask().getContent() : null;
      if ((task.getParentTask() == null) || (!(ptc.equals(Negation.make(tc))) && !(tc.equals(Negation.make(ptc))))) {
        final Collection<Term> chain=stamp.getChain();
        for (        final Term chain1 : chain) {
          if (tc.equals(chain1)) {
            memory.removeTask(task,"String_Node_Str");
            return false;
          }
        }
      }
    }
  }
 else {
    final int stampLength=stamp.baseLength;
    for (int i=0; i < stampLength; i++) {
      final long baseI=stamp.evidentialBase[i];
      for (int j=0; j < stampLength; j++) {
        if ((i != j) && (baseI == stamp.evidentialBase[j])) {
          memory.removeTask(task,"String_Node_Str");
          return false;
        }
      }
    }
  }
  if (task.sentence.content instanceof Operation) {
    Operation op=(Operation)task.sentence.content;
    if (op.getSubject() instanceof Variable || op.getPredicate() instanceof Variable) {
      return false;
    }
  }
  memory.event.emit(Events.TaskDerive.class,task,revised,single,occurence,occurence2);
  memory.logic.TASK_DERIVED.commit(task.budget.getPriority());
  addTask(task,"String_Node_Str");
  return true;
}

Fixed version (ground truth):
/** 
 * Derived task comes from the inference rules.
 * @param task the derived task
 */
public boolean derivedTask(final Task task,final boolean revised,final boolean single,Sentence occurence,Sentence occurence2){
  if (task.sentence.content instanceof Operation) {
    if (((Operation)task.sentence.content).getPredicate() == memory.getOperator("String_Node_Str") && task.sentence.punctuation == Symbols.GOAL_MARK) {
      boolean breakpoint=true;
    }
  }
  if (task.sentence.content instanceof Implication && ((Implication)task.sentence.content).getTemporalOrder() == TemporalRules.ORDER_BACKWARD) {
    return false;
  }
  if (!task.budget.aboveThreshold()) {
    memory.removeTask(task,"String_Node_Str");
    return false;
  }
  if (task.sentence != null && task.sentence.truth != null) {
    float conf=task.sentence.truth.getConfidence();
    if (conf == 0) {
      memory.removeTask(task,"String_Node_Str");
      return false;
    }
  }
  if (Parameters.DERIVE_ONLY_DEMANDED_TASKS) {
    if ((task.sentence.punctuation == Symbols.JUDGMENT_MARK) && !(task.sentence.content instanceof Operation)) {
      boolean noConcept=memory.concept(task.sentence.content) == null;
      if (noConcept) {
        memory.removeTask(task,"String_Node_Str");
        return false;
      }
    }
  }
  final Stamp stamp=task.sentence.stamp;
  if (occurence != null && !occurence.isEternal()) {
    stamp.setOccurrenceTime(occurence.getOccurenceTime());
  }
  if (occurence2 != null && !occurence2.isEternal()) {
    stamp.setOccurrenceTime(occurence2.getOccurenceTime());
  }
  if (stamp.latency > 0) {
    memory.logic.DERIVATION_LATENCY.commit(stamp.latency);
  }
  final Term currentTaskContent=getCurrentTask().getContent();
  if (getCurrentBelief() != null && getCurrentBelief().isJudgment()) {
    final Term currentBeliefContent=getCurrentBelief().content;
    stamp.chainRemove(currentBeliefContent);
    stamp.chainAdd(currentBeliefContent);
  }
  if (currentBelief == null && single && currentTask != null && currentTask.sentence.isJudgment()) {
    stamp.chainRemove(currentTaskContent);
    stamp.chainAdd(currentTaskContent);
  }
  if (currentTask != null && !single && currentTask.sentence.isJudgment()) {
    stamp.chainRemove(currentTaskContent);
    stamp.chainAdd(currentTaskContent);
  }
  if (!revised) {
    Term tc=task.getContent();
    if (task.sentence.isJudgment()) {
      Term ptc=task.getParentTask() != null ? task.getParentTask().getContent() : null;
      if ((task.getParentTask() == null) || (!(ptc.equals(Negation.make(tc))) && !(tc.equals(Negation.make(ptc))))) {
        final Collection<Term> chain=stamp.getChain();
        for (        final Term chain1 : chain) {
          if (tc.equals(chain1)) {
            memory.removeTask(task,"String_Node_Str");
            return false;
          }
        }
      }
    }
  }
 else {
    final int stampLength=stamp.baseLength;
    for (int i=0; i < stampLength; i++) {
      final long baseI=stamp.evidentialBase[i];
      for (int j=0; j < stampLength; j++) {
        if ((i != j) && (baseI == stamp.evidentialBase[j])) {
          memory.removeTask(task,"String_Node_Str");
          return false;
        }
      }
    }
  }
  if (task.sentence.content instanceof Operation) {
    Operation op=(Operation)task.sentence.content;
    if (op.getSubject() instanceof Variable || op.getPredicate() instanceof Variable) {
      return false;
    }
  }
  memory.event.emit(Events.TaskDerive.class,task,revised,single,occurence,occurence2);
  memory.logic.TASK_DERIVED.commit(task.budget.getPriority());
  addTask(task,"String_Node_Str");
  return true;
}