nus-yam/ex-repair huggingface dataset:
Program: 51712
Project: 51712
Buggy source:
/** 
 * Create a command used to begin connecting to nodes.   {@link OPMStructuralLinkAggregatorEditPart} nodes cannot besource nodes, therefore in this case a  {@link UnexecutableCommand} is returned.
 * @return a {@link Command} that contains the initial information neede tocreate a connection between two nodes.
 */
@Override protected Command getConnectionCreateCommand(CreateConnectionRequest request){
  if (request.getSourceEditPart() instanceof OPMStructuralLinkAggregatorEditPart) {
    return null;
  }
  if (request.getNewObject() instanceof OPMStructuralLinkAggregator) {
    request.setStartCommand(new Command(){
    }
);
    return request.getStartCommand();
  }
  OPMLinkCreateCommand result=new OPMLinkCreateCommand();
  OPMNode source=(OPMNode)getHost().getModel();
  if (source instanceof OPMDecorated<?>)   source=(OPMNode)((OPMDecorated<?>)source).getDecorated();
  result.setSource(source);
  result.setLink((OPMLink)request.getNewObject());
  OPMObjectProcessDiagram opd=OPDAnalysis.findOPD((OPMNode)getHost().getModel());
  if (opd instanceof OPMDecorated<?>)   opd=(OPMObjectProcessDiagram)((OPMDecorated<?>)opd).getDecorated();
  result.setOPD(opd);
  request.setStartCommand(result);
  return result;
}

Fixed version (ground truth):
/** 
 * Create a command used to begin connecting to nodes.   {@link OPMStructuralLinkAggregatorEditPart} nodes cannot besource nodes, therefore in this case a  {@link UnexecutableCommand} is returned.
 * @return a {@link Command} that contains the initial information neede tocreate a connection between two nodes.
 */
@Override protected Command getConnectionCreateCommand(CreateConnectionRequest request){
  if (getHost() instanceof OPMStructuralLinkAggregatorEditPart) {
    return null;
  }
  OPMLinkCreateCommand result=new OPMLinkCreateCommand();
  OPMNode source=(OPMNode)getHost().getModel();
  if (source instanceof OPMDecorated<?>)   source=(OPMNode)((OPMDecorated<?>)source).getDecorated();
  result.setSource(source);
  result.setLink((OPMLink)request.getNewObject());
  OPMObjectProcessDiagram opd=OPDAnalysis.findOPD((OPMNode)getHost().getModel());
  if (opd instanceof OPMDecorated<?>)   opd=(OPMObjectProcessDiagram)((OPMDecorated<?>)opd).getDecorated();
  result.setOPD(opd);
  request.setStartCommand(result);
  return result;
}
Program: 51713
Project: 51713
Buggy source:
/** 
 * Retrieves the command created by  {@link OPMNodeGraphicalNodeEditPolicy#getConnectionCreateCommand(CreateConnectionRequest) getConnectionCreateCommand}, and adds it information so that the command can be executed.   {@link OPMStructuralLinkAggregatorEditPart} nodes cannotbe source nodes, therefore in this case a  {@link UnexecutableCommand} isreturned.
 * @return a {@link Command} that can be executed to create a connectionbetween two nodes.
 */
@Override protected Command getConnectionCompleteCommand(CreateConnectionRequest request){
  if (request.getStartCommand() == null || request.getTargetEditPart() instanceof OPMStructuralLinkAggregatorEditPart) {
    return null;
  }
  OPMLinkCreateCommand linkCreateCommand=(OPMLinkCreateCommand)request.getStartCommand();
  OPMNode target=(OPMNode)getHost().getModel();
  if (target instanceof OPMDecorated<?>)   target=(OPMNode)((OPMDecorated<?>)target).getDecorated();
  linkCreateCommand.setTarget(target);
  if (request.getNewObject() instanceof OPMStructuralLink) {
    setStructuralLinkAggregatorPosition(request);
  }
  return linkCreateCommand;
}

Fixed version (ground truth):
/** 
 * Retrieves the command created by  {@link OPMNodeGraphicalNodeEditPolicy#getConnectionCreateCommand(CreateConnectionRequest) getConnectionCreateCommand}, and adds it information so that the command can be executed.   {@link OPMStructuralLinkAggregatorEditPart} nodes cannotbe source nodes, therefore in this case a  {@link UnexecutableCommand} isreturned.
 * @return a {@link Command} that can be executed to create a connectionbetween two nodes.
 */
@Override protected Command getConnectionCompleteCommand(CreateConnectionRequest request){
  if (request.getStartCommand() == null || request.getTargetEditPart() instanceof OPMStructuralLinkAggregatorEditPart || getHost() instanceof OPMStructuralLinkAggregatorEditPart) {
    return null;
  }
  OPMLinkCreateCommand linkCreateCommand=(OPMLinkCreateCommand)request.getStartCommand();
  OPMNode target=(OPMNode)getHost().getModel();
  if (target instanceof OPMDecorated<?>)   target=(OPMNode)((OPMDecorated<?>)target).getDecorated();
  linkCreateCommand.setTarget(target);
  if (request.getNewObject() instanceof OPMStructuralLink) {
    setStructuralLinkAggregatorPosition(request);
  }
  return linkCreateCommand;
}
Program: 51714
Project: 51714
Buggy source:
/** 
 * <p> When the user requests the creation of a structural link, the following is done: </p> <ol> <li>If this is the first structural link of its kind between the source and target nodes, we create a new aggregator and connect it to the source and target.</li> <li>If there already is an aggregator of its kind between the nodes, we only add a new link from the aggregator to the new target.</li> </ol>
 * @param request the user request to create a new strucutral link between the nodes.
 * @return a command that creates the links as stated above.
 */
private Command handleOPMStructuralLinkRequest(CreateConnectionRequest request){
  Command command=null;
  OPMNode sNode=(OPMNode)request.getSourceEditPart().getModel();
  OPMNode tNode=(OPMNode)request.getTargetEditPart().getModel();
  OPMStructuralLink agrNode=(OPMStructuralLink)request.getNewObject();
  boolean aggregatorFound=false;
  for (  OPMLink structuralLink : OPDAnalysis.findOutgoingStructuralLinks(sNode)) {
    OPMStructuralLink existingAggregator=(OPMStructuralLink)structuralLink.getTarget();
    if (agrNode.eClass().isInstance(existingAggregator)) {
      aggregatorFound=true;
      agrNode=existingAggregator;
    }
  }
  if (aggregatorFound) {
  }
 else {
    OPMLinkCreateCommand linkCreateCommand=(OPMLinkCreateCommand)request.getStartCommand();
    linkCreateCommand.setTarget((OPMNode)getHost().getModel());
    agrNode.setAggregatorPosition(getAggregatorPosition(sNode,tNode));
    command=linkCreateCommand;
  }
  return command;
}

