Program: 73900
Project: 73900
Buggy source:
/** 
 * Construct a matrix containing the children nodes. The specified node ends up with a MatrixToken value.
 * @param node The specified node.
 * @exception IllegalActionException If an parse error occurs.
 */
public void visitMatrixConstructNode(ASTPtMatrixConstructNode node) throws IllegalActionException {
  if (node.isConstant() && node.isEvaluated()) {
    _evaluatedChildToken=node.getToken();
    _childCode=_evaluatedChildToken.toString();
    return;
  }
  int row=node.getRowCount();
  int column=node.getColumnCount();
  ptolemy.data.Token[] tokens=new ptolemy.data.Token[row * column];
  StringBuffer result=new StringBuffer(row + "String_Node_Str" + column+ "String_Node_Str"+ row * column);
  ptolemy.data.Token childToken=null;
  ptolemy.data.type.Type elementType=BaseType.UNKNOWN;
  if (node.getForm() == 1) {
    for (int i=0; i < row; i++) {
      for (int j=0; j < column; j++) {
        result.append("String_Node_Str");
        int index=(i * column) + j;
        tokens[index]=_evaluateChild(node,index);
        Type valueType=tokens[index].getType();
        if (_isPrimitive(valueType)) {
          result.append("String_Node_Str" + _codeGenType(valueType) + "String_Node_Str"+ _childCode+ "String_Node_Str");
        }
        if (!elementType.equals(valueType)) {
          elementType=TypeLattice.leastUpperBound(elementType,valueType);
        }
      }
    }
    String codegenType=_codeGenType(elementType);
    if (_targetType(elementType).equals("String_Node_Str")) {
      result.append("String_Node_Str");
    }
 else {
      result.append("String_Node_Str" + codegenType);
    }
    result.append("String_Node_Str" + "String_Node_Str" + result);
    _childCode=result.toString() + "String_Node_Str";
    childToken=MatrixToken.arrayToMatrix(tokens,node.getRowCount(),node.getColumnCount());
  }
 else   if (node.getForm() == 2) {
    try {
      int columnCount=MatrixToken.determineSequenceLength((ScalarToken)tokens[0],(ScalarToken)tokens[1],(ScalarToken)tokens[2]);
      for (int i=1; i < node.getRowCount(); ++i) {
        if (columnCount != MatrixToken.determineSequenceLength((ScalarToken)tokens[3 * i],(ScalarToken)tokens[(3 * i) + 1],(ScalarToken)tokens[(3 * i) + 2])) {
          throw new IllegalActionException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
        }
      }
      ptolemy.data.Token[] matrixTokens=new ptolemy.data.Token[node.getRowCount() * columnCount];
      for (int i=0; i < node.getRowCount(); i++) {
        ptolemy.data.Token[] newTokens=MatrixToken.createSequence(tokens[3 * i],tokens[(3 * i) + 1],columnCount);
        System.arraycopy(newTokens,0,matrixTokens,columnCount * i,columnCount);
      }
      childToken=MatrixToken.arrayToMatrix(matrixTokens,node.getRowCount(),columnCount);
    }
 catch (    IllegalActionException ex) {
      throw new IllegalActionException(null,null,ex,"String_Node_Str");
    }
  }
  _evaluatedChildToken=(childToken);
}

Fixed version (ground truth):
/** 
 * Construct a matrix containing the children nodes. The specified node ends up with a MatrixToken value.
 * @param node The specified node.
 * @exception IllegalActionException If an parse error occurs.
 */
public void visitMatrixConstructNode(ASTPtMatrixConstructNode node) throws IllegalActionException {
  if (node.isConstant() && node.isEvaluated()) {
    _evaluatedChildToken=node.getToken();
    _childCode=_evaluatedChildToken.toString();
    return;
  }
  int row=node.getRowCount();
  int column=node.getColumnCount();
  ptolemy.data.Token[] tokens=new ptolemy.data.Token[row * column];
  StringBuffer result=new StringBuffer(row + "String_Node_Str" + column+ "String_Node_Str"+ row * column);
  ptolemy.data.Token childToken=null;
  ptolemy.data.type.Type elementType=BaseType.UNKNOWN;
  if (node.getForm() == 1) {
    for (int i=0; i < row; i++) {
      for (int j=0; j < column; j++) {
        result.append("String_Node_Str");
        int index=(i * column) + j;
        tokens[index]=_evaluateChild(node,index);
        Type valueType=tokens[index].getType();
        if (_isPrimitive(valueType)) {
          result.append("String_Node_Str" + _codeGenType(valueType) + "String_Node_Str"+ _childCode+ "String_Node_Str");
        }
        if (!elementType.equals(valueType)) {
          elementType=TypeLattice.leastUpperBound(elementType,valueType);
        }
      }
    }
    String codegenType=_codeGenType(elementType);
    if (_targetType(elementType).equals("String_Node_Str")) {
      result.append("String_Node_Str");
    }
 else {
      result.append("String_Node_Str" + codegenType);
    }
    result=new StringBuffer("String_Node_Str" + "String_Node_Str" + result.toString());
    _childCode=result.toString() + "String_Node_Str";
    childToken=MatrixToken.arrayToMatrix(tokens,node.getRowCount(),node.getColumnCount());
  }
 else   if (node.getForm() == 2) {
    try {
      int columnCount=MatrixToken.determineSequenceLength((ScalarToken)tokens[0],(ScalarToken)tokens[1],(ScalarToken)tokens[2]);
      for (int i=1; i < node.getRowCount(); ++i) {
        if (columnCount != MatrixToken.determineSequenceLength((ScalarToken)tokens[3 * i],(ScalarToken)tokens[(3 * i) + 1],(ScalarToken)tokens[(3 * i) + 2])) {
          throw new IllegalActionException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
        }
      }
      ptolemy.data.Token[] matrixTokens=new ptolemy.data.Token[node.getRowCount() * columnCount];
      for (int i=0; i < node.getRowCount(); i++) {
        ptolemy.data.Token[] newTokens=MatrixToken.createSequence(tokens[3 * i],tokens[(3 * i) + 1],columnCount);
        System.arraycopy(newTokens,0,matrixTokens,columnCount * i,columnCount);
      }
      childToken=MatrixToken.arrayToMatrix(matrixTokens,node.getRowCount(),columnCount);
    }
 catch (    IllegalActionException ex) {
      throw new IllegalActionException(null,null,ex,"String_Node_Str");
    }
  }
  _evaluatedChildToken=(childToken);
}