nus-yam/ex-repair huggingface dataset:
Program: 70931
Project: 70931
Buggy source:
protected void projectFrictionConstraints(VectorNd vel,double t0){
  updateFrictionConstraints();
  myRBSolver.updateStructure(myMass,myGT);
  myRBSolver.projectFriction(myMass,myGT,myNT,myDT,myRg,myBg,myRn,myBn,myBd,myFrictionInfo,vel,myLam,myThe,myPhi);
  int[] RBDTmap=myRBSolver.getDTMap();
  if (RBDTmap != null) {
    int[] DTmap=new int[myDT.numBlockCols() - RBDTmap.length];
    int i=0;
    int k=0;
    for (int bj=0; bj < myDT.numBlockCols(); bj++) {
      if (k < RBDTmap.length && RBDTmap[k] == bj) {
        k++;
      }
 else {
        DTmap[i++]=bj;
      }
    }
    if (i != DTmap.length) {
      throw new InternalErrorException("String_Node_Str");
    }
    updateInverseMassMatrix(t0);
    for (i=0; i < DTmap.length; i++) {
      FrictionInfo info=myFrictionInfo[DTmap[i]];
      double phiMax;
      if ((info.flags & FrictionInfo.BILATERAL) != 0) {
        phiMax=info.getMaxFriction(myLam);
      }
 else {
        phiMax=info.getMaxFriction(myThe);
      }
      int bj=DTmap[i];
      int j=myDT.getBlockColOffset(bj);
      double doff=myBd.get(j);
      double phi=projectSingleFrictionConstraint(vel,myDT,bj,phiMax,doff,true);
      myPhi.set(j,phi);
    }
  }
  if (myUpdateForcesAtStepEnd) {
    int velSize=myActiveVelSize;
    if (myDsize > 0) {
      myDT.mulAdd(myFcon,myPhi,velSize,myDsize);
    }
  }
}