Fixed version (ground truth):
/** 
 * <p> When the user requests the creation of a structural link, the following is done: </p> <ol> <li>If this is the first structural link of its kind between the source and target nodes, we create a new aggregator and connect it to the source and target.</li> <li>If there already is an aggregator of its kind between the nodes, we only add a new link from the aggregator to the new target.</li> </ol>
 * @param request the user request to create a new strucutral link between the nodes.
 * @return a command that creates the links as stated above.
 */
private Command handleOPMStructuralLinkRequest(CreateConnectionRequest request){
  Command command=null;
  OPMNode sNode=(OPMNode)request.getSourceEditPart().getModel();
  OPMNode tNode=(OPMNode)request.getTargetEditPart().getModel();
  OPMStructuralLink agrNode=(OPMStructuralLink)request.getNewObject();
  boolean aggregatorFound=false;
  OPMStructuralLink existingAggregator=(OPMStructuralLink)OPDAnalysis.findFirstOutgoingLink(sNode,agrNode.eClass());
  if (null != existingAggregator) {
    aggregatorFound=true;
    agrNode=existingAggregator;
  }
  if (aggregatorFound) {
  }
 else {
    OPMLinkCreateCommand linkCreateCommand=(OPMLinkCreateCommand)request.getStartCommand();
    linkCreateCommand.setTarget((OPMNode)getHost().getModel());
    linkCreateCommand.getLink().setRouterKind(OPMLinkRouterKind.MANHATTAN);
    agrNode.setAggregatorPosition(getAggregatorPosition(sNode,tNode));
    command=linkCreateCommand;
  }
  return command;
}
Program: 51715
Project: 51715
Buggy source:
/** 
 * Add tools to create structural links in the diagram.
 */
private void addOPMStructuralLinkTools(){
  ConnectionCreationToolEntry entry;
  entry=new ConnectionCreationToolEntry("String_Node_Str","String_Node_Str",new OPMAggregationStructuralLinkAggregatorFactory(),ImageDescriptor.createFromFile(this.getClass(),"String_Node_Str"),ImageDescriptor.createFromFile(this.getClass(),"String_Node_Str"));
  group.add(entry);
  entry=new ConnectionCreationToolEntry("String_Node_Str","String_Node_Str",new OPMExhibitionStructuralLinkAggregatorFactory(),ImageDescriptor.createFromFile(this.getClass(),"String_Node_Str"),ImageDescriptor.createFromFile(this.getClass(),"String_Node_Str"));
  group.add(entry);
  entry=new ConnectionCreationToolEntry("String_Node_Str","String_Node_Str",new OPMGeneralizationStructuralLinkAggregatorFactory(),ImageDescriptor.createFromFile(this.getClass(),"String_Node_Str"),ImageDescriptor.createFromFile(this.getClass(),"String_Node_Str"));
  group.add(entry);
}

Fixed version (ground truth):
/** 
 * Add tools to create structural links in the diagram.
 */
private void addOPMStructuralLinkTools(){
  ConnectionCreationToolEntry entry;
  entry=new ConnectionCreationToolEntry("String_Node_Str","String_Node_Str",new OPMAggregationLinkFactory(),ImageDescriptor.createFromFile(this.getClass(),"String_Node_Str"),ImageDescriptor.createFromFile(this.getClass(),"String_Node_Str"));
  group.add(entry);
  entry=new ConnectionCreationToolEntry("String_Node_Str","String_Node_Str",new OPMExhibitionLinkFactory(),ImageDescriptor.createFromFile(this.getClass(),"String_Node_Str"),ImageDescriptor.createFromFile(this.getClass(),"String_Node_Str"));
  group.add(entry);
  entry=new ConnectionCreationToolEntry("String_Node_Str","String_Node_Str",new OPMGeneralizationLinkFactory(),ImageDescriptor.createFromFile(this.getClass(),"String_Node_Str"),ImageDescriptor.createFromFile(this.getClass(),"String_Node_Str"));
  group.add(entry);
}
Program: 51716
Project: 51716
Buggy source:
@Override public Object getObjectType(){
  return OPMProceduralLink.class;
}

Fixed version (ground truth):
@Override public Object getObjectType(){
  return OPMAgentLink.class;
}
Program: 51717
Project: 51717
Buggy source:
@Override public Object getNewObject(){
  OPMProceduralLink link=OPMFactory.eINSTANCE.createOPMProceduralLink();
  link.setKind(OPMProceduralLinkKind.AGENT);
  link.setId(OPMIdManager.getNextId());
  return link;
}

Fixed version (ground truth):
@Override public Object getNewObject(){
  OPMAgentLink link=OPMFactory.eINSTANCE.createOPMAgentLink();
  link.setId(OPMIdManager.getNextId());
  return link;
}
Program: 51718
Project: 51718
Buggy source:
@Override public Object getObjectType(){
  return OPMProceduralLink.class;
}

Fixed version (ground truth):
@Override public Object getObjectType(){
  return OPMConsumptionConditionLink.class;
}
Program: 51719
Project: 51719
Buggy source:
@Override public Object getNewObject(){
  OPMProceduralLink link=OPMFactory.eINSTANCE.createOPMProceduralLink();
  link.setKind(OPMProceduralLinkKind.CONSUMPTION_CONDITION);
  link.setId(OPMIdManager.getNextId());
  return link;
}

Fixed version (ground truth):
@Override public Object getNewObject(){
  OPMConsumptionConditionLink link=OPMFactory.eINSTANCE.createOPMConsumptionConditionLink();
  link.setId(OPMIdManager.getNextId());
  return link;
}
Program: 51720
Project: 51720
Buggy source:
@Override public Object getObjectType(){
  return OPMProceduralLink.class;
}

