Program: 166696
Project: 166696
Buggy source:
/** 
 * Insert a TaskLink into the TaskLink bag <p> called only from Memory.continuedProcess
 * @param taskLink The termLink to be inserted
 */
protected boolean insertTaskLink(final TaskLink taskLink){
  Task target=taskLink.getTarget();
  Term term=target.getTerm();
  boolean wat=target.sentence.isJudgment();
  if (target.sentence.isJudgment() && target.sentence.isEternal() && term instanceof Implication&& !term.hasVarIndep()&& !(this.name() instanceof Operation)) {
    Implication imp=(Implication)term;
    if (imp.getTemporalOrder() == TemporalRules.ORDER_FORWARD && imp.getPredicate().equals(this.name())) {
      Term subj=imp.getSubject();
      if (subj instanceof Conjunction) {
        Conjunction conj=(Conjunction)subj;
        if (conj.getTemporalOrder() == TemporalRules.ORDER_FORWARD && conj.term.length >= 4 && conj.term[conj.term.length - 1] instanceof Interval && conj.term[conj.term.length - 2] instanceof Operation) {
          addToTable(target,false,enactable_explainations,Parameters.CONCEPT_BELIEFS_MAX,EnactableExplainationAdd.class,EnactableExplainationRemove.class);
        }
      }
    }
  }
  if (this.name().equals(target.getTerm())) {
  }
  boolean isEternal=target.sentence.isEternal();
  int nSameContent=0;
  float lowest_priority=Float.MAX_VALUE;
  TaskLink lowest=null;
  for (  TaskLink tl : taskLinks) {
    Sentence s=tl.getTarget().sentence;
    if (s.getTerm().equals(taskLink.getTerm()) && s.isEternal() == isEternal) {
      nSameContent++;
      if (tl.getPriority() < lowest_priority) {
        lowest_priority=tl.getPriority();
        lowest=tl;
      }
      if (nSameContent > Parameters.TASKLINK_PER_CONTENT) {
        taskLinks.take(lowest);
        memory.emit(TaskLinkRemove.class,lowest,this);
        break;
      }
    }
  }
  TaskLink removed=taskLinks.putIn(taskLink);
  if (removed != null) {
    if (removed == taskLink) {
      memory.emit(TaskLinkRemove.class,taskLink,this);
      return false;
    }
 else {
      memory.emit(TaskLinkRemove.class,removed,this);
    }
    removed.end();
  }
  memory.emit(TaskLinkAdd.class,taskLink,this);
  return true;
}

Fixed version (ground truth):
/** 
 * Insert a TaskLink into the TaskLink bag <p> called only from Memory.continuedProcess
 * @param taskLink The termLink to be inserted
 */
protected boolean insertTaskLink(final TaskLink taskLink){
  Task target=taskLink.getTarget();
  Term term=target.getTerm();
  boolean wat=target.sentence.isJudgment();
  if (target.sentence.isJudgment() && target.sentence.isEternal() && term instanceof Implication&& !term.hasVarIndep()&& !(this.name() instanceof Operation)) {
    Implication imp=(Implication)term;
    if (imp.getTemporalOrder() == TemporalRules.ORDER_FORWARD && imp.getPredicate().equals(this.name())) {
      Term subj=imp.getSubject();
      if (subj instanceof Conjunction) {
        Conjunction conj=(Conjunction)subj;
        if (conj.getTemporalOrder() == TemporalRules.ORDER_FORWARD && conj.term.length >= 4 && conj.term[conj.term.length - 1] instanceof Interval && conj.term[conj.term.length - 2] instanceof Operation) {
          addToTable(target,false,executable_preconditions,Parameters.CONCEPT_BELIEFS_MAX,EnactableExplainationAdd.class,EnactableExplainationRemove.class);
        }
      }
    }
  }
  if (this.name().equals(target.getTerm())) {
  }
  boolean isEternal=target.sentence.isEternal();
  int nSameContent=0;
  float lowest_priority=Float.MAX_VALUE;
  TaskLink lowest=null;
  for (  TaskLink tl : taskLinks) {
    Sentence s=tl.getTarget().sentence;
    if (s.getTerm().equals(taskLink.getTerm()) && s.isEternal() == isEternal) {
      nSameContent++;
      if (tl.getPriority() < lowest_priority) {
        lowest_priority=tl.getPriority();
        lowest=tl;
      }
      if (nSameContent > Parameters.TASKLINK_PER_CONTENT) {
        taskLinks.take(lowest);
        memory.emit(TaskLinkRemove.class,lowest,this);
        break;
      }
    }
  }
  TaskLink removed=taskLinks.putIn(taskLink);
  if (removed != null) {
    if (removed == taskLink) {
      memory.emit(TaskLinkRemove.class,taskLink,this);
      return false;
    }
 else {
      memory.emit(TaskLinkRemove.class,removed,this);
    }
    removed.end();
  }
  memory.emit(TaskLinkAdd.class,taskLink,this);
  return true;
}