Program: 74078
Project: 74078
Buggy source:
/** 
 * Layout the given composite. Main entry point for the layout action. Create a Kieler KGraph datastructure corresponding to the Ptolemy model, instanciate a Kieler layout algorithm (AbstractLayoutProvider) and run its doLayout() method on the KGraph. The KGraph gets augmented with layout information (position and sizes of objects and bendpoints for connections). This information is then reapplied to the ptolemy model by stating MoMLChangeRequests with location attributes for nodes. So far setting connection bendpoints in Ptolemy is not supported. Hence the bendpoint information of KIELER is discarded, which may result in suboptimal results as the Ptolemy connection router does not consider obstacle avoidance.
 * @param composite the container of the diagram in terms of an GraphModel.
 */
@Override public void layout(Object composite){
  _ptolemyModelUtil=new PtolemyModelUtil();
  if (_doApplyEdgeLayout) {
    if (_debug) {
      _time=System.currentTimeMillis();
      System.out.print("String_Node_Str");
    }
    PtolemyModelUtil._removeUnnecessaryRelations(this._compositeActor);
    if (_debug) {
      System.out.println("String_Node_Str" + (System.currentTimeMillis() - _time) + "String_Node_Str");
    }
  }
  if (_debug) {
    _time=System.currentTimeMillis();
    System.out.print("String_Node_Str");
  }
  KNode hierarchicalLayoutNode=KimlLayoutUtil.createInitializedNode();
  KNode boxLayoutNode=KimlLayoutUtil.createInitializedNode();
  hierarchicalLayoutNode.setParent(boxLayoutNode);
  KShapeLayout layout=KimlLayoutUtil.getShapeLayout(hierarchicalLayoutNode);
  LayoutOptions.setLayoutDirection(layout,LayoutDirection.HORIZONTAL);
  LayoutOptions.setMinSpacing(layout,MIN_SPACING);
  _createGraph(composite,hierarchicalLayoutNode,boxLayoutNode);
  if (_debug) {
    System.out.println("String_Node_Str" + (System.currentTimeMillis() - _time) + "String_Node_Str");
    _time=System.currentTimeMillis();
    System.out.print("String_Node_Str");
  }
  HierarchicalDataflowLayoutProvider hierarchicalLayoutProvider=new HierarchicalDataflowLayoutProvider();
  BoxLayoutProvider boxLayoutProvider=new BoxLayoutProvider();
  IKielerProgressMonitor progressMonitor=new BasicProgressMonitor();
  try {
    hierarchicalLayoutProvider.doLayout(hierarchicalLayoutNode,progressMonitor.subTask(10));
    KPoint offset=KielerGraphUtil._getUpperLeftCorner(hierarchicalLayoutNode);
    layout.setXpos(layout.getXpos() - offset.getX());
    layout.setYpos(layout.getYpos() - offset.getY());
    if (_doBoxLayout) {
      boxLayoutProvider.doLayout(boxLayoutNode,progressMonitor.subTask(10));
    }
    if (_debug) {
      System.out.println("String_Node_Str" + (System.currentTimeMillis() - _time) + "String_Node_Str");
      KielerGraphUtil._writeToFile(boxLayoutNode);
      _time=System.currentTimeMillis();
      System.out.print("String_Node_Str");
    }
    _applyLayout(hierarchicalLayoutNode);
    if (_debug) {
      System.out.println("String_Node_Str" + (System.currentTimeMillis() - _time) + "String_Node_Str");
    }
  }
 catch (  KielerException e) {
    throw new GraphInvalidStateException(e,"String_Node_Str" + e.getMessage());
  }
catch (  IllegalActionException e) {
    throw new GraphInvalidStateException(e,"String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Layout the given composite. Main entry point for the layout action. Create a Kieler KGraph datastructure corresponding to the Ptolemy model, instanciate a Kieler layout algorithm (AbstractLayoutProvider) and run its doLayout() method on the KGraph. The KGraph gets augmented with layout information (position and sizes of objects and bendpoints for connections). This information is then reapplied to the ptolemy model by stating MoMLChangeRequests with location attributes for nodes. So far setting connection bendpoints in Ptolemy is not supported. Hence the bendpoint information of KIELER is discarded, which may result in suboptimal results as the Ptolemy connection router does not consider obstacle avoidance.
 * @param composite the container of the diagram in terms of an GraphModel.
 */
@Override public void layout(Object composite){
  _ptolemyModelUtil=new PtolemyModelUtil();
  if (_doApplyEdgeLayout) {
    if (_debug) {
      _time=System.currentTimeMillis();
      System.out.print("String_Node_Str");
    }
    PtolemyModelUtil._removeUnnecessaryRelations(this._compositeActor);
    if (_debug) {
      System.out.println("String_Node_Str" + (System.currentTimeMillis() - _time) + "String_Node_Str");
    }
  }
  if (_debug) {
    _time=System.currentTimeMillis();
    System.out.print("String_Node_Str");
  }
  KNode hierarchicalLayoutNode=KimlLayoutUtil.createInitializedNode();
  KNode boxLayoutNode=KimlLayoutUtil.createInitializedNode();
  hierarchicalLayoutNode.setParent(boxLayoutNode);
  KShapeLayout layout=KimlLayoutUtil.getShapeLayout(hierarchicalLayoutNode);
  LayoutOptions.setLayoutDirection(layout,LayoutDirection.HORIZONTAL);
  LayoutOptions.setMinSpacing(layout,MIN_SPACING);
  _createGraph(composite,hierarchicalLayoutNode,boxLayoutNode);
  if (_debug) {
    System.out.println("String_Node_Str" + (System.currentTimeMillis() - _time) + "String_Node_Str");
    _time=System.currentTimeMillis();
    System.out.print("String_Node_Str");
  }
  HierarchicalDataflowLayoutProvider hierarchicalLayoutProvider=new HierarchicalDataflowLayoutProvider();
  BoxLayoutProvider boxLayoutProvider=new BoxLayoutProvider();
  IKielerProgressMonitor progressMonitor=new BasicProgressMonitor();
  try {
    hierarchicalLayoutProvider.doLayout(hierarchicalLayoutNode,progressMonitor.subTask(10));
    KPoint offset=KielerGraphUtil._getUpperLeftCorner(hierarchicalLayoutNode);
    if (_debug) {
      System.out.println("String_Node_Str" + layout.getXpos() + "String_Node_Str"+ layout.getYpos());
      System.out.println("String_Node_Str" + offset.getX() + "String_Node_Str"+ offset.getY());
    }
    layout.setXpos(layout.getXpos() - offset.getX());
    layout.setYpos(layout.getYpos() - offset.getY());
    if (_doBoxLayout) {
      boxLayoutProvider.doLayout(boxLayoutNode,progressMonitor.subTask(10));
    }
    if (_debug) {
      System.out.println("String_Node_Str" + (System.currentTimeMillis() - _time) + "String_Node_Str");
      KielerGraphUtil._writeToFile(boxLayoutNode);
      _time=System.currentTimeMillis();
      System.out.print("String_Node_Str");
    }
    _applyLayout(hierarchicalLayoutNode);
    if (_debug) {
      System.out.println("String_Node_Str" + (System.currentTimeMillis() - _time) + "String_Node_Str");
    }
  }
 catch (  KielerException e) {
    throw new GraphInvalidStateException(e,"String_Node_Str" + e.getMessage());
  }
catch (  IllegalActionException e) {
    throw new GraphInvalidStateException(e,"String_Node_Str" + e.getMessage());
  }
}