Fixed version (ground truth):
@Override public Object getObjectType(){
  return OPMConsumptionEventLink.class;
}
Program: 51721
Project: 51721
Buggy source:
@Override public Object getNewObject(){
  OPMProceduralLink link=OPMFactory.eINSTANCE.createOPMProceduralLink();
  link.setKind(OPMProceduralLinkKind.CONSUMPTION_EVENT);
  link.setId(OPMIdManager.getNextId());
  return link;
}

Fixed version (ground truth):
@Override public Object getNewObject(){
  OPMConsumptionEventLink link=OPMFactory.eINSTANCE.createOPMConsumptionEventLink();
  link.setId(OPMIdManager.getNextId());
  return link;
}
Program: 51722
Project: 51722
Buggy source:
@Override public Object getObjectType(){
  return OPMProceduralLink.class;
}

Fixed version (ground truth):
@Override public Object getObjectType(){
  return OPMConsumptionLink.class;
}
Program: 51723
Project: 51723
Buggy source:
@Override public Object getNewObject(){
  OPMProceduralLink link=OPMFactory.eINSTANCE.createOPMProceduralLink();
  link.setKind(OPMProceduralLinkKind.CONSUMPTION);
  link.setId(OPMIdManager.getNextId());
  return link;
}

Fixed version (ground truth):
@Override public Object getNewObject(){
  OPMConsumptionLink link=OPMFactory.eINSTANCE.createOPMConsumptionLink();
  link.setId(OPMIdManager.getNextId());
  return link;
}
Program: 51724
Project: 51724
Buggy source:
@Override public Object getObjectType(){
  return OPMProceduralLink.class;
}

Fixed version (ground truth):
@Override public Object getObjectType(){
  return OPMEffectLink.class;
}
Program: 51725
Project: 51725
Buggy source:
@Override public Object getNewObject(){
  OPMProceduralLink link=OPMFactory.eINSTANCE.createOPMProceduralLink();
  link.setKind(OPMProceduralLinkKind.EFFECT);
  link.setId(OPMIdManager.getNextId());
  return link;
}

Fixed version (ground truth):
@Override public Object getNewObject(){
  OPMEffectLink link=OPMFactory.eINSTANCE.createOPMEffectLink();
  link.setId(OPMIdManager.getNextId());
  return link;
}
Program: 51726
Project: 51726
Buggy source:
/** 
 * Create a new aggregator figure depending on the aggregator kind. 
 * @param kind the {@link OPMStructuralLinkAggregatorKind} of the figure.
 */
public OPMStructuralLinkAggregatorFigure(final OPMStructuralLinkAggregatorKind kind){
  this.kind=kind;
  setLayoutManager(new XYLayout());
  triangle=new IsoscelesTriangle();
  triangle.setBackgroundColor(ColorConstants.black);
switch (kind) {
case AGGREGATION:
    triangle.setFill(true);
  break;
case GENERALIZATION:
triangle.setFill(false);
break;
case EXHIBITION:
triangle.setFill(false);
triangle.setLayoutManager(new XYLayout());
innerTriangle=new IsoscelesTriangle();
innerTriangle.setDirection(Orientable.NORTH);
triangle.add(innerTriangle);
break;
default :
throw new IllegalArgumentException("String_Node_Str" + kind);
}
add(triangle);
}

Fixed version (ground truth):
/** 
 * Create a new aggregator figure depending on the aggregator kind. 
 * @param kind the {@link OPMStructuralLinkAggregatorKind} of the figure.
 */
public OPMStructuralLinkAggregatorFigure(final StructuralLinkKind kind){
  this.kind=kind;
  setLayoutManager(new XYLayout());
  triangle=new IsoscelesTriangle();
  triangle.setBackgroundColor(ColorConstants.black);
switch (kind) {
case AGGREGATION:
    triangle.setFill(true);
  break;
case GENERALIZATION:
triangle.setFill(false);
break;
case EXHIBITION:
triangle.setFill(false);
triangle.setLayoutManager(new XYLayout());
innerTriangle=new IsoscelesTriangle();
innerTriangle.setDirection(Orientable.NORTH);
triangle.add(innerTriangle);
break;
default :
throw new IllegalArgumentException("String_Node_Str" + kind);
}
add(triangle);
}
Program: 51727
Project: 51727
Buggy source:
@Override protected void paintFigure(Graphics graphics){
  Rectangle bounds=getBounds().getCopy();
  setConstraint(triangle,new Rectangle(0,0,bounds.width,bounds.height));
  if (kind == OPMStructuralLinkAggregatorKind.EXHIBITION) {
    triangle.setConstraint(innerTriangle,new Rectangle(bounds.width / 3,bounds.height / 2,bounds.width / 3,bounds.height / 3));
  }
  triangle.invalidate();
}

Fixed version (ground truth):
@Override protected void paintFigure(Graphics graphics){
  Rectangle bounds=getBounds().getCopy();
  setConstraint(triangle,new Rectangle(0,0,bounds.width,bounds.height));
  if (kind == StructuralLinkKind.EXHIBITION) {
    triangle.setConstraint(innerTriangle,new Rectangle(bounds.width / 3,bounds.height / 2,bounds.width / 3,bounds.height / 3));
  }
  triangle.invalidate();
}
Program: 51728
Project: 51728
Buggy source:
/** 
 * Extend the connection created by   {@link OPMLinkEditPart#createFigure()} by adding decorations depending on thelink kind. An agent link is decorated at the target with black filled  {@link CircleDecoration}. An instrument link is decorated at the target with a white filled   {@link CircleDecoration}. A consumption or result link is decorated at the target with a   {@link PolylineDecoration} (which is an arrow). An effect link link is decoratedat the source and target with a  {@link PolylineDecoration}.
 * @return a decorated {@link PolylineConnection} figure.
 */
@Override protected PolylineConnection createFigure(){
  OPMProceduralLink model=(OPMProceduralLink)getModel();
  PolylineConnection connection=new OPMProceduralLinkFigure(model.getKind());
  connection.setLineWidth(OPMFigureConstants.connectionLineWidth);
  centerDecorationLabel=new Label();
  ConnectionLocator locator=new ConnectionLocator(connection,ConnectionLocator.MIDDLE);
  connection.add(centerDecorationLabel,locator);
  connection.setConnectionRouter(new BendpointConnectionRouter());
  return connection;
}