Fixed version (ground truth):
protected void projectFrictionConstraints(VectorNd vel,double t0){
  updateFrictionConstraints();
  myRBSolver.updateStructure(myMass,myGT,myGTVersion);
  myRBSolver.projectFriction(myMass,myGT,myNT,myDT,myRg,myBg,myRn,myBn,myBd,myFrictionInfo,vel,myLam,myThe,myPhi);
  int[] RBDTmap=myRBSolver.getDTMap();
  if (RBDTmap != null) {
    int[] DTmap=new int[myDT.numBlockCols() - RBDTmap.length];
    int i=0;
    int k=0;
    for (int bj=0; bj < myDT.numBlockCols(); bj++) {
      if (k < RBDTmap.length && RBDTmap[k] == bj) {
        k++;
      }
 else {
        DTmap[i++]=bj;
      }
    }
    if (i != DTmap.length) {
      throw new InternalErrorException("String_Node_Str");
    }
    updateInverseMassMatrix(t0);
    for (i=0; i < DTmap.length; i++) {
      FrictionInfo info=myFrictionInfo[DTmap[i]];
      double phiMax;
      if ((info.flags & FrictionInfo.BILATERAL) != 0) {
        phiMax=info.getMaxFriction(myLam);
      }
 else {
        phiMax=info.getMaxFriction(myThe);
      }
      int bj=DTmap[i];
      int j=myDT.getBlockColOffset(bj);
      double doff=myBd.get(j);
      double phi=projectSingleFrictionConstraint(vel,myDT,bj,phiMax,doff,true);
      myPhi.set(j,phi);
    }
  }
  if (myUpdateForcesAtStepEnd) {
    int velSize=myActiveVelSize;
    if (myDsize > 0) {
      myDT.mulAdd(myFcon,myPhi,velSize,myDsize);
    }
  }
}
Program: 70932
Project: 70932
Buggy source:
protected boolean computeRigidBodyPosCorrections(VectorNd pos,double t){
  int velSize=myActiveVelSize;
  if (velSize == 0) {
    return false;
  }
  if (myConSolver == null) {
    myConSolver=new KKTSolver();
  }
  updateBilateralConstraints();
  updateUnilateralConstraints();
  myVel.setSize(velSize);
  if (myGsize > 0 || myNsize > 0) {
    mySys.getBilateralInfo(myGInfo);
    double[] gbuf=myBg.getBuffer();
    for (int i=0; i < myGsize; i++) {
      gbuf[i]=-myGInfo[i].dist;
    }
    myRg.setZero();
    mySys.getUnilateralInfo(myNInfo);
    double[] nbuf=myBn.getBuffer();
    for (int i=0; i < myNsize; i++) {
      nbuf[i]=-myNInfo[i].dist;
    }
    myRn.setZero();
    myVel.setZero();
    myLam.setZero();
    myThe.setZero();
    myRBSolver.updateStructure(myMass,myGT);
    if (myRBSolver.projectPosition(myMass,myGT,myNT,myBg,myBn,myVel,myLam,myThe)) {
      mySys.addActivePosImpulse(pos,1,myVel);
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
protected boolean computeRigidBodyPosCorrections(VectorNd pos,double t){
  int velSize=myActiveVelSize;
  if (velSize == 0) {
    return false;
  }
  if (myConSolver == null) {
    myConSolver=new KKTSolver();
  }
  updateBilateralConstraints();
  updateUnilateralConstraints();
  myVel.setSize(velSize);
  if (myGsize > 0 || myNsize > 0) {
    mySys.getBilateralInfo(myGInfo);
    double[] gbuf=myBg.getBuffer();
    for (int i=0; i < myGsize; i++) {
      gbuf[i]=-myGInfo[i].dist;
    }
    myRg.setZero();
    mySys.getUnilateralInfo(myNInfo);
    double[] nbuf=myBn.getBuffer();
    for (int i=0; i < myNsize; i++) {
      nbuf[i]=-myNInfo[i].dist;
    }
    myRn.setZero();
    myVel.setZero();
    myLam.setZero();
    myThe.setZero();
    myRBSolver.updateStructure(myMass,myGT,myGTVersion);
    if (myRBSolver.projectPosition(myMass,myGT,myNT,myBg,myBn,myVel,myLam,myThe)) {
      mySys.addActivePosImpulse(pos,1,myVel);
      return true;
    }
  }
  return false;
}
Program: 70933
Project: 70933
Buggy source:
public void updateStructure(SparseBlockMatrix M,SparseBlockMatrix GT){
  if (mySolver == null) {
    mySolver=new KKTSolver();
  }
  if (myStructureVersion != mySys.getStructureVersion()) {
    doUpdateStructure(M,GT);
    myStructureVersion=mySys.getStructureVersion();
  }
}

Fixed version (ground truth):
public void updateStructure(SparseBlockMatrix M,SparseBlockMatrix GT,int GTversion){
  if (mySolver == null) {
    mySolver=new KKTSolver();
  }
  if (myStructureVersion != mySys.getStructureVersion() || myBilateralVersion != GTversion) {
    doUpdateStructure(M,GT);
    myStructureVersion=mySys.getStructureVersion();
    myBilateralVersion=GTversion;
  }
}
Program: 70934
Project: 70934
Buggy source:
public void update(GL3 gl,ByteBuffer buff,int start){
  gl.glBindBuffer(target,boId);
  if (start == 0 && buff.limit() == size) {
    gl.glBufferData(target,size,null,usage);
  }
  gl.glBufferSubData(target,start * Byte.BYTES,buff.limit() * Byte.BYTES,buff);
}

Fixed version (ground truth):
public void update(GL3 gl,ByteBuffer buff,int start){
  gl.glBindBuffer(target,boId);
  if (start == 0 && buff.limit() == size) {
    gl.glBufferData(target,size,null,usage);
  }
  gl.glBufferSubData(target,start * GLSupport.BYTE_SIZE,buff.limit() * GLSupport.BYTE_SIZE,buff);
}
Program: 70935
Project: 70935
Buggy source:
public void fill(GL3 gl,ByteBuffer buff,int target,int usage){
  setInfo(target,buff.limit() * Byte.BYTES,usage);
  gl.glBindBuffer(target,boId);
  gl.glBufferData(target,buff.limit() * Byte.BYTES,buff,usage);
}

Fixed version (ground truth):
public void fill(GL3 gl,ByteBuffer buff,int target,int usage){
  setInfo(target,buff.limit() * GLSupport.BYTE_SIZE,usage);
  gl.glBindBuffer(target,boId);
  gl.glBufferData(target,buff.limit() * GLSupport.BYTE_SIZE,buff,usage);
}
Program: 70936
Project: 70936
Buggy source:
/** 
 * Returns the number of enabled clip distances
 * @param gl
 * @param clips
 * @return
 */
public int updateClipPlanes(GL3 gl,List<GLClipPlane> clips){
  float[] clipbuff=new float[getSize() / Float.BYTES];
  int nclips=0;
  for (  GLClipPlane cp : clips) {
    if (cp.isClippingEnabled()) {
      int idx=getOffset(nclips) / Float.BYTES;
      cp.getClipPlaneValues(clipbuff,idx,false);
      nclips++;
      if (nclips >= numClipPlanes) {
        break;
      }
      if (cp.isSlicingEnabled()) {
        idx=getOffset(nclips) / Float.BYTES;
        cp.getClipPlaneValues(clipbuff,idx,true);
        nclips++;
        if (nclips >= numClipPlanes) {
          break;
        }
      }
    }
  }
  FloatBuffer data=FloatBuffer.wrap(clipbuff);
  update(gl,data);
  return nclips;
}

Fixed version (ground truth):
/** 
 * Returns the number of enabled clip distances
 * @param gl
 * @param clips
 * @return
 */
public int updateClipPlanes(GL3 gl,List<GLClipPlane> clips){
  float[] clipbuff=new float[getSize() / GLSupport.FLOAT_SIZE];
  int nclips=0;
  for (  GLClipPlane cp : clips) {
    if (cp.isClippingEnabled()) {
      int idx=getOffset(nclips) / GLSupport.FLOAT_SIZE;
      cp.getClipPlaneValues(clipbuff,idx,false);
      nclips++;
      if (nclips >= numClipPlanes) {
        break;
      }
      if (cp.isSlicingEnabled()) {
        idx=getOffset(nclips) / GLSupport.FLOAT_SIZE;
        cp.getClipPlaneValues(clipbuff,idx,true);
        nclips++;
        if (nclips >= numClipPlanes) {
          break;
        }
      }
    }
  }
  FloatBuffer data=FloatBuffer.wrap(clipbuff);
  update(gl,data);
  return nclips;
}
Program: 70937
Project: 70937
Buggy source:
@Override public int bytesPerColor(){
  return 4 * Byte.BYTES;
}

Fixed version (ground truth):
@Override public int bytesPerColor(){
  return 4 * GLSupport.BYTE_SIZE;
}
Program: 70940
Project: 70940
Buggy source:
@Override public void getHardReferences(List<ModelComponent> refs){
  super.getHardReferences(refs);
  if (myFrame != null) {
    refs.add(myFrame);
  }
  if (myElement != null) {
    refs.add(myElement);
  }
 else   if (myNodes != null) {
    for (    FemNode n : myNodes) {
      refs.add(n);
    }
  }
}

Fixed version (ground truth):
@Override public void getHardReferences(List<ModelComponent> refs){
  super.getHardReferences(refs);
  if (myElement != null) {
    refs.add(myElement);
  }
}
Program: 70941
Project: 70941
Buggy source:
@Override public void getHardReferences(List<ModelComponent> refs){
  super.getHardReferences(refs);
  refs.add(getPoint());
  if (myNodes != null) {
    for (    FemNode node : myNodes) {
      refs.add(node);
    }
  }
}

Fixed version (ground truth):
@Override public void getHardReferences(List<ModelComponent> refs){
  super.getHardReferences(refs);
  if (myElement != null) {
    refs.add(myElement);
  }
}
Program: 70942
Project: 70942
Buggy source:
@Override public void getHardReferences(List<ModelComponent> refs){
  super.getHardReferences(refs);
  DynamicAttachment ax=getAttachment();
  if (ax != null) {
    ax.getHardReferences(refs);
  }
}

Fixed version (ground truth):
@Override public void getHardReferences(List<ModelComponent> refs){
  super.getHardReferences(refs);
  DynamicAttachment ax=getAttachment();
  if (ax != null) {
    ArrayList<ModelComponent> allrefs=new ArrayList<ModelComponent>();
    ax.getHardReferences(allrefs);
    allrefs.remove(this);
    refs.addAll(allrefs);
  }
}
Program: 70944
Project: 70944
Buggy source:
/** 
 * Returns the closest ancestor of a component (or the component itself) for which   {@link CompositeComponent#hierarchyContainsReferences() hierarchyContainsDependencies()} returns <code>true</code>.That means all inter-component references are contained within the ancestor's hierarchy. If no such ancestor is found,  <code>null</code> is returned.
 * @return closest encapsulated ancestor
 */
public static CompositeComponent nearestEncapsulatingAncestor(ModelComponent c){
  CompositeComponent ancestor;
  if (c instanceof CompositeComponent) {
    ancestor=(CompositeComponent)c;
  }
 else {
    ancestor=c.getParent();
  }
  while (ancestor != null) {
    if (ancestor.hierarchyContainsReferences()) {
      return ancestor;
    }
    ancestor=ancestor.getParent();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the closest ancestor of a component (or the component itself) for which   {@link CompositeComponent#hierarchyContainsReferences() hierarchyContainsDependencies()} returns <code>true</code>.That means all inter-component references are contained within the ancestor's hierarchy. If no such ancestor is found,  <code>null</code> is returned.
 * @return closest encapsulating ancestor
 */
public static CompositeComponent nearestEncapsulatingAncestor(ModelComponent c){
  CompositeComponent ancestor;
  if (c instanceof CompositeComponent) {
    ancestor=(CompositeComponent)c;
  }
 else {
    ancestor=c.getParent();
  }
  while (ancestor != null) {
    if (ancestor.hierarchyContainsReferences()) {
      return ancestor;
    }
    ancestor=ancestor.getParent();
  }
  return null;
}
Program: 70945
Project: 70945
Buggy source:
public static <C extends ModelComponent>void updateReferences(ModelComponent c,List<C> refs,boolean undo,Deque<Object> undoInfo){
  if (undo) {
    Object obj=undoInfo.getFirst();
    if (obj != ModelComponentBase.NULL_OBJ) {
      ((ListRemove<C>)obj).undo();
    }
  }
 else {
    ListRemove<C> remove=null;
    if (refs != null) {
      for (int i=0; i < refs.size(); i++) {
        if (!ComponentUtils.isConnected(c,refs.get(i))) {
          if (remove == null) {
            remove=new ListRemove<C>(refs);
          }
          remove.requestRemove(i);
        }
      }
    }
    if (remove != null) {
      remove.remove();
      undoInfo.addLast(remove);
    }
 else {
      undoInfo.addLast(ModelComponentBase.NULL_OBJ);
    }
  }
}

Fixed version (ground truth):
public static <C extends ModelComponent>void updateReferences(ModelComponent c,List<C> refs,boolean undo,Deque<Object> undoInfo){
  if (undo) {
    Object obj=undoInfo.removeFirst();
    if (obj != ModelComponentBase.NULL_OBJ) {
      ((ListRemove<C>)obj).undo();
    }
  }
 else {
    ListRemove<C> remove=null;
    if (refs != null) {
      for (int i=0; i < refs.size(); i++) {
        if (!ComponentUtils.isConnected(c,refs.get(i))) {
          if (remove == null) {
            remove=new ListRemove<C>(refs);
          }
          remove.requestRemove(i);
        }
      }
    }
    if (remove != null) {
      remove.remove();
      undoInfo.addLast(remove);
    }
 else {
      undoInfo.addLast(ModelComponentBase.NULL_OBJ);
    }
  }
}
Program: 70946
Project: 70946
Buggy source:
public void addSkinMesh() throws IOException {
  String dataDir=ArtisynthPath.getSrcRelativePath(Tentacle.class,"String_Node_Str");
  String meshFilename=dataDir + "String_Node_Str";
  PolygonalMesh tentacle=new PolygonalMesh(new File(meshFilename));
  TextureProps tp=new TextureProps();
  tp.setFileName(dataDir + "String_Node_Str");
  tp.setMode(Mode.DECAL);
  tp.setEnabled(true);
  RenderProps rp=new RenderProps(myMechMod.getRenderProps());
  rp.setFaceStyle(Faces.FRONT);
  rp.setFaceColor(new Color(255,187,187));
  rp.setDrawEdges(false);
  rp.setLineColor(Color.BLACK);
  rp.setTextureProps(tp);
  tentacle.setRenderProps(rp);
  Point3d min=new Point3d(inf,inf,inf);
  Point3d max=new Point3d(-inf,-inf,-inf);
  tentacle.updateBounds(min,max);
  Vector3d tentacleBounds=new Vector3d();
  tentacleBounds.sub(max,min);
  min=new Point3d(inf,inf,inf);
  max=new Point3d(-inf,-inf,-inf);
  for (  RigidBody body : myMechMod.rigidBodies()) {
    if (body.isDynamic()) {
      body.updateBounds(min,max);
    }
  }
  Vector3d skeletonBounds=new Vector3d();
  skeletonBounds.sub(max,min);
  tentacle.scale(0.011);
  RigidTransform3d X=new RigidTransform3d();
  X.p.x=-skeletonBounds.x / 2;
  tentacle.transform(X);
  SkinMesh skinMesh=new SkinMesh(tentacle);
  ArrayList<RigidBody> skinnedBodies=new ArrayList<RigidBody>();
  for (  RigidBody body : myMechMod.rigidBodies()) {
    skinnedBodies.add(body);
    skinMesh.addFrame(body);
  }
  skinMesh.computeWeights();
  skinMesh.setRenderProps(rp);
  myMechMod.addMeshBody(skinMesh);
}

Fixed version (ground truth):
public void addSkinMesh() throws IOException {
  String dataDir=ArtisynthPath.getSrcRelativePath(RigidTentacle.class,"String_Node_Str");
  String meshFilename=dataDir + "String_Node_Str";
  PolygonalMesh tentacle=new PolygonalMesh(new File(meshFilename));
  TextureProps tp=new TextureProps();
  tp.setFileName(dataDir + "String_Node_Str");
  tp.setMode(Mode.DECAL);
  tp.setEnabled(true);
  RenderProps rp=new RenderProps(myMechMod.getRenderProps());
  rp.setFaceStyle(Faces.FRONT);
  rp.setFaceColor(new Color(255,187,187));
  rp.setDrawEdges(false);
  rp.setLineColor(Color.BLACK);
  rp.setTextureProps(tp);
  tentacle.setRenderProps(rp);
  Point3d min=new Point3d(inf,inf,inf);
  Point3d max=new Point3d(-inf,-inf,-inf);
  tentacle.updateBounds(min,max);
  Vector3d tentacleBounds=new Vector3d();
  tentacleBounds.sub(max,min);
  min=new Point3d(inf,inf,inf);
  max=new Point3d(-inf,-inf,-inf);
  for (  RigidBody body : myMechMod.rigidBodies()) {
    if (body.isDynamic()) {
      body.updateBounds(min,max);
    }
  }
  Vector3d skeletonBounds=new Vector3d();
  skeletonBounds.sub(max,min);
  tentacle.scale(0.011);
  RigidTransform3d X=new RigidTransform3d();
  X.p.x=-skeletonBounds.x / 2;
  tentacle.transform(X);
  SkinMesh skinMesh=new SkinMesh(tentacle);
  ArrayList<RigidBody> skinnedBodies=new ArrayList<RigidBody>();
  for (  RigidBody body : myMechMod.rigidBodies()) {
    skinnedBodies.add(body);
    skinMesh.addFrame(body);
  }
  skinMesh.computeWeights();
  skinMesh.setRenderProps(rp);
  myMechMod.addMeshBody(skinMesh);
}
Program: 70947
Project: 70947
Buggy source:
/** 
 * Currently only detects type by file extension.  For Abaqus use .inp,  Ansys .elem, and Tetgen .ele.  If a .node is supplied, the method will try to find a corresponding .ele or .elem file.
 * @param fileName
 * @return type of the file
 * @throws IOException
 */
public static FemFileType detectType(String fileName){
  String ext=getFileExtension(fileName);
  ext=ext.toLowerCase();
  if ("String_Node_Str".equals(ext)) {
    return FemFileType.ABAQUS;
  }
 else   if ("String_Node_Str".equals(ext)) {
    return FemFileType.ANSYS;
  }
 else   if ("String_Node_Str".equals(ext)) {
    return FemFileType.TETGEN;
  }
 else   if ("String_Node_Str".equals(ext)) {
    String baseName=removeExtension(fileName);
    String elemName=baseName + "String_Node_Str";
    File elemFile=new File(elemName);
    if (elemFile.exists()) {
      return FemFileType.TETGEN;
    }
    elemName=baseName + "String_Node_Str";
    elemFile=new File(elemName);
    if (elemFile.exists()) {
      return FemFileType.ANSYS;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Currently only detects type by file extension.  For Abaqus use .inp,  Ansys .elem, and Tetgen .ele.  If a .node is supplied, the method will try to find a corresponding .ele or .elem file.
 * @param fileName
 * @return type of the file
 */
public static FemFileType detectType(String fileName){
  String ext=getFileExtension(fileName);
  ext=ext.toLowerCase();
  if ("String_Node_Str".equals(ext)) {
    return FemFileType.ABAQUS;
  }
 else   if ("String_Node_Str".equals(ext)) {
    return FemFileType.ANSYS;
  }
 else   if ("String_Node_Str".equals(ext)) {
    return FemFileType.TETGEN;
  }
 else   if ("String_Node_Str".equals(ext)) {
    String baseName=removeExtension(fileName);
    String elemName=baseName + "String_Node_Str";
    File elemFile=new File(elemName);
    if (elemFile.exists()) {
      return FemFileType.TETGEN;
    }
    elemName=baseName + "String_Node_Str";
    elemFile=new File(elemName);
    if (elemFile.exists()) {
      return FemFileType.ANSYS;
    }
  }
  return null;
}
Program: 70950
Project: 70950
Buggy source:
/** 
 * Finds the nearest node to a specified point that is within a specified maximum distance. If no node is within the specified maximum distance, <code>null</code> is returned.
 * @param pnt Point for which the nearest node should be located
 * @param maxDist Maximum distance that the node must be from thepoint. If <code>maxDist</code> < 0, then <code>null</code> will be returned.
 * @return Nearest point within the prescribed distance, or <code>null</code>if there is no such point
 */
public FemNode3d findNearestNode(Point3d pnt,double maxDist){
  if (maxDist < 0) {
    return null;
  }
  BVTree bvtree=getBVTree();
  ArrayList<BVNode> nodes=new ArrayList<BVNode>();
  bvtree.intersectSphere(nodes,pnt,maxDist);
  FemNode3d nearest=null;
  double dist=1 + 2 * maxDist;
  for (  BVNode n : nodes) {
    Boundable[] elements=n.getElements();
    for (int i=0; i < elements.length; i++) {
      FemElement3d e=(FemElement3d)elements[i];
      for (int k=0; k < e.numNodes(); k++) {
        double d=e.myNodes[k].getPosition().distance(pnt);
        if (d < dist && d <= maxDist) {
          dist=d;
          nearest=e.myNodes[k];
        }
      }
    }
  }
  return nearest;
}

Fixed version (ground truth):
/** 
 * Finds the nearest node to a specified point that is within a specified maximum distance. If no node is within the specified maximum distance, <code>null</code> is returned.
 * @param pnt Point for which the nearest node should be located
 * @param maxDist Maximum distance that the node must be from thepoint. If <code>maxDist</code> &lt; 0, then <code>null</code> will be returned.
 * @return Nearest point within the prescribed distance, or <code>null</code>if there is no such point
 */
public FemNode3d findNearestNode(Point3d pnt,double maxDist){
  if (maxDist < 0) {
    return null;
  }
  BVTree bvtree=getBVTree();
  ArrayList<BVNode> nodes=new ArrayList<BVNode>();
  bvtree.intersectSphere(nodes,pnt,maxDist);
  FemNode3d nearest=null;
  double dist=1 + 2 * maxDist;
  for (  BVNode n : nodes) {
    Boundable[] elements=n.getElements();
    for (int i=0; i < elements.length; i++) {
      FemElement3d e=(FemElement3d)elements[i];
      for (int k=0; k < e.numNodes(); k++) {
        double d=e.myNodes[k].getPosition().distance(pnt);
        if (d < dist && d <= maxDist) {
          dist=d;
          nearest=e.myNodes[k];
        }
      }
    }
  }
  return nearest;
}
Program: 70951
Project: 70951
Buggy source:
/** 
 * Adds pressure stiffness to the matrix Kij via the formula <pre> Kij = Bi^T D Bj </pre> where gi and gj are the gradients for shape functions i and j, Bi and Bj are the B matrices formed from gi and gj, and D is created from the pressure p according to D_ii = -p and D_ij = p for i != j and i, j < 3.
 */
public static void addPressureStiffness(Matrix3d K,Vector3d gi,double p,Vector3d gj,double dv){
  double gjx=p * gj.x * dv;
  double gjy=p * gj.y * dv;
  double gjz=p * gj.z * dv;
  double gix=gi.x;
  double giy=gi.y;
  double giz=gi.z;
  double diag=-gix * gjx - giy * gjy - giz * gjz;
synchronized (K) {
    K.m00+=diag;
    K.m01+=gix * gjy - giy * gjx;
    K.m02+=gix * gjz - giz * gjx;
    K.m10+=giy * gjx - gix * gjy;
    K.m11+=diag;
    K.m12+=giy * gjz - giz * gjy;
    K.m20+=giz * gjx - gix * gjz;
    K.m21+=giz * gjy - giy * gjz;
    K.m22+=diag;
  }
}

Fixed version (ground truth):
/** 
 * Adds pressure stiffness to the matrix Kij via the formula <pre> Kij = Bi^T D Bj </pre> where gi and gj are the gradients for shape functions i and j, Bi and Bj are the B matrices formed from gi and gj, and D is created from the pressure p according to D_ii = -p and D_ij = p for i != j and i, j &lt; 3.
 */
public static void addPressureStiffness(Matrix3d K,Vector3d gi,double p,Vector3d gj,double dv){
  double gjx=p * gj.x * dv;
  double gjy=p * gj.y * dv;
  double gjz=p * gj.z * dv;
  double gix=gi.x;
  double giy=gi.y;
  double giz=gi.z;
  double diag=-gix * gjx - giy * gjy - giz * gjz;
synchronized (K) {
    K.m00+=diag;
    K.m01+=gix * gjy - giy * gjx;
    K.m02+=gix * gjz - giz * gjx;
    K.m10+=giy * gjx - gix * gjy;
    K.m11+=diag;
    K.m12+=giy * gjz - giz * gjy;
    K.m20+=giz * gjx - gix * gjz;
    K.m21+=giz * gjy - giy * gjz;
    K.m22+=diag;
  }
}
Program: 70952
Project: 70952
Buggy source:
/** 
 * Returns true if the selection list contains a set of components & for which collisions can be set.
 */
public boolean containsCollidableSelection(LinkedList<ModelComponent> selection){
  int numRigidBodies=0;
  for (  ModelComponent c : selection) {
    if (!(c instanceof Collidable)) {
      return false;
    }
 else     if (c instanceof RigidBody) {
      numRigidBodies++;
    }
  }
  System.out.println("String_Node_Str" + numRigidBodies);
  if (numRigidBodies == selection.size()) {
    return numRigidBodies >= 2;
  }
 else {
    return true;
  }
}

Fixed version (ground truth):
/** 
 * Returns true if the selection list contains a set of components &amp; for which collisions can be set.
 */
public boolean containsCollidableSelection(LinkedList<ModelComponent> selection){
  int numRigidBodies=0;
  for (  ModelComponent c : selection) {
    if (!(c instanceof Collidable)) {
      return false;
    }
 else     if (c instanceof RigidBody) {
      numRigidBodies++;
    }
  }
  System.out.println("String_Node_Str" + numRigidBodies);
  if (numRigidBodies == selection.size()) {
    return numRigidBodies >= 2;
  }
 else {
    return true;
  }
}
Program: 70953
Project: 70953
Buggy source:
/** 
 * Create inequality constraints A >= b from bounds lb and ub
 */
public void createBoundConstraints(MatrixNd A,VectorNd b,VectorNd lb,VectorNd ub){
  A.setIdentity();
  int idx=0;
  if (lb != null) {
    for (int i=0; i < lb.size(); i++) {
      A.set(idx,i,1.0);
      b.set(idx++,lb.get(i));
    }
  }
  if (ub != null) {
    for (int i=0; i < ub.size(); i++) {
      A.set(idx,i,-1.0);
      b.set(idx++,-ub.get(i));
    }
  }
}

Fixed version (ground truth):
/** 
 * Create inequality constraints A &gt;= b from bounds lb and ub
 */
public void createBoundConstraints(MatrixNd A,VectorNd b,VectorNd lb,VectorNd ub){
  A.setIdentity();
  int idx=0;
  if (lb != null) {
    for (int i=0; i < lb.size(); i++) {
      A.set(idx,i,1.0);
      b.set(idx++,lb.get(i));
    }
  }
  if (ub != null) {
    for (int i=0; i < ub.size(); i++) {
      A.set(idx,i,-1.0);
      b.set(idx++,-ub.get(i));
    }
  }
}
Program: 70954
Project: 70954
Buggy source:
/** 
 * Solves the Quadratic Program of the form: min { x^T*Q*x + x^T*L }, subject to A*x <= b, Aeq*x = beq
 * @return x
 */
public VectorNd solve(double t0,double t1){
  Q.setZero();
  P.setZero();
  for (  QPTerm term : myCostTerms) {
    term.getQP(Q,P,t0,t1);
  }
  int rowoff=0;
  for (  LeastSquaresTerm term : myInequalityTerms) {
    term.getTerm(A,b,rowoff,t0,t1);
  }
  rowoff=0;
  for (  LeastSquaresTerm term : myEqualityTerms) {
    term.getTerm(Aeq,beq,rowoff,t0,t1);
  }
  try {
    if (Aeq.rowSize() == 0 || beq.size() == 0) {
      mySolver.solve(x,Q,P,A,b);
    }
 else {
      Status qpStatus=mySolver.solve(x,Q,P,A,b,Aeq,beq);
      if (qpStatus != Status.SOLVED) {
        System.err.println("String_Node_Str" + qpStatus.toString());
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return x;
}

Fixed version (ground truth):
/** 
 * Solves the Quadratic Program of the form: min { x^T*Q*x + x^T*L }, subject to A*x &lt;= b, Aeq*x = beq
 * @return x
 */
public VectorNd solve(double t0,double t1){
  Q.setZero();
  P.setZero();
  for (  QPTerm term : myCostTerms) {
    term.getQP(Q,P,t0,t1);
  }
  int rowoff=0;
  for (  LeastSquaresTerm term : myInequalityTerms) {
    term.getTerm(A,b,rowoff,t0,t1);
  }
  rowoff=0;
  for (  LeastSquaresTerm term : myEqualityTerms) {
    term.getTerm(Aeq,beq,rowoff,t0,t1);
  }
  try {
    if (Aeq.rowSize() == 0 || beq.size() == 0) {
      mySolver.solve(x,Q,P,A,b);
    }
 else {
      Status qpStatus=mySolver.solve(x,Q,P,A,b,Aeq,beq);
      if (qpStatus != Status.SOLVED) {
        System.err.println("String_Node_Str" + qpStatus.toString());
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return x;
}
Program: 70955
Project: 70955
Buggy source:
/** 
 * Computes <pre> T y -= G  x </pre> where y and x are vectors associated with master and slave components, respectively, and G is the constraint matrix for the attachment.
 * @param ybuf buffer into which to store result
 * @param yoff offset into ybuf
 * @param xbuf buffer containing right hand side vector
 * @param xoff offset into xbuf
 * @param B matrix associated with a slave component
 * @param idx master component index
 */
protected abstract void mulSubGT(double[] ybuf,int yoff,double[] xbuf,int xoff,int idx);

Fixed version (ground truth):
/** 
 * Computes <pre> T y -= G  x </pre> where y and x are vectors associated with master and slave components, respectively, and G is the constraint matrix for the attachment.
 * @param ybuf buffer into which to store result
 * @param yoff offset into ybuf
 * @param xbuf buffer containing right hand side vector
 * @param xoff offset into xbuf
 * @param idx master component index
 */
protected abstract void mulSubGT(double[] ybuf,int yoff,double[] xbuf,int xoff,int idx);
Program: 70956
Project: 70956
Buggy source:
/** 
 * Returns the current velocity of the attached frame, in frame coordinates. Also optionally returns the velocity derivative term, defined by <pre> \dot J velm <pre> where <code>J</code> is the matrix that maps master velocities to the attached frame velocity (in frame coordinates), and <code>velm</code> are the master velocities.
 * @param vel used to return current frame velocity
 * @param dvel if not <code>null</code>, returns the velocity derivative term
 */
public abstract void getCurrentVel(Twist vel,Twist dvel);

Fixed version (ground truth):
/** 
 * Returns the current velocity of the attached frame, in frame coordinates. Also optionally returns the velocity derivative term, defined by <pre> \dot J velm </pre> where <code>J</code> is the matrix that maps master velocities to the attached frame velocity (in frame coordinates), and <code>velm</code> are the master velocities.
 * @param vel used to return current frame velocity
 * @param dvel if not <code>null</code>, returns the velocity derivative term
 */
public abstract void getCurrentVel(Twist vel,Twist dvel);
Program: 70957
Project: 70957
Buggy source:
/** 
 * Returns the collision behavior for a specified pair of collidables <code>a</code> and <code>b</code>. Generic designations (such as   {@link Collidable#RigidBody}) are not allowed. The returned behavior is the current effective behavior resulting from the application of all default and explicit collision behavior settings. <p> If <code>a</code> or <i><code>b</code> contain sub-collidables, then if a consistent collision behavior is found amount all pairs of sub-collidables, that behavior is returned; otherwise, <code>null</code> is returned. If <code>a</code> equals <i><code>b</code>, then this method searches for a consistent collision behavior among all sub-collidables of <code>a</code> whose   {@link Collidable#getCollidable getCollidable()}method returns <code>Colidability.ALL</code> or <code>Colidability.INTERNAL</code>.
 * @param a first collidable
 * @param b second collidable
 * @return behavior for this pair of collidables.
 */
public CollisionBehavior getCollisionBehavior(Collidable a,Collidable b){
  return myCollisionManager.getBehavior(a,b);
}

Fixed version (ground truth):
/** 
 * Returns the collision behavior for a specified pair of collidables <code>a</code> and <code>b</code>. Generic designations (such as   {@link Collidable#RigidBody}) are not allowed. The returned behavior is the current effective behavior resulting from the application of all default and explicit collision behavior settings. <p> If <code>a</code> or <code>b</code> contain sub-collidables, then if a consistent collision behavior is found amount all pairs of sub-collidables, that behavior is returned; otherwise, <code>null</code> is returned. If <code>a</code> equals <code>b</code>, then this method searches for a consistent collision behavior among all sub-collidables of <code>a</code> whose   {@link Collidable#getCollidable getCollidable()}method returns <code>Colidability.ALL</code> or <code>Colidability.INTERNAL</code>.
 * @param a first collidable
 * @param b second collidable
 * @return behavior for this pair of collidables.
 */
public CollisionBehavior getCollisionBehavior(Collidable a,Collidable b){
  return myCollisionManager.getBehavior(a,b);
}
Program: 70958
Project: 70958
Buggy source:
/** 
 * Removes all dependencies with have very low weights ( |w| <= tol )
 * @return true if modified
 */
public boolean reduceDependencies(double tol);

Fixed version (ground truth):
/** 
 * Removes all dependencies with have very low weights ( |w| &lt;= tol )
 * @return true if modified
 */
public boolean reduceDependencies(double tol);
Program: 70959
Project: 70959
Buggy source:
/** 
 * Attempts to scan and store a specific set of property values for a specified host. Checks if the current token is a word  matching one of the specified property names.  If so, scan either '=' or ':' and the following property value, store the property name and value in the token  queue using a <code>StrinToken</code> and an <code>ObjectToken</code>,  and return <code>true</code>. Otherwise, return <code>false</code>. <p> This method is intended for handling property values which must be set in the <i>post-scan</i> stage after references have been set. 
 * @param rtok input token stream
 * @param host host containing the properties
 * @param propNames names of properties to match
 * @param tokens token queue for postscan
 * @return <core>true</code> if a property value was scannedand stored.
 * @throws IOException
 */
public static boolean scanAndStorePropertyValues(ReaderTokenizer rtok,HasProperties host,String[] propNames,Deque<ScanToken> tokens) throws IOException {
  if (rtok.ttype == TT_WORD) {
    for (int i=0; i < propNames.length; i++) {
      if (rtok.sval.equals(propNames[i])) {
        tokens.offer(new StringToken(rtok.sval,rtok.lineno()));
        Object val=scanPropertyValue(rtok,host,propNames[i]);
        tokens.offer(new ObjectToken(val));
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Attempts to scan and store a specific set of property values for a specified host. Checks if the current token is a word  matching one of the specified property names.  If so, scan either '=' or ':' and the following property value, store the property name and value in the token  queue using a <code>StrinToken</code> and an <code>ObjectToken</code>,  and return <code>true</code>. Otherwise, return <code>false</code>. <p> This method is intended for handling property values which must be set in the <i>post-scan</i> stage after references have been set. 
 * @param rtok input token stream
 * @param host host containing the properties
 * @param propNames names of properties to match
 * @param tokens token queue for postscan
 * @return <code>true</code> if a property value was scannedand stored.
 * @throws IOException
 */
public static boolean scanAndStorePropertyValues(ReaderTokenizer rtok,HasProperties host,String[] propNames,Deque<ScanToken> tokens) throws IOException {
  if (rtok.ttype == TT_WORD) {
    for (int i=0; i < propNames.length; i++) {
      if (rtok.sval.equals(propNames[i])) {
        tokens.offer(new StringToken(rtok.sval,rtok.lineno()));
        Object val=scanPropertyValue(rtok,host,propNames[i]);
        tokens.offer(new ObjectToken(val));
        return true;
      }
    }
  }
  return false;
}
Program: 70960
Project: 70960
Buggy source:
/** 
 * Main function Usage: java artisynth.core.moviemaker.AnimatedGifWriter [options] <list of input files> <output file>
 */
public static void main(String[] args) throws Exception {
  DoubleHolder delayHolder=new DoubleHolder(0);
  IntHolder loopHolder=new IntHolder(1);
  String[] left=parseArgs(args,delayHolder,loopHolder);
  if (left == null || left.length < 2) {
    return;
  }
  ArrayList<BufferedImage> imageList=new ArrayList<BufferedImage>(left.length);
  for (int i=0; i < left.length - 1; i++) {
    try {
      BufferedImage image=ImageIO.read(new File(left[i]));
      imageList.add(image);
    }
 catch (    Exception e) {
      System.err.println("String_Node_Str" + left[i] + "String_Node_Str");
    }
  }
  String outputFile=left[left.length - 1];
  if (imageList.size() > 0) {
    write(new File(outputFile),imageList,delayHolder.value,loopHolder.value);
  }
}

Fixed version (ground truth):
/** 
 * Main function Usage: java artisynth.core.moviemaker.AnimatedGifWriter [options] &lt;list of input files&gt; &lt;output file&gt;
 */
public static void main(String[] args) throws Exception {
  DoubleHolder delayHolder=new DoubleHolder(0);
  IntHolder loopHolder=new IntHolder(1);
  String[] left=parseArgs(args,delayHolder,loopHolder);
  if (left == null || left.length < 2) {
    return;
  }
  ArrayList<BufferedImage> imageList=new ArrayList<BufferedImage>(left.length);
  for (int i=0; i < left.length - 1; i++) {
    try {
      BufferedImage image=ImageIO.read(new File(left[i]));
      imageList.add(image);
    }
 catch (    Exception e) {
      System.err.println("String_Node_Str" + left[i] + "String_Node_Str");
    }
  }
  String outputFile=left[left.length - 1];
  if (imageList.size() > 0) {
    write(new File(outputFile),imageList,delayHolder.value,loopHolder.value);
  }
}
Program: 70961
Project: 70961
Buggy source:
/** 
 * Sets the Timeline track number associated with this probe. The Timeline should use this method to keep the track information current.
 * @param num new track< number
 */
public void setTrack(int num){
  myTrackNum=num;
}

Fixed version (ground truth):
/** 
 * Sets the Timeline track number associated with this probe. The Timeline should use this method to keep the track information current.
 * @param num new track number
 */
public void setTrack(int num){
  myTrackNum=num;
}
Program: 70962
Project: 70962
Buggy source:
/** 
 * Set number of lines to scroll up 0 <= offset <= # buffered lines - lines on screen
 */
public void setScrollOffset(int offset){
  myScrollOffset=offset;
  myScrollOffset=Math.max(myScrollOffset,0);
  myScrollOffset=Math.min(myScrollOffset,myNumLines);
}

Fixed version (ground truth):
/** 
 * Set number of lines to scroll up 0 &lt;= offset &lt;= # buffered lines - lines on screen
 */
public void setScrollOffset(int offset){
  myScrollOffset=offset;
  myScrollOffset=Math.max(myScrollOffset,0);
  myScrollOffset=Math.min(myScrollOffset,myNumLines);
}
Program: 70963
Project: 70963
Buggy source:
/** 
 * Creates a decoder provided the supplied conversion command
 * @see #setConvertCommand(String)
 */
public DicomImageDecoderImageMagick(String identifyCmd,String convertCmd){
  setCommands(identifyCmd,convertCmd);
}

Fixed version (ground truth):
/** 
 * Creates a decoder provided the supplied conversion command
 */
public DicomImageDecoderImageMagick(String identifyCmd,String convertCmd){
  setCommands(identifyCmd,convertCmd);
}
Program: 70965
Project: 70965
Buggy source:
public static ExcitationSourceList updateReferences(ModelComponent host,ExcitationSourceList sources,boolean undo,Deque<Object> undoInfo){
  if (undo) {
    Object obj=undoInfo.removeFirst();
    if (obj != ModelComponentBase.NULL_OBJ) {
      ListRemove<ExcitationSource> remove=(ListRemove<ExcitationSource>)obj;
      if (sources == null) {
        sources=(ExcitationSourceList)remove.getList();
      }
      remove.undo();
    }
  }
 else   if (sources != null) {
    ListRemove<ExcitationSource> remove=null;
    for (int i=0; i < sources.size(); i++) {
      if (!ComponentUtils.isConnected(host,sources.get(i).myComp)) {
        if (remove == null) {
          remove=new ListRemove<ExcitationSource>(sources);
        }
        remove.requestRemove(i);
      }
    }
    if (remove != null) {
      remove.remove();
      if (sources.size() == 0) {
        sources=null;
      }
      undoInfo.addLast(remove);
    }
 else {
      undoInfo.addLast(ModelComponentBase.NULL_OBJ);
    }
  }
  return sources;
}

Fixed version (ground truth):
public static ExcitationSourceList updateReferences(ModelComponent host,ExcitationSourceList sources,boolean undo,Deque<Object> undoInfo){
  if (undo) {
    Object obj=undoInfo.removeFirst();
    if (obj != ModelComponentBase.NULL_OBJ) {
      ListRemove<ExcitationSource> remove=(ListRemove<ExcitationSource>)obj;
      if (sources == null) {
        sources=(ExcitationSourceList)remove.getList();
      }
      remove.undo();
    }
  }
 else {
    ListRemove<ExcitationSource> remove=null;
    if (sources != null) {
      for (int i=0; i < sources.size(); i++) {
        if (!ComponentUtils.isConnected(host,sources.get(i).myComp)) {
          if (remove == null) {
            remove=new ListRemove<ExcitationSource>(sources);
          }
          remove.requestRemove(i);
        }
      }
    }
    if (remove != null) {
      remove.remove();
      if (sources.size() == 0) {
        sources=null;
      }
      undoInfo.addLast(remove);
    }
 else {
      undoInfo.addLast(ModelComponentBase.NULL_OBJ);
    }
  }
  return sources;
}
Program: 70966
Project: 70966
Buggy source:
public Texture getTexture(String name,byte[] bytes,int width,int height,int srcPixelFormat,int target,int dstPixelFormat,int minFilter,int magFilter){
  int textureID=createTextureID();
  Texture texture=new Texture(target,textureID);
  gl.glBindTexture(target,textureID);
  texture.setWidth(width);
  texture.setHeight(height);
  if (target == GL2.GL_TEXTURE_2D) {
    gl.glTexParameteri(target,GL2.GL_TEXTURE_MIN_FILTER,minFilter);
    gl.glTexParameteri(target,GL2.GL_TEXTURE_MAG_FILTER,magFilter);
  }
  ByteBuffer buffer=ByteBuffer.allocate(bytes.length);
  buffer.put(bytes);
  buffer.position(0);
  gl.glTexImage2D(target,0,dstPixelFormat,width,height,0,srcPixelFormat,GL2.GL_UNSIGNED_BYTE,buffer);
  return texture;
}

Fixed version (ground truth):
public Texture getTexture(String name,byte[] bytes,int width,int height,int srcPixelFormat,int target,int dstPixelFormat,int minFilter,int magFilter){
  int textureID=createTextureID();
  Texture texture=new Texture(target,textureID);
  gl.glBindTexture(target,textureID);
  texture.setWidth(width);
  texture.setHeight(height);
  if (target == GL2.GL_TEXTURE_2D) {
    gl.glTexParameteri(target,GL2.GL_TEXTURE_MIN_FILTER,minFilter);
    gl.glTexParameteri(target,GL2.GL_TEXTURE_MAG_FILTER,magFilter);
  }
  ByteBuffer buffer=ByteBuffer.allocateDirect(bytes.length);
  buffer.put(bytes);
  buffer.rewind();
  if (width % 4 != 0) {
    gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT,1);
  }
  gl.glTexImage2D(target,0,dstPixelFormat,width,height,0,srcPixelFormat,GL2.GL_UNSIGNED_BYTE,buffer);
  if (width % 4 != 0) {
    gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT,4);
  }
  return texture;
}
Program: 70967
Project: 70967
Buggy source:
public Map<Vertex3d,Vector3d> getContactImpulses(){
  LinkedHashMap<Vertex3d,Vector3d> map=new LinkedHashMap<Vertex3d,Vector3d>();
  for (  ContactConstraint c : myBilaterals0.values()) {
    accumulateImpulses(map,c.myCpnt0,c.getNormal(),c.getImpulse());
  }
  for (  ContactConstraint c : myBilaterals1.values()) {
    accumulateImpulses(map,c.myCpnt1,c.getNormal(),-c.getImpulse());
  }
  return map;
}

Fixed version (ground truth):
public Map<Vertex3d,Vector3d> getContactImpulses(CollidableBody colA){
  LinkedHashMap<Vertex3d,Vector3d> map=new LinkedHashMap<Vertex3d,Vector3d>();
  for (  ContactConstraint c : myBilaterals0.values()) {
    if (colA == myCollidable0) {
      accumulateImpulses(map,c.myCpnt0,c.getNormal(),c.getImpulse());
    }
 else {
      accumulateImpulses(map,c.myCpnt1,c.getNormal(),-c.getImpulse());
    }
  }
  for (  ContactConstraint c : myBilaterals1.values()) {
    if (colA == myCollidable0) {
      accumulateImpulses(map,c.myCpnt1,c.getNormal(),-c.getImpulse());
    }
 else {
      accumulateImpulses(map,c.myCpnt0,c.getNormal(),c.getImpulse());
    }
  }
  return map;
}
Program: 70970
Project: 70970
Buggy source:
private static URIx mergeExtension(URIx base,String extension){
  URIx merged=new URIx(base);
  if (merged.isZip()) {
    String fn=base.getFragment() + extension;
    merged.setFragment(fn);
  }
 else {
    String fn=base.getPath() + extension;
    merged.setPath(fn);
  }
  return merged;
}

Fixed version (ground truth):
private static URIx mergeExtension(URIx base,String extension){
  URIx merged=new URIx(base);
  if (merged.isZip()) {
    String fn=base.getFragment() + extension;
    merged.setFragment(fn);
  }
 else {
    String fn=base.getPath(false) + extension;
    merged.setPath(fn);
  }
  return merged;
}
Program: 70971
Project: 70971
Buggy source:
public String getPath(boolean encoded){
  if (encoded) {
    return percentEncode(path,PATH_RESERVED);
  }
  return percentDecode(path);
}

Fixed version (ground truth):
public String getPath(boolean encoded){
  if (encoded) {
    return percentEncode(path,PATH_RESERVED);
  }
  return path;
}
Program: 70972
Project: 70972
Buggy source:
public String getUserName(boolean encoded){
  if (encoded) {
    return percentEncode(userName,STANDARD_RESERVED);
  }
  return percentDecode(userName);
}

Fixed version (ground truth):
public String getUserName(boolean encoded){
  if (encoded) {
    return percentEncode(userName,STANDARD_RESERVED);
  }
  return userName;
}
Program: 70973
Project: 70973
Buggy source:
public String getHost(boolean encoded){
  if (encoded) {
    return percentEncode(host,STANDARD_RESERVED);
  }
  return percentDecode(host);
}

Fixed version (ground truth):
public String getHost(boolean encoded){
  if (encoded) {
    return percentEncode(host,STANDARD_RESERVED);
  }
  return host;
}
Program: 70974
Project: 70974
Buggy source:
public String getQuery(boolean encoded){
  if (encoded) {
    return percentEncode(query,QUERY_RESERVED);
  }
  return percentDecode(query);
}

Fixed version (ground truth):
public String getQuery(boolean encoded){
  if (encoded) {
    return percentEncode(query,QUERY_RESERVED);
  }
  return query;
}
Program: 70975
Project: 70975
Buggy source:
public String getFragment(boolean encoded){
  if (encoded) {
    if (isZip()) {
      return fragment;
    }
    return percentEncode(fragment,FRAGMENT_RESERVED);
  }
  return percentDecode(fragment);
}

Fixed version (ground truth):
public String getFragment(boolean encoded){
  if (encoded) {
    if (isZip()) {
      return fragment;
    }
    return percentEncode(fragment,FRAGMENT_RESERVED);
  }
  return fragment;
}
Program: 70976
Project: 70976
Buggy source:
public String getPassword(boolean encoded){
  if (encoded) {
    return percentEncode(password,PASSWORD_RESERVED);
  }
  return percentDecode(password);
}

Fixed version (ground truth):
public String getPassword(boolean encoded){
  if (encoded) {
    return percentEncode(password,PASSWORD_RESERVED);
  }
  return password;
}
Program: 70977
Project: 70977
Buggy source:
protected void recomputeWorldBounds(){
  Point3d pnt=new Point3d();
  Point3d pmin=myWorldMinCoords;
  Point3d pmax=myWorldMaxCoords;
  if (myVertices.size() == 0) {
    pmin.set(0,0,0);
    pmax.set(0,0,0);
  }
 else {
    double inf=Double.POSITIVE_INFINITY;
    pmin.set(inf,inf,inf);
    pmax.set(-inf,-inf,-inf);
  }
  for (  Vertex3d vertex : myVertices) {
    if (!myXMeshToWorldIsIdentity) {
      pnt.transform(XMeshToWorld,vertex.pnt);
    }
 else {
      pnt.set(vertex.pnt);
    }
    if (pnt.x > pmax.x) {
      pmax.x=pnt.x;
    }
 else     if (pnt.x < pmin.x) {
      pmin.x=pnt.x;
    }
    if (pnt.y > pmax.y) {
      pmax.y=pnt.y;
    }
 else     if (pnt.y < pmin.y) {
      pmin.y=pnt.y;
    }
    if (pnt.z > pmax.z) {
      pmax.z=pnt.z;
    }
 else     if (pnt.z < pmin.z) {
      pmin.z=pnt.z;
    }
  }
  myWorldBoundsValid=true;
}

Fixed version (ground truth):
protected void recomputeWorldBounds(){
  Point3d pnt=new Point3d();
  Point3d pmin=myWorldMinCoords;
  Point3d pmax=myWorldMaxCoords;
  if (myVertices.size() == 0) {
    pmin.set(0,0,0);
    pmax.set(0,0,0);
  }
 else {
    pmin.set(inf,inf,inf);
    pmax.set(-inf,-inf,-inf);
  }
  for (  Vertex3d vertex : myVertices) {
    if (!myXMeshToWorldIsIdentity) {
      pnt.transform(XMeshToWorld,vertex.pnt);
    }
 else {
      pnt.set(vertex.pnt);
    }
    if (pnt.x > pmax.x) {
      pmax.x=pnt.x;
    }
    if (pnt.x < pmin.x) {
      pmin.x=pnt.x;
    }
    if (pnt.y > pmax.y) {
      pmax.y=pnt.y;
    }
    if (pnt.y < pmin.y) {
      pmin.y=pnt.y;
    }
    if (pnt.z > pmax.z) {
      pmax.z=pnt.z;
    }
    if (pnt.z < pmin.z) {
      pmin.z=pnt.z;
    }
  }
  myWorldBoundsValid=true;
}
Program: 70978
Project: 70978
Buggy source:
protected void recomputeLocalBounds(){
  Point3d pmin=myLocalMinCoords;
  Point3d pmax=myLocalMaxCoords;
  if (myVertices.size() == 0) {
    pmin.set(0,0,0);
    pmax.set(0,0,0);
  }
 else {
    double inf=Double.POSITIVE_INFINITY;
    pmin.set(inf,inf,inf);
    pmax.set(-inf,-inf,-inf);
  }
  for (  Vertex3d vertex : myVertices) {
    Point3d pnt=vertex.pnt;
    if (pnt.x > pmax.x) {
      pmax.x=pnt.x;
    }
 else     if (pnt.x < pmin.x) {
      pmin.x=pnt.x;
    }
    if (pnt.y > pmax.y) {
      pmax.y=pnt.y;
    }
 else     if (pnt.y < pmin.y) {
      pmin.y=pnt.y;
    }
    if (pnt.z > pmax.z) {
      pmax.z=pnt.z;
    }
 else     if (pnt.z < pmin.z) {
      pmin.z=pnt.z;
    }
  }
  myLocalBoundsValid=true;
}

Fixed version (ground truth):
protected void recomputeLocalBounds(){
  Point3d pmin=myLocalMinCoords;
  Point3d pmax=myLocalMaxCoords;
  if (myVertices.size() == 0) {
    pmin.set(0,0,0);
    pmax.set(0,0,0);
  }
 else {
    double inf=Double.POSITIVE_INFINITY;
    pmin.set(inf,inf,inf);
    pmax.set(-inf,-inf,-inf);
  }
  for (  Vertex3d vertex : myVertices) {
    Point3d pnt=vertex.pnt;
    if (pnt.x > pmax.x) {
      pmax.x=pnt.x;
    }
    if (pnt.x < pmin.x) {
      pmin.x=pnt.x;
    }
    if (pnt.y > pmax.y) {
      pmax.y=pnt.y;
    }
    if (pnt.y < pmin.y) {
      pmin.y=pnt.y;
    }
    if (pnt.z > pmax.z) {
      pmax.z=pnt.z;
    }
    if (pnt.z < pmin.z) {
      pmin.z=pnt.z;
    }
  }
  myLocalBoundsValid=true;
}