Program: 75520
Project: 75520
Buggy source:
/** 
 * Visit the leaf node. It is evaluated the same way as normal parse tree evaluator, except that if the the result is a boolean token, the information about the node (the difference and relationType) is either added into the relation list or used to update the according element in the relation list, depending on the evaluator mode.
 * @param node The leaf node to be evaluated.
 * @exception IllegalActionException If the super class methodvisitLeafNode throws the IllegalActionException.
 */
public void visitLeafNode(ASTPtLeafNode node) throws IllegalActionException {
  String nodeName=node.getName();
  String discreteVariableName="String_Node_Str";
  if (nodeName != null) {
    int variableNameEndIndex=nodeName.indexOf("String_Node_Str");
    if (variableNameEndIndex != -1) {
      discreteVariableName=nodeName.substring(0,variableNameEndIndex);
    }
  }
  if (_absentDiscreteVariables.contains(nodeName)) {
    _evaluatedChildToken=new BooleanToken(false);
    if (_construction) {
      _relationList.addRelation(0,0.0);
      _relationNumber++;
    }
    _relationIndex++;
    if (_relationIndex >= _relationNumber) {
      _relationIndex-=_relationNumber;
    }
    return;
  }
  super.visitLeafNode(node);
  ptolemy.data.Token result=_evaluatedChildToken;
  if (!(result instanceof BooleanToken))   return;
  if (((BooleanToken)result).booleanValue()) {
    _relationType=1;
    if (_absentDiscreteVariables.contains(discreteVariableName)) {
      _absentDiscreteVariables.remove(discreteVariableName);
    }
  }
 else {
    _relationType=2;
    if (!_absentDiscreteVariables.contains(discreteVariableName)) {
      _absentDiscreteVariables.add(discreteVariableName);
    }
  }
  _difference=0.0;
  if (_construction) {
    _relationList.addRelation(_relationType,_difference);
    _relationNumber++;
  }
 else {
    _relationList.setRelation(_relationIndex,_relationType,_difference);
  }
  _relationIndex++;
  if (_relationIndex >= _relationNumber) {
    _relationIndex-=_relationNumber;
  }
}

Fixed version (ground truth):
/** 
 * Visit the leaf node. It is evaluated the same way as normal parse tree evaluator, except that if the the result is a boolean token, the information about the node (the difference and relationType) is either added into the relation list or used to update the according element in the relation list, depending on the evaluator mode.
 * @param node The leaf node to be evaluated.
 * @exception IllegalActionException If the super class methodvisitLeafNode throws the IllegalActionException.
 */
public void visitLeafNode(ASTPtLeafNode node) throws IllegalActionException {
  String nodeName=node.getName();
  String discreteVariableName="String_Node_Str";
  if (nodeName != null) {
    int variableNameEndIndex=nodeName.indexOf("String_Node_Str");
    if (variableNameEndIndex != -1) {
      discreteVariableName=nodeName.substring(0,variableNameEndIndex);
    }
  }
  if (_absentDiscreteVariables.contains(nodeName)) {
    _evaluatedChildToken=new BooleanToken(false);
    if (_constructingRelationList) {
      _relationList.addRelation(0,0.0);
    }
    _relationIndex++;
    return;
  }
  super.visitLeafNode(node);
  ptolemy.data.Token result=_evaluatedChildToken;
  if (!(result instanceof BooleanToken))   return;
  if (((BooleanToken)result).booleanValue()) {
    _relationType=1;
    if (_absentDiscreteVariables.contains(discreteVariableName)) {
      _absentDiscreteVariables.remove(discreteVariableName);
    }
  }
 else {
    _relationType=2;
    if (!_absentDiscreteVariables.contains(discreteVariableName)) {
      _absentDiscreteVariables.add(discreteVariableName);
    }
  }
  _difference=0.0;
  if (_constructingRelationList) {
    _relationList.addRelation(_relationType,_difference);
  }
 else {
    _relationList.setRelation(_relationIndex,_relationType,_difference);
  }
  _relationIndex++;
}