Fixed version (ground truth):
/** 
 * Extend the connection created by   {@link OPMLinkEditPart#createFigure()} by adding decorations depending on thelink kind. An agent link is decorated at the target with black filled  {@link CircleDecoration}. An instrument link is decorated at the target with a white filled   {@link CircleDecoration}. A consumption or result link is decorated at the target with a   {@link PolylineDecoration} (which is an arrow). An effect link link is decoratedat the source and target with a  {@link PolylineDecoration}.
 * @return a decorated {@link PolylineConnection} figure.
 */
@Override protected PolylineConnection createFigure(){
  OPMProceduralLink model=(OPMProceduralLink)getModel();
  ProceduralLinkKind linkKind=OPMProceduralLinkToProceduralLinkKindConverter.INSTANCE.Convert(model);
  PolylineConnection connection=new OPMProceduralLinkFigure(linkKind,model.getActivationKind());
  connection.setLineWidth(OPMFigureConstants.connectionLineWidth);
  centerDecorationLabel=new Label();
  ConnectionLocator locator=new ConnectionLocator(connection,ConnectionLocator.MIDDLE);
  connection.add(centerDecorationLabel,locator);
  connection.setConnectionRouter(new BendpointConnectionRouter());
  return connection;
}
Program: 51729
Project: 51729
Buggy source:
@Override protected IFigure createFigure(){
  OPMStructuralLinkAggregator model=(OPMStructuralLinkAggregator)getModel();
  figure=new OPMStructuralLinkAggregatorFigure(model.getKind());
  return figure;
}

Fixed version (ground truth):
@Override protected IFigure createFigure(){
  OPMStructuralLink model=(OPMStructuralLink)getModel();
  linkKind=OPMStructuralLinkToStructuralLinkKindConverter.INSTANCE.Convert(model);
  figure=new OPMStructuralLinkAggregatorFigure(linkKind);
  return figure;
}
Program: 51730
Project: 51730
Buggy source:
@Override protected void refreshVisuals(){
  OPMStructuralLinkAggregator model=(OPMStructuralLinkAggregator)getModel();
  ((GraphicalEditPart)getParent()).setLayoutConstraint(this,figure,model.getConstraints());
}

Fixed version (ground truth):
@Override protected void refreshVisuals(){
  OPMStructuralLink model=(OPMStructuralLink)getModel();
  ((GraphicalEditPart)getParent()).setLayoutConstraint(this,figure,model.getConstraints());
}
Program: 51731
Project: 51731
Buggy source:
/** 
 * {@inheritDoc}<p> The action is enabled if all the selected entities on the editor are  {@link OPMNodeEditPart} instances</p>
 */
@Override protected boolean calculateEnabled(){
  if (getSelectedObjects().isEmpty()) {
    return false;
  }
  for (  Object selectedObject : getSelectedObjects()) {
    if (selectedObject instanceof OPMNodeEditPart) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}<p> The action is enabled if all the selected entities on the editor are  {@link OPMNodeEditPart} instances</p>
 */
@Override protected boolean calculateEnabled(){
  if (getSelectedObjects().isEmpty()) {
    return false;
  }
  for (  Object selectedObject : getSelectedObjects()) {
    if (!(selectedObject instanceof OPMNodeEditPart)) {
      return false;
    }
  }
  return true;
}
Program: 51732
Project: 51732
Buggy source:
/** 
 * Extend the connection creted by   {@link OPMLinkEditPart#createFigure()} byadding decorations depending on the link kind. An agent link is decorated at the target with black filled  {@link CircleDecoration}. An instrument link is decorated at the target with a white filled  {@link CircleDecoration}. A consumption or result link is decorated at the target with a   {@link PolylineDecoration} (which is an arrow). Aneffect link link is decorated at the source and target with a {@link PolylineDecoration}.
 * @return a decorated {@link PolylineConnection} figure.
 */
@Override protected PolylineConnection createFigure(){
  PolylineConnection connection=super.createFigure();
  OPMProceduralLink model=(OPMProceduralLink)getModel();
  decorateConnection(connection,model.getKind());
  sourceDecorationLabel=new Label();
  centerDecorationLabel=new Label();
  targetDecorationLabel=new Label();
  ConnectionLocator locator=new ConnectionLocator(connection,ConnectionLocator.SOURCE);
  connection.add(sourceDecorationLabel,locator);
  locator=new ConnectionLocator(connection,ConnectionLocator.MIDDLE);
  connection.add(centerDecorationLabel,locator);
  locator=new ConnectionLocator(connection,ConnectionLocator.TARGET);
  connection.add(targetDecorationLabel,locator);
  connection.add(centerDecorationLabel,locator);
  return connection;
}

Fixed version (ground truth):
/** 
 * Extend the connection created by   {@link OPMLinkEditPart#createFigure()}by adding decorations depending on the link kind. An agent link is decorated at the target with black filled   {@link CircleDecoration}. An instrument link is decorated at the target with a white filled  {@link CircleDecoration}. A consumption or result link is decorated at the target with a   {@link PolylineDecoration} (which is an arrow). Aneffect link link is decorated at the source and target with a {@link PolylineDecoration}.
 * @return a decorated {@link PolylineConnection} figure.
 */
@Override protected PolylineConnection createFigure(){
  PolylineConnection connection=super.createFigure();
  OPMProceduralLink model=(OPMProceduralLink)getModel();
  decorateConnection(connection,model.getKind());
  sourceDecorationLabel=new Label();
  centerDecorationLabel=new Label();
  targetDecorationLabel=new Label();
  ConnectionLocator locator=new ConnectionLocator(connection,ConnectionLocator.SOURCE);
  connection.add(sourceDecorationLabel,locator);
  locator=new ConnectionLocator(connection,ConnectionLocator.MIDDLE);
  connection.add(centerDecorationLabel,locator);
  locator=new ConnectionLocator(connection,ConnectionLocator.TARGET);
  connection.add(targetDecorationLabel,locator);
  return connection;
}
Program: 51733
Project: 51733
Buggy source:
@Override protected void createEditPolicies(){
  super.createEditPolicies();
  installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE,new OPMStateDirectEditPolicy());
  installEditPolicy("String_Node_Str",new SnapFeedbackPolicy());
}

Fixed version (ground truth):
@Override protected void createEditPolicies(){
  super.createEditPolicies();
  installEditPolicy("String_Node_Str",new SnapFeedbackPolicy());
}
Program: 51734
Project: 51734
Buggy source:
/** 
 * This functions is ignored. Use   {@link IsoscelesTriangle#setDirection(int)}instead.
 */
@Override @Deprecated public void setOrientation(final int orientation){
}

Fixed version (ground truth):
/** 
 * This functions is ignored. Use  {@link IsoscelesTriangle#setDirection(int)} instead.
 */
@Override @Deprecated public void setOrientation(final int orientation){
}
Program: 51735
Project: 51735
Buggy source:
/** 
 * Validates the figure, drawing a vertical isosceles triangle filling the  figure's bounds.
 */
@Override public void validate(){
  super.validate();
  Rectangle r=getBounds().getCopy();
  r.shrink(getInsets());
  r.resize(-1,-1);
  Point p1=null, p2=null, p3=null;
switch (direction) {
case NORTH:
    p1=new Point(r.x + r.width / 2,r.y);
  p2=new Point(r.x,r.y + r.height);
p3=new Point(r.x + r.width,r.y + r.height);
break;
case SOUTH:
p1=new Point(r.x + r.width / 2,r.y + r.height);
p2=new Point(r.x,r.y);
p3=new Point(r.x + r.width,r.y);
break;
case EAST:
p1=new Point(r.x,r.y);
p2=new Point(r.x + r.width,r.y + r.height / 2);
p3=new Point(r.x,r.y + r.height);
break;
case WEST:
p1=new Point(r.x + r.width,r.y);
p2=new Point(r.x + r.width,r.y + r.height);
p3=new Point(r.x,r.y + r.height / 2);
}
triangle.removeAllPoints();
triangle.addPoint(p1);
triangle.addPoint(p2);
triangle.addPoint(p3);
}

Fixed version (ground truth):
/** 
 * Validates the figure, drawing a vertical isosceles triangle filling the figure's bounds.
 */
@Override public void validate(){
  super.validate();
  Rectangle r=getBounds().getCopy();
  r.shrink(getInsets());
  r.resize(-1,-1);
  Point p1=null, p2=null, p3=null;
switch (direction) {
case NORTH:
    p1=new Point(r.x + r.width / 2,r.y);
  p2=new Point(r.x,r.y + r.height);
p3=new Point(r.x + r.width,r.y + r.height);
break;
case SOUTH:
p1=new Point(r.x + r.width / 2,r.y + r.height);
p2=new Point(r.x,r.y);
p3=new Point(r.x + r.width,r.y);
break;
case EAST:
p1=new Point(r.x,r.y);
p2=new Point(r.x + r.width,r.y + r.height / 2);
p3=new Point(r.x,r.y + r.height);
break;
case WEST:
p1=new Point(r.x + r.width,r.y);
p2=new Point(r.x + r.width,r.y + r.height);
p3=new Point(r.x,r.y + r.height / 2);
}
triangle.removeAllPoints();
triangle.addPoint(p1);
triangle.addPoint(p2);
triangle.addPoint(p3);
}
Program: 51736
Project: 51736
Buggy source:
public void run(){
  serv.addError(SpannableString.valueOf(err));
  for (  Channel channel : serv.getChannels()) {
    channel.addError(SpannableString.valueOf(err));
  }
  if (adapter != null) {
    adapter.notifyDataSetChanged();
    if (channelAdapter != null)     channelAdapter.notifyDataSetChanged();
  }
}

Fixed version (ground truth):
public void run(){
  serv.addMessage(Server.createError(SpannableString.valueOf(err)));
  for (  Channel channel : serv.getChannels()) {
    channel.addMessage(Channel.createError(SpannableString.valueOf(err)));
  }
  if (adapter != null) {
    adapter.notifyDataSetChanged();
    if (channelAdapter != null)     channelAdapter.notifyDataSetChanged();
  }
}
Program: 51737
Project: 51737
Buggy source:
@Override public boolean onKeyDown(int keyCode,KeyEvent event){
  if (keyCode == KeyEvent.KEYCODE_BACK) {
    if (channelList.getVisibility() == View.VISIBLE) {
      channelList.setVisibility(View.GONE);
    }
 else {
      moveTaskToBack(true);
    }
    return true;
  }
 else   if (keyCode == KeyEvent.KEYCODE_MENU) {
    if (channelList.getVisibility() == View.VISIBLE) {
      channelList.setVisibility(View.GONE);
    }
 else     if (channelList.getVisibility() == View.GONE) {
      channelList.setVisibility(View.VISIBLE);
    }
    return true;
  }
  return super.onKeyDown(keyCode,event);
}

Fixed version (ground truth):
@Override public boolean onKeyDown(int keyCode,KeyEvent event){
  if (keyCode == KeyEvent.KEYCODE_BACK) {
    if (channelList.getVisibility() == View.VISIBLE) {
      channelList.setVisibility(View.GONE);
    }
 else {
      moveTaskToBack(true);
    }
    return true;
  }
 else   if (keyCode == KeyEvent.KEYCODE_MENU) {
    if (channelList.getVisibility() == View.VISIBLE) {
      channelList.setVisibility(View.GONE);
    }
 else     if (channelList.getVisibility() == View.GONE) {
      channelList.setVisibility(View.VISIBLE);
      expandAllServerGroups();
    }
    return true;
  }
  return super.onKeyDown(keyCode,event);
}
Program: 51738
Project: 51738
Buggy source:
private void sendMessage(){
  if (this.commandInterpreter == null) {
    this.commandInterpreter=new CommandInterpreter(this.moeService,this);
  }
  String message=this.sendText.getText().toString();
  if (this.commandInterpreter.isCommand(message)) {
    this.commandInterpreter.interpret(message);
    this.sendText.setText("String_Node_Str");
  }
 else {
    if (message.length() >= 2 && message.substring(0,2).equals("String_Node_Str")) {
      message=message.substring(1,message.length());
    }
    if (this.currentChannel != null) {
      if (message.length() > 0) {
        if (this.currentChannel instanceof Server) {
          SpannedString error=SpannedString.valueOf("String_Node_Str");
          this.currentChannel.addError(error);
        }
 else {
          this.currentChannel.sendMessage(message);
        }
        this.sendText.setText("String_Node_Str");
        this.adapter.notifyDataSetChanged();
      }
    }
  }
}

Fixed version (ground truth):
private void sendMessage(){
  if (this.commandInterpreter == null) {
    this.commandInterpreter=new CommandInterpreter(this.moeService,this);
  }
  String message=this.sendText.getText().toString();
  if (this.commandInterpreter.isCommand(message)) {
    this.commandInterpreter.interpret(message);
    this.sendText.setText("String_Node_Str");
  }
 else {
    if (message.length() >= 2 && message.substring(0,2).equals("String_Node_Str")) {
      message=message.substring(1,message.length());
    }
    if (this.currentChannel != null) {
      if (message.length() > 0) {
        if (this.currentChannel instanceof Server) {
          this.currentChannel.addMessage(Channel.createError(SpannedString.valueOf("String_Node_Str")));
        }
 else {
          this.currentChannel.sendMessage(message);
        }
        this.sendText.setText("String_Node_Str");
        this.adapter.notifyDataSetChanged();
      }
    }
  }
}
Program: 51739
Project: 51739
Buggy source:
public void serverDisconnected(Server server,String error){
  if (server != null) {
    final String err=error;
    final Server serv=server;
    this.runOnUiThread(new Runnable(){
      public void run(){
        serv.addError(SpannableString.valueOf(err));
        for (        Channel channel : serv.getChannels()) {
          channel.addError(SpannableString.valueOf(err));
        }
        if (adapter != null) {
          adapter.notifyDataSetChanged();
          if (channelAdapter != null)           channelAdapter.notifyDataSetChanged();
        }
      }
    }
);
  }
}

Fixed version (ground truth):
public void serverDisconnected(Server server,String error){
  if (server != null) {
    final String err=error;
    final Server serv=server;
    this.runOnUiThread(new Runnable(){
      public void run(){
        serv.addMessage(Server.createError(SpannableString.valueOf(err)));
        for (        Channel channel : serv.getChannels()) {
          channel.addMessage(Channel.createError(SpannableString.valueOf(err)));
        }
        if (adapter != null) {
          adapter.notifyDataSetChanged();
          if (channelAdapter != null)           channelAdapter.notifyDataSetChanged();
        }
      }
    }
);
  }
}
Program: 51740
Project: 51740
Buggy source:
protected Boolean doInBackground(String... arguments){
  if (arguments.length < 1) {
    return false;
  }
  this.server=serverMap.get(arguments[0]);
  this.client=this.server.getClient();
  this.preferences=this.client.getServerPreferences();
  boolean connected=false;
  ServerPreferences.Host host=this.preferences.getHost();
  try {
    if (connectedEventListener != null) {
      channelJoined(server,null);
    }
    if (host.isSSL()) {
      if (host.verifySSL()) {
        this.client.connect(host.getHostname(),host.getPort(),host.getPassword(),SSLSocketFactory.getDefault());
      }
 else {
        this.client.connect(host.getHostname(),host.getPort(),host.getPassword(),new UtilSSLSocketFactory().trustAllCertificates());
      }
    }
 else {
      this.client.connect(host.getHostname(),host.getPort(),host.getPassword());
    }
    connected=true;
  }
 catch (  Exception ex) {
    Log.e("String_Node_Str",ex.getMessage());
    server.addError(Html.fromHtml("String_Node_Str" + ex.getMessage() + "String_Node_Str"));
    statusMessageReceived(server,null);
    return false;
  }
  return connected;
}

Fixed version (ground truth):
protected Boolean doInBackground(String... arguments){
  if (arguments.length < 1) {
    return false;
  }
  this.server=serverMap.get(arguments[0]);
  this.client=this.server.getClient();
  this.preferences=this.client.getServerPreferences();
  boolean connected=false;
  ServerPreferences.Host host=this.preferences.getHost();
  try {
    if (connectedEventListener != null) {
      channelJoined(server,null);
    }
    if (host.isSSL()) {
      if (host.verifySSL()) {
        this.client.connect(host.getHostname(),host.getPort(),host.getPassword(),SSLSocketFactory.getDefault());
      }
 else {
        this.client.connect(host.getHostname(),host.getPort(),host.getPassword(),new UtilSSLSocketFactory().trustAllCertificates());
      }
    }
 else {
      this.client.connect(host.getHostname(),host.getPort(),host.getPassword());
    }
    connected=true;
  }
 catch (  Exception ex) {
    statusMessageReceived(server,Server.createError(Html.fromHtml("String_Node_Str" + ex.getMessage() + "String_Node_Str")));
    return false;
  }
  return connected;
}
Program: 51745
Project: 51745
Buggy source:
public void onServerResponse(ServerResponseEvent<Client> event){
  Server server=this.service.getServer(event.getBot().getServerPreferences().getName());
  String response=event.getResponse();
  if (response == null || response.isEmpty()) {
    return;
  }
  response=response.trim();
  if (response.startsWith("String_Node_Str")) {
    response=response.substring(1,response.length() - 1).trim();
  }
  if (response.startsWith("String_Node_Str")) {
    response=response.substring(1,response.length() - 1).trim();
  }
  ServerMessage message=new ServerMessage();
  message.setContent(Html.fromHtml(MessageParser.parseToHTML(response)));
  message.setTime(new Date());
  this.service.statusMessageReceived(server,message);
}

Fixed version (ground truth):
public void onServerResponse(ServerResponseEvent<Client> event){
  Server server=this.service.getServer(event.getBot().getServerPreferences().getName());
  String response=event.getResponse();
  if (response == null || response.isEmpty()) {
    return;
  }
  response=response.trim();
  if (response.startsWith(event.getBot().getNick())) {
    response=response.substring(event.getBot().getNick().length(),response.length()).trim();
  }
  if (response.startsWith("String_Node_Str")) {
    response=response.substring(1,response.length()).trim();
  }
  if (response.startsWith("String_Node_Str")) {
    response=response.substring(1,response.length()).trim();
  }
  ServerMessage message=new ServerMessage();
  message.setContent(Html.fromHtml(MessageParser.parseToHTML(response)));
  message.setTime(new Date());
  this.service.statusMessageReceived(server,message);
}
Program: 51746
Project: 51746
Buggy source:
@Override public int onStartCommand(Intent intent,int flags,int startID){
  ArrayList<ServerPreferences> preferences=this.loadPreferences();
  for (  ServerPreferences serverPrefs : preferences) {
    if (serverPrefs.isAutoConnected()) {
      this.connect(serverPrefs);
    }
 else {
    }
  }
  super.onCreate();
  NotificationManager notificationManager=(NotificationManager)this.getSystemService(Context.NOTIFICATION_SERVICE);
  int icon=moe.lolis.metroirc.R.drawable.ic_launcher;
  this.constantNotification=new Notification(icon,"String_Node_Str",0);
  Context context=getApplicationContext();
  CharSequence contentTitle="String_Node_Str";
  CharSequence contentText="String_Node_Str";
  Intent notificationIntent=new Intent(this,ChannelActivity.class);
  PendingIntent contentIntent=PendingIntent.getActivity(this,0,notificationIntent,0);
  this.constantNotification.setLatestEventInfo(context,contentTitle,contentText,contentIntent);
  this.constantNotification.flags=Notification.FLAG_ONGOING_EVENT;
  this.startForeground(CONSTANT_FOREGROUND_ID,constantNotification);
  return Service.START_STICKY;
}

Fixed version (ground truth):
@Override public int onStartCommand(Intent intent,int flags,int startID){
  ArrayList<ServerPreferences> preferences=this.loadPreferences();
  for (  ServerPreferences serverPrefs : preferences) {
    if (serverPrefs.isAutoConnected()) {
      this.connect(serverPrefs);
    }
 else {
      this.addDisconnectedServer(serverPrefs);
    }
  }
  super.onCreate();
  NotificationManager notificationManager=(NotificationManager)this.getSystemService(Context.NOTIFICATION_SERVICE);
  int icon=moe.lolis.metroirc.R.drawable.ic_launcher;
  this.constantNotification=new Notification(icon,"String_Node_Str",0);
  Context context=getApplicationContext();
  CharSequence contentTitle="String_Node_Str";
  CharSequence contentText="String_Node_Str";
  Intent notificationIntent=new Intent(this,ChannelActivity.class);
  PendingIntent contentIntent=PendingIntent.getActivity(this,0,notificationIntent,0);
  this.constantNotification.setLatestEventInfo(context,contentTitle,contentText,contentIntent);
  this.constantNotification.flags=Notification.FLAG_ONGOING_EVENT;
  this.startForeground(CONSTANT_FOREGROUND_ID,constantNotification);
  return Service.START_STICKY;
}
Program: 51748
Project: 51748
Buggy source:
public void run(){
  serv.addMessage(serv.createError(SpannableString.valueOf(err)));
  for (  Channel channel : serv.getChannels())   channel.addMessage(channel.createError(SpannableString.valueOf(err)));
  if (adapter != null)   adapter.notifyDataSetChanged();
}

Fixed version (ground truth):
public void run(){
  serv.addMessage(serv.createError(SpannableString.valueOf(err)));
  for (  Channel channel : serv.getChannels())   channel.addMessage(channel.createError(SpannableString.valueOf(err)));
  if (adapter != null)   adapter.notifyDataSetChanged();
  if (channelAdapter != null)   channelAdapter.notifyDataSetChanged();
}
Program: 51749
Project: 51749
Buggy source:
public View getChildView(int groupPosition,int childPosition,boolean isLastChild,View convertView,ViewGroup parent){
  Channel c=servers.get(groupPosition).getChannels().get(childPosition);
  if (convertView == null) {
    convertView=inflater.inflate(R.layout.channellist_channel,null);
  }
  TextView name=(TextView)convertView.findViewById(R.id.name);
  TextView messages=(TextView)convertView.findViewById(R.id.unreadCount);
  name.setText(c.getChannelInfo().getName());
  if (c.getUnreadMessageCount() > 0) {
    messages.setText("String_Node_Str" + String.valueOf(c.getUnreadMessageCount()) + "String_Node_Str");
  }
 else {
    messages.setText("String_Node_Str");
  }
  return convertView;
}

Fixed version (ground truth):
public View getChildView(int groupPosition,int childPosition,boolean isLastChild,View convertView,ViewGroup parent){
  if (convertView == null) {
    convertView=inflater.inflate(R.layout.channellist_channel,null);
  }
  Server s=servers.get(groupPosition);
  if (s.getChannels().size() > 0) {
    Channel c=s.getChannels().get(childPosition);
    TextView name=(TextView)convertView.findViewById(R.id.name);
    TextView messages=(TextView)convertView.findViewById(R.id.unreadCount);
    name.setText(c.getChannelInfo().getName());
    if (c.getUnreadMessageCount() > 0) {
      messages.setText("String_Node_Str" + String.valueOf(c.getUnreadMessageCount()) + "String_Node_Str");
    }
 else {
      messages.setText("String_Node_Str");
    }
  }
  return convertView;
}
Program: 51750
Project: 51750
Buggy source:
public void serverDisconnected(Server server,String error){
  final Server serv=server;
  if (server != null) {
    final String err=error;
    this.runOnUiThread(new Runnable(){
      public void run(){
        serv.addMessage(serv.createError(SpannableString.valueOf(err)));
        for (        Channel channel : serv.getChannels())         channel.addMessage(channel.createError(SpannableString.valueOf(err)));
        if (adapter != null)         adapter.notifyDataSetChanged();
      }
    }
);
  }
}

Fixed version (ground truth):
public void serverDisconnected(Server server,String error){
  final Server serv=server;
  if (server != null) {
    final String err=error;
    this.runOnUiThread(new Runnable(){
      public void run(){
        serv.addMessage(serv.createError(SpannableString.valueOf(err)));
        for (        Channel channel : serv.getChannels())         channel.addMessage(channel.createError(SpannableString.valueOf(err)));
        if (adapter != null)         adapter.notifyDataSetChanged();
        if (channelAdapter != null)         channelAdapter.notifyDataSetChanged();
      }
    }
);
  }
}
Program: 51751
Project: 51751
Buggy source:
public void disconnect(String serverName){
  Server s=this.getServer(serverName);
  if (s != null) {
    if (s.getServerInfo().getBot().isConnected())     s.getServerInfo().getBot().disconnect();
    this.serverMap.remove(serverName);
    this.servers.remove(s);
  }
}

Fixed version (ground truth):
public void disconnect(String serverName){
  Server s=this.getServer(serverName);
  if (s != null) {
    if (s.getServerInfo().getBot().isConnected())     s.getServerInfo().getBot().disconnect();
    this.serverMap.remove(serverName);
    this.servers.remove(s);
    this.addDisconnectedServer(s.getServer().getServer().getServer().getServer().getServer().getServer().getServer().getServer().getServer().getServer().getServer().getServer().getServer().getClient().getServerPreferences());
    this.serverDisconnected(s,"String_Node_Str");
  }
}
Program: 51752
Project: 51752
Buggy source:
public void connect(ServerPreferences serverPrefs){
  ConnectTask connectionTask=new ConnectTask();
  connectionTask.execute(new ServerPreferences[]{serverPrefs});
}

Fixed version (ground truth):
public void connect(ServerPreferences serverPrefs){
  for (int i=0; i < this.getServers().size(); i++) {
    Server s=this.servers.get(i);
    if (s.getName().equals(serverPrefs.getName())) {
      this.servers.remove(s);
      this.serverMap.remove(s.getName());
    }
  }
  ConnectTask connectionTask=new ConnectTask();
  connectionTask.execute(new ServerPreferences[]{serverPrefs});
}
Program: 51753
Project: 51753
Buggy source:
public void addAutoChannel(String channel){
  this.autoChannels.add(channel);
}

Fixed version (ground truth):
public void addAutoChannel(String channel){
  if (!this.containsAutoChannel(channel))   this.autoChannels.add(channel);
}
Program: 51755
Project: 51755
Buggy source:
public String getOrderID(){
  return orderID;
}

Fixed version (ground truth):
public long getOrderID(){
  return orderID;
}
Program: 51756
Project: 51756
Buggy source:
public void setOrderID(String orderID){
  this.orderID=orderID;
}

Fixed version (ground truth):
public void setOrderID(long orderID){
  this.orderID=orderID;
}
Program: 51757
Project: 51757
Buggy source:
public void updatePK(){
  id=new OrderItem.PK(inventoryId,order.getOrderID());
}

Fixed version (ground truth):
public void updatePK(String inventoryId){
  id=new OrderItem.PK(inventoryId,order.getOrderID());
}
Program: 51758
Project: 51758
Buggy source:
/** 
 * Returns the hash code for the key.
 */
public int hashCode(){
  Util.debug("String_Node_Str" + inventoryID + "String_Node_Str");
  Util.debug("String_Node_Str" + order_orderID + "String_Node_Str");
  return (inventoryID.hashCode() + order_orderID.hashCode());
}

Fixed version (ground truth):
/** 
 * Returns the hash code for the key.
 */
public int hashCode(){
  Util.debug("String_Node_Str" + inventoryID + "String_Node_Str");
  Util.debug("String_Node_Str" + order_orderID + "String_Node_Str");
  return (inventoryID.hashCode() + (int)order_orderID);
}
Program: 51759
Project: 51759
Buggy source:
/** 
 * Returns true if both keys are equal.
 */
public boolean equals(java.lang.Object otherKey){
  if (otherKey instanceof PK) {
    PK o=(PK)otherKey;
    return ((this.inventoryID.equals(o.inventoryID)) && (this.order_orderID.equals(o.order_orderID)));
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Returns true if both keys are equal.
 */
public boolean equals(java.lang.Object otherKey){
  if (otherKey instanceof PK) {
    PK o=(PK)otherKey;
    return ((this.inventoryID.equals(o.inventoryID)) && (this.order_orderID == o.order_orderID));
  }
  return false;
}
Program: 51760
Project: 51760
Buggy source:
public OrderItem(Order order,String orderID,Inventory inv,java.lang.String name,java.lang.String pkginfo,float price,float cost,int quantity,int category,java.lang.String sellDate){
  Util.debug("String_Node_Str");
  inventory=inv;
  setInventoryId(inv.getInventoryId());
  setName(name);
  setPkginfo(pkginfo);
  setPrice(price);
  setCost(cost);
  setQuantity(quantity);
  setCategory(category);
  setSellDate(sellDate);
  setOrder(order);
  id=new OrderItem.PK(inv.getInventoryId(),order.getOrderID());
}

Fixed version (ground truth):
public OrderItem(Order order,String orderID,Inventory inv,java.lang.String name,java.lang.String pkginfo,float price,float cost,int quantity,int category,java.lang.String sellDate){
  Util.debug("String_Node_Str");
  inventory=inv;
  setName(name);
  setPkginfo(pkginfo);
  setPrice(price);
  setCost(cost);
  setQuantity(quantity);
  setCategory(category);
  setSellDate(sellDate);
  setOrder(order);
  id=new OrderItem.PK(inv.getInventoryId(),order.getOrderID());
}
Program: 51761
Project: 51761
Buggy source:
public PK(String inventoryID,String argOrder){
  Util.debug("String_Node_Str" + inventoryID + "String_Node_Str");
  Util.debug("String_Node_Str" + argOrder + "String_Node_Str");
  this.inventoryID=inventoryID;
  this.order_orderID=argOrder;
}

Fixed version (ground truth):
public PK(String inventoryID,long argOrder){
  Util.debug("String_Node_Str" + inventoryID + "String_Node_Str");
  Util.debug("String_Node_Str" + argOrder + "String_Node_Str");
  this.inventoryID=inventoryID;
  this.order_orderID=argOrder;
}
Program: 51762
Project: 51762
Buggy source:
/** 
 * Get the order ID.
 * @return Order ID 
 */
public String getID(){
  return orderID;
}

Fixed version (ground truth):
/** 
 * Get the order ID.
 * @return Order ID 
 */
public long getID(){
  return orderID;
}
Program: 51763
Project: 51763
Buggy source:
/** 
 * Create the Subject line.
 * @param orderKey The order number.
 * @return The Order number string.
 */
private String createSubjectLine(String orderKey){
  StringBuffer msg=new StringBuffer();
  msg.append("String_Node_Str" + orderKey);
  return msg.toString();
}

Fixed version (ground truth):
/** 
 * Create the Subject line.
 * @param orderKey The order number.
 * @return The Order number string.
 */
private String createSubjectLine(long orderKey){
  StringBuffer msg=new StringBuffer();
  msg.append("String_Node_Str" + orderKey);
  return msg.toString();
}