nus-yam/ex-repair huggingface dataset:
Program: 109252
Project: 109252
Buggy source:
/** 
 * Returns a boolean attribute of the element. If the <b>defaultValue</b> parameter is used and the attribute doesn't exist, the <b>defaultValue</b> is returned. When using the version of the method without the <b>defaultValue</b> parameter, if the attribute doesn't exist, the value false is returned.
 * @param name the name of the attribute
 * @param defaultValue value returned if the attribute is not found
 * @webref
 * @brief Returns a boolean attribute of the element.
 * @return the value, or defaultValue if the attribute does not exist.
 */
public boolean getBoolean(String name,boolean defaultValue){
  String value=getString(name);
  return (value != null) && (value.equals("String_Node_Str") || value.toLowerCase().equals("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * Returns a boolean attribute of the element. If the <b>defaultValue</b> parameter is used and the attribute doesn't exist, the <b>defaultValue</b> is returned. When using the version of the method without the <b>defaultValue</b> parameter, if the attribute doesn't exist, the value false is returned.
 * @param name the name of the attribute
 * @param defaultValue value returned if the attribute is not found
 * @webref
 * @brief Returns a boolean attribute of the element.
 * @return the value, or defaultValue if the attribute does not exist.
 */
public boolean getBoolean(String name,boolean defaultValue){
  String value=getString(name);
  if (value == null) {
    return defaultValue;
  }
  return (value.equals("String_Node_Str") || value.toLowerCase().equals("String_Node_Str"));
}
Program: 109253
Project: 109253
Buggy source:
/** 
 * Returns the name of the element without its namespace. 
 * @return the name, or null if the element only contains #PCDATA.
 */
public String getLocalName(){
  return this.name;
}

Fixed version (ground truth):
/** 
 * Returns the name of the element without its namespace.
 * @return the name, or null if the element only contains #PCDATA.
 */
public String getLocalName(){
  return this.name;
}
Program: 109254
Project: 109254
Buggy source:
/** 
 * Put the names of all children into an array. Same as looping through  each child and calling getName() on each XMLElement.
 */
public String[] listChildren(){
  int childCount=getChildCount();
  String[] outgoing=new String[childCount];
  for (int i=0; i < childCount; i++) {
    outgoing[i]=getChild(i).getName();
  }
  return outgoing;
}

Fixed version (ground truth):
/** 
 * Put the names of all children into an array. Same as looping through each child and calling getName() on each XMLElement.
 */
public String[] listChildren(){
  int childCount=getChildCount();
  String[] outgoing=new String[childCount];
  for (int i=0; i < childCount; i++) {
    outgoing[i]=getChild(i).getName();
  }
  return outgoing;
}
Program: 109256
Project: 109256
Buggy source:
/** 
 * Implementation of actual drawing for a line of text.
 */
protected void textLineImpl(char buffer[],int start,int stop,float x,float y){
  if (gl11 == null || gl11x == null) {
    throw new RuntimeException("String_Node_Str");
  }
  gl.glEnable(GL10.GL_TEXTURE_2D);
  if (!blend || blendMode != BLEND) {
    gl.glEnable(GL10.GL_BLEND);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA,GL10.GL_ONE_MINUS_SRC_ALPHA);
  }
  if (textFont.texIDList == null) {
    textFont.initTexture(gl,maxTextureSize,maxTextureSize);
    textFont.addAllGlyphsToTexture(gl);
  }
  gl.glEnable(GL10.GL_TEXTURE_2D);
  textFont.currentTexID=textFont.texIDList[0];
  gl.glBindTexture(GL10.GL_TEXTURE_2D,textFont.currentTexID);
  gl.glColor4f(colorFloats[0],colorFloats[1],colorFloats[2],colorFloats[3]);
  if (textMode == MODEL) {
    if (textVertexBuffer == null) {
      allocateTextModel();
    }
    gl.glNormal3f(0,0,1);
    textVertexCount=0;
  }
  super.textLineImpl(buffer,start,stop,x,y);
  if (textMode == MODEL && 0 < textVertexCount) {
    renderTextModel();
  }
  if (blend) {
    blend(blendMode);
  }
 else {
    noBlend();
  }
  gl.glDisable(GL10.GL_TEXTURE_2D);
}

Fixed version (ground truth):
/** 
 * Implementation of actual drawing for a line of text.
 */
protected void textLineImpl(char buffer[],int start,int stop,float x,float y){
  if (gl11 == null || gl11x == null) {
    throw new RuntimeException("String_Node_Str");
  }
  gl.glEnable(GL10.GL_TEXTURE_2D);
  if (!blend || blendMode != BLEND) {
    gl.glEnable(GL10.GL_BLEND);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA,GL10.GL_ONE_MINUS_SRC_ALPHA);
  }
  if (textFont.texIDList == null) {
    textFont.initTexture(gl,maxTextureSize,maxTextureSize);
    textFont.addAllGlyphsToTexture(gl);
  }
  gl.glEnable(GL10.GL_TEXTURE_2D);
  textFont.currentTexID=textFont.texIDList[0];
  gl.glBindTexture(GL10.GL_TEXTURE_2D,textFont.currentTexID);
  gl.glColor4f(fillR,fillG,fillB,fillA);
  if (textMode == MODEL) {
    if (textVertexBuffer == null) {
      allocateTextModel();
    }
    gl.glNormal3f(0,0,1);
    textVertexCount=0;
  }
  super.textLineImpl(buffer,start,stop,x,y);
  if (textMode == MODEL && 0 < textVertexCount) {
    renderTextModel();
  }
  if (blend) {
    blend(blendMode);
  }
 else {
    noBlend();
  }
  gl.glDisable(GL10.GL_TEXTURE_2D);
}
Program: 109258
Project: 109258
Buggy source:
/** 
 * Disables lighting.
 */
public void noLights(){
  lights=false;
  gl.glDisable(GL10.GL_LIGHTING);
  lightCount=0;
}

Fixed version (ground truth):
/** 
 * Disables lighting.
 */
public void noLights(){
  disableLights();
  lightCount=0;
}
Program: 109259
Project: 109259
Buggy source:
public void pointLight(float r,float g,float b,float x,float y,float z){
  if (lightCount == MAX_LIGHTS) {
    throw new RuntimeException("String_Node_Str" + MAX_LIGHTS + "String_Node_Str");
  }
  colorCalc(r,g,b);
  lightDiffuse[lightCount][0]=calcR;
  lightDiffuse[lightCount][1]=calcG;
  lightDiffuse[lightCount][2]=calcB;
  lightDiffuse[lightCount][3]=1.0f;
  lightType[lightCount]=POINT;
  lightFalloffConstant[lightCount]=currentLightFalloffConstant;
  lightFalloffLinear[lightCount]=currentLightFalloffLinear;
  lightFalloffQuadratic[lightCount]=currentLightFalloffQuadratic;
  lightSpecular[lightCount][0]=currentLightSpecular[0];
  lightSpecular[lightCount][1]=currentLightSpecular[1];
  lightSpecular[lightCount][2]=currentLightSpecular[2];
  lightPosition[lightCount][0]=x;
  lightPosition[lightCount][1]=y;
  lightPosition[lightCount][2]=z;
  lightPosition[lightCount][3]=1.0f;
  glLightEnable(lightCount);
  glLightNoAmbient(lightCount);
  glLightPosition(lightCount);
  glLightDiffuse(lightCount);
  glLightSpecular(lightCount);
  glLightFalloff(lightCount);
  glLightNoSpot(lightCount);
  lightCount++;
}

Fixed version (ground truth):
public void pointLight(float r,float g,float b,float x,float y,float z){
  if (!lights) {
    enableLights();
  }
  if (lightCount == MAX_LIGHTS) {
    throw new RuntimeException("String_Node_Str" + MAX_LIGHTS + "String_Node_Str");
  }
  colorCalc(r,g,b);
  lightDiffuse[lightCount][0]=calcR;
  lightDiffuse[lightCount][1]=calcG;
  lightDiffuse[lightCount][2]=calcB;
  lightDiffuse[lightCount][3]=1.0f;
  lightType[lightCount]=POINT;
  lightFalloffConstant[lightCount]=currentLightFalloffConstant;
  lightFalloffLinear[lightCount]=currentLightFalloffLinear;
  lightFalloffQuadratic[lightCount]=currentLightFalloffQuadratic;
  lightSpecular[lightCount][0]=currentLightSpecular[0];
  lightSpecular[lightCount][1]=currentLightSpecular[1];
  lightSpecular[lightCount][2]=currentLightSpecular[2];
  lightPosition[lightCount][0]=x;
  lightPosition[lightCount][1]=y;
  lightPosition[lightCount][2]=z;
  lightPosition[lightCount][3]=1.0f;
  glLightEnable(lightCount);
  glLightNoAmbient(lightCount);
  glLightPosition(lightCount);
  glLightDiffuse(lightCount);
  glLightSpecular(lightCount);
  glLightFalloff(lightCount);
  glLightNoSpot(lightCount);
  lightCount++;
}
Program: 109262
Project: 109262
Buggy source:
public void directionalLight(float r,float g,float b,float nx,float ny,float nz){
  if (lightCount == MAX_LIGHTS) {
    throw new RuntimeException("String_Node_Str" + MAX_LIGHTS + "String_Node_Str");
  }
  colorCalc(r,g,b);
  lightDiffuse[lightCount][0]=calcR;
  lightDiffuse[lightCount][1]=calcG;
  lightDiffuse[lightCount][2]=calcB;
  lightDiffuse[lightCount][3]=1.0f;
  lightType[lightCount]=DIRECTIONAL;
  lightFalloffConstant[lightCount]=currentLightFalloffConstant;
  lightFalloffLinear[lightCount]=currentLightFalloffLinear;
  lightFalloffQuadratic[lightCount]=currentLightFalloffQuadratic;
  lightSpecular[lightCount][0]=currentLightSpecular[0];
  lightSpecular[lightCount][1]=currentLightSpecular[1];
  lightSpecular[lightCount][2]=currentLightSpecular[2];
  lightSpecular[lightCount][2]=currentLightSpecular[3];
  float invn=1.0f / PApplet.dist(0,0,0,nx,ny,nz);
  lightNormal[lightCount][0]=invn * nx;
  lightNormal[lightCount][1]=invn * ny;
  lightNormal[lightCount][2]=invn * nz;
  lightNormal[lightCount][3]=0.0f;
  glLightEnable(lightCount);
  glLightNoAmbient(lightCount);
  glLightDirection(lightCount);
  glLightDiffuse(lightCount);
  glLightSpecular(lightCount);
  glLightFalloff(lightCount);
  glLightNoSpot(lightCount);
  lightCount++;
}

Fixed version (ground truth):
public void directionalLight(float r,float g,float b,float nx,float ny,float nz){
  if (!lights) {
    enableLights();
  }
  if (lightCount == MAX_LIGHTS) {
    throw new RuntimeException("String_Node_Str" + MAX_LIGHTS + "String_Node_Str");
  }
  colorCalc(r,g,b);
  lightDiffuse[lightCount][0]=calcR;
  lightDiffuse[lightCount][1]=calcG;
  lightDiffuse[lightCount][2]=calcB;
  lightDiffuse[lightCount][3]=1.0f;
  lightType[lightCount]=DIRECTIONAL;
  lightFalloffConstant[lightCount]=currentLightFalloffConstant;
  lightFalloffLinear[lightCount]=currentLightFalloffLinear;
  lightFalloffQuadratic[lightCount]=currentLightFalloffQuadratic;
  lightSpecular[lightCount][0]=currentLightSpecular[0];
  lightSpecular[lightCount][1]=currentLightSpecular[1];
  lightSpecular[lightCount][2]=currentLightSpecular[2];
  lightSpecular[lightCount][2]=currentLightSpecular[3];
  float invn=1.0f / PApplet.dist(0,0,0,nx,ny,nz);
  lightNormal[lightCount][0]=invn * nx;
  lightNormal[lightCount][1]=invn * ny;
  lightNormal[lightCount][2]=invn * nz;
  lightNormal[lightCount][3]=0.0f;
  glLightEnable(lightCount);
  glLightNoAmbient(lightCount);
  glLightDirection(lightCount);
  glLightDiffuse(lightCount);
  glLightSpecular(lightCount);
  glLightFalloff(lightCount);
  glLightNoSpot(lightCount);
  lightCount++;
}
Program: 109263
Project: 109263
Buggy source:
/** 
 * Add an ambient light based on the current color mode. This version includes an (x, y, z) position for situations where the falloff distance is used.
 */
public void ambientLight(float r,float g,float b,float x,float y,float z){
  if (lightCount == MAX_LIGHTS) {
    throw new RuntimeException("String_Node_Str" + MAX_LIGHTS + "String_Node_Str");
  }
  colorCalc(r,g,b);
  lightDiffuse[lightCount][0]=calcR;
  lightDiffuse[lightCount][1]=calcG;
  lightDiffuse[lightCount][2]=calcB;
  lightDiffuse[lightCount][3]=1.0f;
  lightType[lightCount]=AMBIENT;
  lightFalloffConstant[lightCount]=currentLightFalloffConstant;
  lightFalloffLinear[lightCount]=currentLightFalloffLinear;
  lightFalloffQuadratic[lightCount]=currentLightFalloffQuadratic;
  lightPosition[lightCount][0]=x;
  lightPosition[lightCount][1]=y;
  lightPosition[lightCount][2]=z;
  lightPosition[lightCount][3]=1.0f;
  glLightEnable(lightCount);
  glLightAmbient(lightCount);
  glLightPosition(lightCount);
  glLightFalloff(lightCount);
  glLightNoSpot(lightCount);
  lightCount++;
}

Fixed version (ground truth):
/** 
 * Add an ambient light based on the current color mode. This version includes an (x, y, z) position for situations where the falloff distance is used.
 */
public void ambientLight(float r,float g,float b,float x,float y,float z){
  if (!lights) {
    enableLights();
  }
  if (lightCount == MAX_LIGHTS) {
    throw new RuntimeException("String_Node_Str" + MAX_LIGHTS + "String_Node_Str");
  }
  colorCalc(r,g,b);
  lightDiffuse[lightCount][0]=calcR;
  lightDiffuse[lightCount][1]=calcG;
  lightDiffuse[lightCount][2]=calcB;
  lightDiffuse[lightCount][3]=1.0f;
  lightType[lightCount]=AMBIENT;
  lightFalloffConstant[lightCount]=currentLightFalloffConstant;
  lightFalloffLinear[lightCount]=currentLightFalloffLinear;
  lightFalloffQuadratic[lightCount]=currentLightFalloffQuadratic;
  lightPosition[lightCount][0]=x;
  lightPosition[lightCount][1]=y;
  lightPosition[lightCount][2]=z;
  lightPosition[lightCount][3]=1.0f;
  glLightEnable(lightCount);
  glLightAmbient(lightCount);
  glLightPosition(lightCount);
  glLightFalloff(lightCount);
  glLightNoSpot(lightCount);
  glLightNoDiffuse(lightCount);
  glLightNoSpecular(lightCount);
  lightCount++;
}
Program: 109264
Project: 109264
Buggy source:
protected void vertexCheck(){
  if (vertexCount == vertices.length) {
    float temp[][]=new float[vertexCount << 1][VERTEX_FIELD_COUNT];
    System.arraycopy(vertices,0,temp,0,vertexCount);
    vertices=temp;
  }
}

Fixed version (ground truth):
protected void vertexCheck(){
  if (vertexCount == vertices.length) {
    float temp[][]=new float[vertexCount << 1][VERTEX_FIELD_COUNT];
    System.arraycopy(vertices,0,temp,0,vertexCount);
    vertices=temp;
    PImage texTmp[]=new PImage[vertexCount << 1];
    System.arraycopy(verticesTexture,0,texTmp,0,vertexCount);
    verticesTexture=texTmp;
  }
}
Program: 109265
Project: 109265
Buggy source:
protected void addNewFace(boolean firstFace){
  if (faceCount == faceOffset.length) {
    faceOffset=PApplet.expand(faceOffset);
    faceLength=PApplet.expand(faceLength);
    faceTexture=PApplet.expand(faceTexture);
  }
  faceOffset[faceCount]=firstFace ? 0 : triangleCount;
  faceLength[faceCount]=1;
  faceTexture[faceCount]=textureImage;
  faceCount++;
}

Fixed version (ground truth):
protected void addNewFace(boolean firstFace,PImage tex){
  if (faceCount == faceOffset.length) {
    faceOffset=PApplet.expand(faceOffset);
    faceLength=PApplet.expand(faceLength);
    faceTexture=PApplet.expand(faceTexture);
  }
  faceOffset[faceCount]=firstFace ? 0 : triangleCount;
  faceLength[faceCount]=1;
  faceTexture[faceCount]=tex;
  faceCount++;
}
Program: 109267
Project: 109267
Buggy source:
/** 
 * Add the triangle.
 */
protected void addTriangle(int a,int b,int c){
  if (triangleCount == triangles.length) {
    int temp[][]=new int[triangleCount << 1][TRIANGLE_FIELD_COUNT];
    System.arraycopy(triangles,0,temp,0,triangleCount);
    triangles=temp;
  }
  triangles[triangleCount][VERTEX1]=a;
  triangles[triangleCount][VERTEX2]=b;
  triangles[triangleCount][VERTEX3]=c;
  triangleCount++;
  boolean firstFace=triangleCount == 1;
  if (textureImage != textureImagePrev || firstFace) {
    addNewFace(firstFace);
  }
 else {
    faceLength[faceCount - 1]++;
  }
  textureImagePrev=textureImage;
}

Fixed version (ground truth):
/** 
 * Add the triangle.
 */
protected void addTriangle(int a,int b,int c){
  if (triangleCount == triangles.length) {
    int temp[][]=new int[triangleCount << 1][TRIANGLE_FIELD_COUNT];
    System.arraycopy(triangles,0,temp,0,triangleCount);
    triangles=temp;
  }
  triangles[triangleCount][VERTEX1]=a;
  triangles[triangleCount][VERTEX2]=b;
  triangles[triangleCount][VERTEX3]=c;
  PImage tex=verticesTexture[a];
  boolean firstFace=triangleCount == 0;
  if (tex != textureImagePrev || firstFace) {
    addNewFace(firstFace,tex);
  }
 else {
    faceLength[faceCount - 1]++;
  }
  triangleCount++;
  textureImagePrev=tex;
}
Program: 109268
Project: 109268
Buggy source:
public int addTexture(GL10 gl){
  int[] textures=new int[1];
  gl.glGenTextures(1,textures,0);
  gl.glBindTexture(GL10.GL_TEXTURE_2D,textures[0]);
  gl.glTexParameterf(GL10.GL_TEXTURE_2D,GL10.GL_TEXTURE_MIN_FILTER,GL10.GL_NEAREST);
  gl.glTexParameterf(GL10.GL_TEXTURE_2D,GL10.GL_TEXTURE_MAG_FILTER,GL10.GL_NEAREST);
  gl.glTexParameterf(GL10.GL_TEXTURE_2D,GL10.GL_TEXTURE_WRAP_S,GL10.GL_CLAMP_TO_EDGE);
  gl.glTexParameterf(GL10.GL_TEXTURE_2D,GL10.GL_TEXTURE_WRAP_T,GL10.GL_CLAMP_TO_EDGE);
  gl.glTexImage2D(GL10.GL_TEXTURE_2D,0,GL10.GL_RGBA,texWidth,texHeight,0,GL10.GL_RGBA,GL10.GL_UNSIGNED_BYTE,null);
  gl.glBindTexture(GL10.GL_TEXTURE_2D,0);
  currentTexID=-1;
  if (texIDList == null) {
    texIDList=new int[1];
    texIDList[0]=textures[0];
  }
 else {
    int[] tmp=texIDList;
    texIDList=new int[texIDList.length + 1];
    PApplet.arrayCopy(tmp,texIDList,tmp.length);
    texIDList[tmp.length]=textures[0];
  }
  return textures[0];
}

Fixed version (ground truth):
public int addTexture(GL10 gl){
  int[] textures=new int[1];
  gl.glGenTextures(1,textures,0);
  gl.glBindTexture(GL10.GL_TEXTURE_2D,textures[0]);
  gl.glTexParameterf(GL10.GL_TEXTURE_2D,GL10.GL_TEXTURE_MIN_FILTER,GL10.GL_NEAREST);
  gl.glTexParameterf(GL10.GL_TEXTURE_2D,GL10.GL_TEXTURE_MAG_FILTER,GL10.GL_NEAREST);
  gl.glTexParameterf(GL10.GL_TEXTURE_2D,GL10.GL_TEXTURE_WRAP_S,GL10.GL_CLAMP_TO_EDGE);
  gl.glTexParameterf(GL10.GL_TEXTURE_2D,GL10.GL_TEXTURE_WRAP_T,GL10.GL_CLAMP_TO_EDGE);
  gl.glTexImage2D(GL10.GL_TEXTURE_2D,0,GL10.GL_RGBA,texWidth,texHeight,0,GL10.GL_RGBA,GL10.GL_UNSIGNED_BYTE,null);
  if (texIDList == null) {
    texIDList=new int[1];
    texIDList[0]=textures[0];
  }
 else {
    int[] tmp=texIDList;
    texIDList=new int[texIDList.length + 1];
    PApplet.arrayCopy(tmp,texIDList,tmp.length);
    texIDList[tmp.length]=textures[0];
  }
  currentTexID=textures[0];
  return currentTexID;
}
Program: 109269
Project: 109269
Buggy source:
protected void addToTexture(GL10 gl){
  int[] rgba=new int[width * height];
  int t=0;
  int p=0;
  if (PGraphicsAndroid3D.BIG_ENDIAN) {
    for (int y=0; y < height; y++) {
      for (int x=0; x < width; x++) {
        rgba[t++]=(image.pixels[p++] << 24) | 0xFFFFFFFF;
      }
    }
  }
 else {
    for (int y=0; y < height; y++) {
      for (int x=0; x < width; x++) {
        rgba[t++]=(image.pixels[p++] << 24) | 0xFFFFFFFF;
      }
    }
  }
  if (offsetX + width > texWidth) {
    offsetX=0;
    offsetY+=lineHeight;
    lineHeight=0;
  }
  lineHeight=Math.max(lineHeight,height);
  if (offsetY + lineHeight > texHeight) {
    lastTexID=addTexture(gl);
    offsetX=0;
    offsetY=0;
    lineHeight=0;
  }
  if (lastTexID == -1) {
    lastTexID=texIDList[0];
  }
  if (currentTexID != lastTexID) {
    gl.glBindTexture(GL10.GL_TEXTURE_2D,lastTexID);
    currentTexID=lastTexID;
  }
  gl.glTexSubImage2D(GL10.GL_TEXTURE_2D,0,offsetX,offsetY,width,height,GL10.GL_RGBA,GL10.GL_UNSIGNED_BYTE,IntBuffer.wrap(rgba));
  texture=new TextureInfo(currentTexID,offsetX,offsetY + height,width,-height);
  offsetX+=width;
}

Fixed version (ground truth):
protected void addToTexture(GL10 gl){
  int[] rgba=new int[width * height];
  int t=0;
  int p=0;
  if (PGraphicsAndroid3D.BIG_ENDIAN) {
    for (int y=0; y < height; y++) {
      for (int x=0; x < width; x++) {
        rgba[t++]=0xFFFFFF00 | image.pixels[p++];
      }
    }
  }
 else {
    for (int y=0; y < height; y++) {
      for (int x=0; x < width; x++) {
        rgba[t++]=(image.pixels[p++] << 24) | 0x00FFFFFF;
      }
    }
  }
  if (offsetX + width > texWidth) {
    offsetX=0;
    offsetY+=lineHeight;
    lineHeight=0;
  }
  lineHeight=Math.max(lineHeight,height);
  if (offsetY + lineHeight > texHeight) {
    lastTexID=addTexture(gl);
    offsetX=0;
    offsetY=0;
    lineHeight=0;
  }
  if (lastTexID == -1) {
    lastTexID=texIDList[0];
  }
  if (currentTexID != lastTexID) {
    gl.glBindTexture(GL10.GL_TEXTURE_2D,lastTexID);
    currentTexID=lastTexID;
  }
  gl.glTexSubImage2D(GL10.GL_TEXTURE_2D,0,offsetX,offsetY,width,height,GL10.GL_RGBA,GL10.GL_UNSIGNED_BYTE,IntBuffer.wrap(rgba));
  texture=new TextureInfo(currentTexID,offsetX,offsetY + height,width,-height);
  offsetX+=width;
}
Program: 109270
Project: 109270
Buggy source:
public TextureInfo(int glid,int cropX,int cropY,int cropW,int cropH){
  this.glid=glid;
  crop=new int[4];
  crop[0]=cropX;
  crop[1]=cropY;
  crop[2]=cropW;
  crop[3]=cropH;
}

Fixed version (ground truth):
public TextureInfo(int glid,int cropX,int cropY,int cropW,int cropH){
  this.glid=glid;
  crop=new int[4];
  crop[0]=cropX;
  crop[1]=cropY;
  crop[2]=cropW;
  crop[3]=cropH;
  u0=(float)cropX / (float)texWidth;
  u1=u0 + (float)cropW / (float)texWidth;
  v0=(float)(cropY + cropH) / (float)texHeight;
  v1=(float)cropY / (float)texHeight;
}
Program: 109272
Project: 109272
Buggy source:
protected void textCharModelImpl(Glyph.TextureInfo tex,float x1,float y1,float x2,float y2){
  if (textFont.currentTexID != tex.glid) {
    gl.glBindTexture(GL10.GL_TEXTURE_2D,tex.glid);
    textFont.currentTexID=tex.glid;
  }
  gl11.glTexParameteriv(GL10.GL_TEXTURE_2D,GL11Ext.GL_TEXTURE_CROP_RECT_OES,tex.crop,0);
  gl11x.glDrawTexfOES(x1,height - y2,0,x2 - x1,y2 - y1);
}

Fixed version (ground truth):
protected void textCharModelImpl(Glyph.TextureInfo tex,float x1,float y1,float x2,float y2){
  if (textFont.currentTexID != tex.glid) {
    if (0 < textVertexCount) {
      renderTextModel();
      textVertexCount=0;
    }
    gl.glBindTexture(GL10.GL_TEXTURE_2D,tex.glid);
    textFont.currentTexID=tex.glid;
  }
  if (textVertexBuffer.capacity() < textVertexCount + 6) {
    expandTextBuffers();
  }
  int n=textVertexCount;
  textVertexArray[3 * n + 0]=toFixed32(x1);
  textVertexArray[3 * n + 1]=toFixed32(y1);
  textVertexArray[3 * n + 2]=toFixed32(0);
  textTexCoordArray[2 * n + 0]=toFixed32(tex.u0);
  textTexCoordArray[2 * n + 1]=toFixed32(tex.v0);
  n++;
  textVertexArray[3 * n + 0]=toFixed32(x2);
  textVertexArray[3 * n + 1]=toFixed32(y2);
  textVertexArray[3 * n + 2]=toFixed32(0);
  textTexCoordArray[2 * n + 0]=toFixed32(tex.u1);
  textTexCoordArray[2 * n + 1]=toFixed32(tex.v1);
  n++;
  textVertexArray[3 * n + 0]=toFixed32(x1);
  textVertexArray[3 * n + 1]=toFixed32(y2);
  textVertexArray[3 * n + 2]=toFixed32(0);
  textTexCoordArray[2 * n + 0]=toFixed32(tex.u0);
  textTexCoordArray[2 * n + 1]=toFixed32(tex.v1);
  n++;
  textVertexArray[3 * n + 0]=toFixed32(x1);
  textVertexArray[3 * n + 1]=toFixed32(y1);
  textVertexArray[3 * n + 2]=toFixed32(0);
  textTexCoordArray[2 * n + 0]=toFixed32(tex.u0);
  textTexCoordArray[2 * n + 1]=toFixed32(tex.v0);
  n++;
  textVertexArray[3 * n + 0]=toFixed32(x2);
  textVertexArray[3 * n + 1]=toFixed32(y1);
  textVertexArray[3 * n + 2]=toFixed32(0);
  textTexCoordArray[2 * n + 0]=toFixed32(tex.u1);
  textTexCoordArray[2 * n + 1]=toFixed32(tex.v0);
  n++;
  textVertexArray[3 * n + 0]=toFixed32(x2);
  textVertexArray[3 * n + 1]=toFixed32(y2);
  textVertexArray[3 * n + 2]=toFixed32(0);
  textTexCoordArray[2 * n + 0]=toFixed32(tex.u1);
  textTexCoordArray[2 * n + 1]=toFixed32(tex.v1);
  n++;
  textVertexCount=n;
}
Program: 109273
Project: 109273
Buggy source:
/** 
 * Implementation of actual drawing for a line of text.
 */
protected void textLineImpl(char buffer[],int start,int stop,float x,float y){
  if (gl11 == null || gl11x == null) {
    throw new RuntimeException("String_Node_Str");
  }
  gl.glEnable(GL10.GL_TEXTURE_2D);
  if (!blend || blendMode != BLEND) {
    gl.glEnable(GL10.GL_BLEND);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA,GL10.GL_ONE_MINUS_SRC_ALPHA);
  }
  if (textFont.texIDList == null) {
    textFont.initTexture(gl,maxTextureSize,maxTextureSize);
    textFont.addAllGlyphsToTexture(gl);
  }
  gl.glEnable(GL10.GL_TEXTURE_2D);
  textFont.currentTexID=textFont.texIDList[0];
  gl.glBindTexture(GL10.GL_TEXTURE_2D,textFont.currentTexID);
  gl.glColor4f(colorFloats[0],colorFloats[1],colorFloats[2],colorFloats[3]);
  super.textLineImpl(buffer,start,stop,x,y);
  if (blend) {
    blend(blendMode);
  }
 else {
    noBlend();
  }
  gl.glDisable(GL10.GL_TEXTURE_2D);
}

Fixed version (ground truth):
/** 
 * Implementation of actual drawing for a line of text.
 */
protected void textLineImpl(char buffer[],int start,int stop,float x,float y){
  if (gl11 == null || gl11x == null) {
    throw new RuntimeException("String_Node_Str");
  }
  gl.glEnable(GL10.GL_TEXTURE_2D);
  if (!blend || blendMode != BLEND) {
    gl.glEnable(GL10.GL_BLEND);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA,GL10.GL_ONE_MINUS_SRC_ALPHA);
  }
  if (textFont.texIDList == null) {
    textFont.initTexture(gl,maxTextureSize,maxTextureSize);
    textFont.addAllGlyphsToTexture(gl);
  }
  gl.glEnable(GL10.GL_TEXTURE_2D);
  textFont.currentTexID=textFont.texIDList[0];
  gl.glBindTexture(GL10.GL_TEXTURE_2D,textFont.currentTexID);
  gl.glColor4f(colorFloats[0],colorFloats[1],colorFloats[2],colorFloats[3]);
  if (textMode == MODEL) {
    if (textVertexBuffer == null) {
      allocateTextModel();
    }
    gl.glNormal3f(0,0,1);
    textVertexCount=0;
  }
  super.textLineImpl(buffer,start,stop,x,y);
  if (textMode == MODEL && 0 < textVertexCount) {
    renderTextModel();
  }
  if (blend) {
    blend(blendMode);
  }
 else {
    noBlend();
  }
  gl.glDisable(GL10.GL_TEXTURE_2D);
}
Program: 109274
Project: 109274
Buggy source:
protected PImage getImpl(int x,int y,int w,int h){
  PImage newbie=new PImage(w,h);
  IntBuffer newbieBuffer=IntBuffer.allocate(w * h);
  gl.glReadPixels(x,y,w,h,GL10.GL_RGBA,GL10.GL_UNSIGNED_BYTE,newbieBuffer);
  newbieBuffer.get(newbie.pixels);
  nativeToJavaARGB(newbie);
  return newbie;
}

Fixed version (ground truth):
protected PImage getImpl(int x,int y,int w,int h){
  PImage newbie=parent.createImage(w,h,ARGB);
  PTexture newbieTex=newbie.getTexture();
  IntBuffer newbieBuffer=IntBuffer.allocate(w * h);
  gl.glReadPixels(x,height - y,w,-h,GL10.GL_RGBA,GL10.GL_UNSIGNED_BYTE,newbieBuffer);
  copyToTexture(newbieTex,newbieBuffer,0,0,w,h);
  newbie.textureToPixels();
  return newbie;
}
Program: 109276
Project: 109276
Buggy source:
protected void drawTexture(PTexture tex,int[] crop,int x,int y,int w,int h){
  gl.glEnable(tex.getGLTarget());
  gl.glBindTexture(tex.getGLTarget(),tex.getGLTextureID());
  gl.glDepthMask(false);
  gl.glDisable(GL10.GL_BLEND);
  gl.glTexEnvf(GL10.GL_TEXTURE_ENV,GL10.GL_TEXTURE_ENV_MODE,GL10.GL_REPLACE);
  gl11.glTexParameteriv(GL10.GL_TEXTURE_2D,GL11Ext.GL_TEXTURE_CROP_RECT_OES,crop,0);
  gl11x.glDrawTexiOES(0,x,y,w,h);
  gl.glTexEnvf(GL10.GL_TEXTURE_ENV,GL10.GL_TEXTURE_ENV_MODE,GL10.GL_MODULATE);
  gl.glDisable(tex.getGLTarget());
  if (hints[DISABLE_DEPTH_MASK]) {
    gl.glDepthMask(false);
  }
 else {
    gl.glDepthMask(true);
  }
  if (blend) {
    blend(blendMode);
  }
 else {
    noBlend();
  }
}

Fixed version (ground truth):
protected void drawTexture(PTexture tex,int[] crop,int x,int y,int w,int h){
  gl.glEnable(tex.getGLTarget());
  gl.glBindTexture(tex.getGLTarget(),tex.getGLTextureID());
  gl.glDepthMask(false);
  gl.glDisable(GL10.GL_BLEND);
  gl.glTexEnvf(GL10.GL_TEXTURE_ENV,GL10.GL_TEXTURE_ENV_MODE,GL10.GL_REPLACE);
  gl11.glTexParameteriv(GL10.GL_TEXTURE_2D,GL11Ext.GL_TEXTURE_CROP_RECT_OES,crop,0);
  gl11x.glDrawTexiOES(x,y,0,w,h);
  gl.glTexEnvf(GL10.GL_TEXTURE_ENV,GL10.GL_TEXTURE_ENV_MODE,GL10.GL_MODULATE);
  gl.glDisable(tex.getGLTarget());
  if (hints[DISABLE_DEPTH_MASK]) {
    gl.glDepthMask(false);
  }
 else {
    gl.glDepthMask(true);
  }
  if (blend) {
    blend(blendMode);
  }
 else {
    noBlend();
  }
}
Program: 109277
Project: 109277
Buggy source:
protected void defaultSettings(){
  super.defaultSettings();
  manipulatingCamera=false;
  scalingDuringCamManip=false;
  if (usingModelviewStack) {
    modelviewStack=new A3DMatrixStack();
  }
  textureMode(IMAGE);
  if (!primarySurface) {
    PGraphicsAndroid3D a3d=(PGraphicsAndroid3D)parent.g;
    try {
      Method meth=this.getClass().getMethod("String_Node_Str",new Class[]{PGraphicsAndroid3D.class});
      recreateResourceIdx=a3d.addRecreateResourceMethod(this,meth);
    }
 catch (    Exception e) {
      recreateResourceIdx=-1;
    }
  }
}

Fixed version (ground truth):
protected void defaultSettings(){
  super.defaultSettings();
  manipulatingCamera=false;
  scalingDuringCamManip=false;
  clearColorBuffer=false;
  if (fbStack == null) {
    fbStack=new Stack<PFramebuffer>();
    screenFramebuffer=new PFramebuffer(parent,width,height,true);
    setFramebuffer(screenFramebuffer);
  }
  if (usingModelviewStack && modelviewStack == null) {
    modelviewStack=new A3DMatrixStack();
  }
  textureMode(IMAGE);
  if (!primarySurface) {
    PGraphicsAndroid3D a3d=(PGraphicsAndroid3D)parent.g;
    try {
      Method meth=this.getClass().getMethod("String_Node_Str",new Class[]{PGraphicsAndroid3D.class});
      recreateResourceIdx=a3d.addRecreateResourceMethod(this,meth);
    }
 catch (    Exception e) {
      recreateResourceIdx=-1;
    }
  }
}
Program: 109278
Project: 109278
Buggy source:
protected void backgroundImpl(){
  gl.glClearColor(backgroundR,backgroundG,backgroundB,1);
  gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
}

Fixed version (ground truth):
protected void backgroundImpl(){
  gl.glClearColor(backgroundR,backgroundG,backgroundB,1);
  gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
  if (0 < parent.frameCount) {
    clearColorBuffer=true;
  }
}
Program: 109280
Project: 109280
Buggy source:
public void endDraw(){
  if (!clear || !primarySurface) {
    if (fboSupported) {
      if (drawFramebuffer != null) {
        popFramebuffer();
        if (primarySurface) {
          gl.glClearColor(0,0,0,0);
          gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
          renderDrawTexture(drawIndex);
        }
        swapDrawIndex();
      }
    }
 else {
      if (screenTexID[0] != 0) {
        copyFrameToScreenTexture();
      }
    }
  }
  if (primarySurface) {
    gl.glFlush();
  }
 else {
    ((PGraphicsAndroid3D)parent.g).restoreGLState();
  }
  report("String_Node_Str");
}

Fixed version (ground truth):
public void endDraw(){
  if (primarySurface) {
    if (!clearColorBuffer0) {
      if (fboSupported) {
        if (drawFramebuffer != null) {
          popFramebuffer();
          gl.glClearColor(0,0,0,0);
          gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
          renderDrawTexture(drawIndex);
          swapDrawIndex();
        }
      }
 else {
        if (screenTexID[0] != 0) {
          copyFrameToScreenTexture();
        }
      }
    }
  }
 else {
    if (drawFramebuffer != null) {
      popFramebuffer();
      swapDrawIndex();
    }
  }
  if (primarySurface) {
    gl.glFlush();
  }
 else {
    ((PGraphicsAndroid3D)parent.g).restoreGLState();
  }
  report("String_Node_Str");
}
Program: 109281
Project: 109281
Buggy source:
/** 
 * Copy texture to pixels. Involves video memory to main memory transfer (slow).
 */
public void get(int[] pixels){
  if ((pixels == null) || (pixels.length != width * height)) {
    pixels=new int[width * height];
  }
  int size=glWidth * glHeight;
  int[] tmp=new int[size];
  IntBuffer pixelBuffer=BufferUtil.newIntBuffer(size);
  PFramebuffer fbo=new PFramebuffer(parent,glWidth,glHeight);
  fbo.addColorBuffer(this);
  a3d.pushFramebuffer();
  a3d.setFramebuffer(fbo);
  gl.glReadPixels(0,0,glWidth,glHeight,GL10.GL_RGBA,GL10.GL_UNSIGNED_BYTE,pixelBuffer);
  a3d.popFramebuffer();
  pixelBuffer.get(tmp);
  pixelBuffer.rewind();
  convertToARGB(tmp,pixels);
  if (flippedX)   flipArrayOnX(pixels,1);
  if (flippedY)   flipArrayOnY(pixels,1);
}

Fixed version (ground truth):
/** 
 * Copy texture to pixels. Involves video memory to main memory transfer (slow).
 */
public void get(int[] pixels){
  if ((pixels == null) || (pixels.length != width * height)) {
    pixels=new int[width * height];
  }
  int size=glWidth * glHeight;
  int[] tmp=new int[size];
  IntBuffer pixelBuffer=BufferUtil.newIntBuffer(size);
  PFramebuffer fbo=new PFramebuffer(parent,glWidth,glHeight);
  fbo.setColorBuffer(this);
  a3d.pushFramebuffer();
  a3d.setFramebuffer(fbo);
  gl.glReadPixels(0,0,glWidth,glHeight,GL10.GL_RGBA,GL10.GL_UNSIGNED_BYTE,pixelBuffer);
  a3d.popFramebuffer();
  pixelBuffer.get(tmp);
  pixelBuffer.rewind();
  convertToARGB(tmp,pixels);
  if (flippedX)   flipArrayOnX(pixels,1);
  if (flippedY)   flipArrayOnY(pixels,1);
}
Program: 109282
Project: 109282
Buggy source:
synchronized public void noClear(){
  if (g instanceof PGraphicsAndroid3D) {
    ((PGraphicsAndroid3D)g).noClear();
  }
}

Fixed version (ground truth):
synchronized public void noClear(){
  if (g instanceof PGraphicsAndroid3D) {
    ((PGraphicsAndroid3D)g).noClear();
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
}
Program: 109283
Project: 109283
Buggy source:
synchronized public void clear(){
  if (g instanceof PGraphicsAndroid3D) {
    ((PGraphicsAndroid3D)g).clear();
  }
}

Fixed version (ground truth):
synchronized public void clear(){
  if (g instanceof PGraphicsAndroid3D) {
    ((PGraphicsAndroid3D)g).clear();
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
}
Program: 109284
Project: 109284
Buggy source:
protected void defaultSettings(){
  super.defaultSettings();
  manipulatingCamera=false;
  perspective();
  textureMode(IMAGE);
}

Fixed version (ground truth):
protected void defaultSettings(){
  super.defaultSettings();
  manipulatingCamera=false;
  textureMode(IMAGE);
}
Program: 109285
Project: 109285
Buggy source:
protected void drawScreenTexture(){
  gl.glEnable(GL10.GL_TEXTURE_2D);
  gl.glBindTexture(GL10.GL_TEXTURE_2D,screenTexID[0]);
  gl.glDepthMask(false);
  gl.glDisable(GL10.GL_BLEND);
  gl11.glTexParameteriv(GL10.GL_TEXTURE_2D,GL11Ext.GL_TEXTURE_CROP_RECT_OES,screenTexCrop,0);
  gl11x.glDrawTexiOES(0,0,0,width,height);
  gl.glDisable(GL10.GL_TEXTURE_2D);
  gl.glDepthMask(true);
  gl.glEnable(GL10.GL_BLEND);
}

Fixed version (ground truth):
protected void drawScreenTexture(){
  gl.glEnable(GL10.GL_TEXTURE_2D);
  gl.glBindTexture(GL10.GL_TEXTURE_2D,screenTexID[0]);
  gl.glDepthMask(false);
  gl.glDisable(GL10.GL_BLEND);
  gl11.glTexParameteriv(GL10.GL_TEXTURE_2D,GL11Ext.GL_TEXTURE_CROP_RECT_OES,screenTexCrop,0);
  gl11x.glDrawTexiOES(0,0,0,width,height);
  gl.glDisable(GL10.GL_TEXTURE_2D);
  gl.glDepthMask(true);
  if (blend) {
    blend(blendMode);
  }
 else {
    noBlend();
  }
}
Program: 109286
Project: 109286
Buggy source:
void createDrawFramebuffer(){
  drawTexCrop=new int[4];
  drawTexCrop[0]=0;
  drawTexCrop[1]=0;
  drawTexCrop[2]=width;
  drawTexCrop[3]=height;
  drawImages=new PImage[2];
  drawImages[0]=parent.createImage(width,height,ARGB,NEAREST);
  drawImages[1]=parent.createImage(width,height,ARGB,NEAREST);
  drawTextures=new PTexture[2];
  drawTextures[0]=drawImages[0].getTexture();
  drawTextures[1]=drawImages[1].getTexture();
  drawIndex=0;
  drawFramebuffer=new PFramebuffer(parent,drawTextures[0].getGLWidth(),drawTextures[0].getGLHeight(),false);
  drawFramebuffer.addDepthBuffer(DEPTH_BITS);
  if (0 < STENCIL_BITS) {
    drawFramebuffer.addStencilBuffer(STENCIL_BITS);
  }
}

Fixed version (ground truth):
void createDrawFramebuffer(){
  drawTexCrop=new int[4];
  drawTexCrop[0]=0;
  drawTexCrop[1]=0;
  drawTexCrop[2]=width;
  drawTexCrop[3]=height;
  drawImages=new PImage[2];
  drawImages[0]=parent.createImage(width,height,ARGB,NEAREST);
  drawImages[1]=parent.createImage(width,height,ARGB,NEAREST);
  drawTextures=new PTexture[2];
  drawTextures[0]=drawImages[0].getTexture();
  drawTextures[1]=drawImages[1].getTexture();
  drawTextures[0].setFlippedY(true);
  drawTextures[1].setFlippedY(true);
  drawIndex=0;
  drawFramebuffer=new PFramebuffer(parent,drawTextures[0].getGLWidth(),drawTextures[0].getGLHeight(),false);
  drawFramebuffer.addDepthBuffer(DEPTH_BITS);
  if (0 < STENCIL_BITS) {
    drawFramebuffer.addStencilBuffer(STENCIL_BITS);
  }
}
Program: 109287
Project: 109287
Buggy source:
public void renderDrawTexture(int idx){
  PTexture tex=drawTextures[idx];
  gl.glEnable(tex.getGLTarget());
  gl.glBindTexture(tex.getGLTarget(),tex.getGLTextureID());
  gl.glDepthMask(false);
  gl.glDisable(GL10.GL_BLEND);
  gl.glTexEnvf(GL10.GL_TEXTURE_ENV,GL10.GL_TEXTURE_ENV_MODE,GL10.GL_REPLACE);
  gl11.glTexParameteriv(tex.getGLTarget(),GL11Ext.GL_TEXTURE_CROP_RECT_OES,drawTexCrop,0);
  gl11x.glDrawTexiOES(0,0,0,width,height);
  gl.glDisable(tex.getGLTarget());
  gl.glDepthMask(true);
  gl.glEnable(GL10.GL_BLEND);
}

Fixed version (ground truth):
public void renderDrawTexture(int idx){
  PTexture tex=drawTextures[idx];
  gl.glEnable(tex.getGLTarget());
  gl.glBindTexture(tex.getGLTarget(),tex.getGLTextureID());
  gl.glDepthMask(false);
  gl.glDisable(GL10.GL_BLEND);
  gl.glTexEnvf(GL10.GL_TEXTURE_ENV,GL10.GL_TEXTURE_ENV_MODE,GL10.GL_REPLACE);
  gl11.glTexParameteriv(tex.getGLTarget(),GL11Ext.GL_TEXTURE_CROP_RECT_OES,drawTexCrop,0);
  gl11x.glDrawTexiOES(0,0,0,width,height);
  gl.glDisable(tex.getGLTarget());
  gl.glDepthMask(true);
  if (blend) {
    blend(blendMode);
  }
 else {
    noBlend();
  }
}
Program: 109289
Project: 109289
Buggy source:
public void endDraw(){
  if (!clear || !primarySurface) {
    if (fboSupported) {
      if (drawFramebuffer != null) {
        popFramebuffer();
        if (primarySurface) {
          gl.glClearColor(0,0,0,0);
          gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
          renderDrawTexture(drawIndex);
        }
        swapDrawIndex();
      }
    }
 else {
      if (screenTexID[0] != 0) {
        copyFrameToScreenTexture();
      }
    }
  }
  gl.glFlush();
  if (!primarySurface) {
    ((PGraphicsAndroid3D)parent.g).restoreGLState();
  }
  report("String_Node_Str");
}

Fixed version (ground truth):
public void endDraw(){
  if (!clear || !primarySurface) {
    if (fboSupported) {
      if (drawFramebuffer != null) {
        popFramebuffer();
        if (primarySurface) {
          gl.glClearColor(0,0,0,0);
          gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
          renderDrawTexture(drawIndex);
        }
        swapDrawIndex();
      }
    }
 else {
      if (screenTexID[0] != 0) {
        copyFrameToScreenTexture();
      }
    }
  }
  if (primarySurface) {
    gl.glFlush();
  }
 else {
    ((PGraphicsAndroid3D)parent.g).restoreGLState();
  }
  report("String_Node_Str");
}
Program: 109290
Project: 109290
Buggy source:
public void mult(float[] m){
}

Fixed version (ground truth):
public void mult(float n0,float n4,float n8,float n12,float n1,float n5,float n9,float n13,float n2,float n6,float n10,float n14,float n3,float n7,float n11,float n15){
  float r0=current[0] * n0 + current[4] * n1 + current[8] * n2 + current[12] * n3;
  float r4=current[0] * n4 + current[4] * n5 + current[8] * n6 + current[12] * n7;
  float r8=current[0] * n8 + current[4] * n9 + current[8] * n10 + current[12] * n11;
  float r12=current[0] * n12 + current[4] * n13 + current[8] * n14 + current[12] * n15;
  float r1=current[1] * n0 + current[5] * n1 + current[9] * n2 + current[13] * n3;
  float r5=current[1] * n4 + current[5] * n5 + current[9] * n6 + current[13] * n7;
  float r9=current[1] * n8 + current[5] * n8 + current[9] * n10 + current[13] * n11;
  float r13=current[1] * n12 + current[5] * n13 + current[9] * n14 + current[13] * n15;
  float r2=current[2] * n0 + current[6] * n1 + current[10] * n2 + current[14] * n3;
  float r6=current[2] * n4 + current[6] * n5 + current[10] * n6 + current[14] * n7;
  float r10=current[2] * n8 + current[6] * n9 + current[10] * n10 + current[14] * n11;
  float r14=current[2] * n12 + current[6] * n13 + current[10] * n14 + current[14] * n15;
  float r3=current[3] * n0 + current[7] * n1 + current[11] * n2 + current[15] * n3;
  float r7=current[3] * n4 + current[7] * n5 + current[11] * n6 + current[15] * n7;
  float r11=current[3] * n8 + current[7] * n9 + current[11] * n10 + current[15] * n11;
  float r15=current[3] * n12 + current[7] * n13 + current[11] * n14 + current[15] * n15;
  current[0]=r0;
  current[4]=r4;
  current[8]=r8;
  current[12]=r12;
  current[1]=r1;
  current[5]=r5;
  current[9]=r9;
  current[13]=r13;
  current[2]=r2;
  current[6]=r6;
  current[10]=r10;
  current[14]=r14;
  current[3]=r3;
  current[7]=r7;
  current[11]=r11;
  current[15]=r15;
}
Program: 109291
Project: 109291
Buggy source:
public A3DMatrixStack(){
}

Fixed version (ground truth):
public A3DMatrixStack(){
  matrixStack=new Stack<float[]>();
  current=new float[16];
  set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);
}
Program: 109292
Project: 109292
Buggy source:
public void push(){
}

Fixed version (ground truth):
public void push(){
  float[] mat=new float[16];
  PApplet.arrayCopy(current,mat);
  matrixStack.push(mat);
}
Program: 109293
Project: 109293
Buggy source:
public void pop(){
}

Fixed version (ground truth):
public void pop(){
  try {
    float[] mat=matrixStack.pop();
    PApplet.arrayCopy(mat,current);
  }
 catch (  EmptyStackException e) {
    PGraphics.showWarning("String_Node_Str");
  }
}
Program: 109294
Project: 109294
Buggy source:
public void get(float[] m){
}

Fixed version (ground truth):
public void get(float[] mat){
  PApplet.arrayCopy(current,mat);
}
Program: 109295
Project: 109295
Buggy source:
public void set(float[] m){
}

Fixed version (ground truth):
public void set(float n0,float n4,float n8,float n12,float n1,float n5,float n9,float n13,float n2,float n6,float n10,float n14,float n3,float n7,float n11,float n15){
  current[0]=n0;
  current[4]=n4;
  current[8]=n8;
  current[12]=n12;
  current[1]=n1;
  current[5]=n5;
  current[9]=n9;
  current[13]=n13;
  current[2]=n2;
  current[6]=n6;
  current[10]=n10;
  current[14]=n14;
  current[3]=n3;
  current[7]=n7;
  current[11]=n11;
  current[15]=n15;
}
Program: 109296
Project: 109296
Buggy source:
public void rotate(float a,float rx,float ry,float rz){
}

Fixed version (ground truth):
public void rotate(float angle,float rx,float ry,float rz){
  float c=PApplet.cos(angle);
  float s=PApplet.sin(angle);
  float t=1.0f - c;
  mult((t * rx * rx) + c,(t * rx * ry) - (s * rz),(t * rx * rz) + (s * ry),0,(t * rx * ry) + (s * rz),(t * ry * ry) + c,(t * ry * rz) - (s * rx),0,(t * rx * rz) - (s * ry),(t * ry * rz) + (s * rx),(t * rz * rz) + c,0,0,0,0,1);
}
Program: 109297
Project: 109297
Buggy source:
public void translate(float tx,float ty,float tz){
}

Fixed version (ground truth):
public void translate(float tx,float ty,float tz){
  current[12]+=tx * current[0] + ty * current[4] + tz * current[8];
  current[13]+=tx * current[1] + ty * current[5] + tz * current[9];
  current[14]+=tx * current[2] + ty * current[6] + tz * current[10];
  current[15]+=tx * current[3] + ty * current[7] + tz * current[11];
}
Program: 109298
Project: 109298
Buggy source:
public void scale(float sx,float sy,float sz){
}

Fixed version (ground truth):
public void scale(float sx,float sy,float sz){
  current[0]*=sx;
  current[4]*=sy;
  current[8]*=sz;
  current[1]*=sx;
  current[5]*=sy;
  current[9]*=sz;
  current[2]*=sx;
  current[6]*=sy;
  current[10]*=sz;
  current[3]*=sx;
  current[7]*=sy;
  current[11]*=sz;
}
Program: 109299
Project: 109299
Buggy source:
protected void addToTexture(GL10 gl){
  if (offsetX + width > texWidth) {
    offsetX=0;
    offsetY+=lineHeight;
    lineHeight=0;
  }
  lineHeight=Math.max(lineHeight,height);
  if (offsetY + lineHeight > texHeight) {
    addTexture(gl);
    offsetX=0;
    offsetY=0;
    lineHeight=0;
  }
  int[] rgba=new int[width * height];
  int t=0;
  int p=0;
  if (PGraphicsAndroid3D.BIG_ENDIAN) {
    for (int y=0; y < height; y++) {
      for (int x=0; x < width; x++) {
        rgba[t++]=255 << 24 | 255 << 16 | 0 << 8 | 0;
      }
    }
  }
 else {
    for (int y=0; y < height; y++) {
      for (int x=0; x < width; x++) {
        rgba[t++]=255 << 24 | 0 << 16 | 0 << 8 | 0;
      }
    }
  }
  gl.glTexSubImage2D(GL10.GL_TEXTURE_2D,0,offsetX,offsetY,width,height,GL10.GL_RGBA,GL10.GL_UNSIGNED_BYTE,IntBuffer.wrap(rgba));
  texture=new TextureInfo(currentID,offsetX,offsetY,width,height);
  offsetX+=width;
}

Fixed version (ground truth):
protected void addToTexture(GL10 gl){
  if (offsetX + width > texWidth) {
    offsetX=0;
    offsetY+=lineHeight;
    lineHeight=0;
  }
  lineHeight=Math.max(lineHeight,height);
  if (offsetY + lineHeight > texHeight) {
    addTexture(gl);
    offsetX=0;
    offsetY=0;
    lineHeight=0;
  }
  int[] rgba=new int[width * height];
  int t=0;
  int p=0;
  if (PGraphicsAndroid3D.BIG_ENDIAN) {
    for (int y=0; y < height; y++) {
      for (int x=0; x < width; x++) {
        rgba[t++]=0xFFFFFF00 | image.pixels[p++];
      }
    }
  }
 else {
    for (int y=0; y < height; y++) {
      for (int x=0; x < width; x++) {
        rgba[t++]=(image.pixels[p++] << 24) | 0x00FFFFFF;
      }
    }
  }
  gl.glTexSubImage2D(GL10.GL_TEXTURE_2D,0,offsetX,offsetY,width,height,GL10.GL_RGBA,GL10.GL_UNSIGNED_BYTE,IntBuffer.wrap(rgba));
  texture=new TextureInfo(currentID,offsetX,offsetY,width,height);
  offsetX+=width;
}
Program: 109300
Project: 109300
Buggy source:
protected void textCharModelImpl(Glyph.TextureInfo tex,float x1,float y1,float x2,float y2,int u2,int v2){
  if (textFontTexID != textFont.currentID) {
    textFontTexID=textFont.currentID;
    gl.glBindTexture(GL10.GL_TEXTURE_2D,textFontTexID);
  }
  ((GL11)gl).glTexParameteriv(GL10.GL_TEXTURE_2D,GL11Ext.GL_TEXTURE_CROP_RECT_OES,tex.crop,0);
  ((GL11Ext)gl).glDrawTexiOES((int)x1,height - (int)y1,0,(int)(x2 - x1),(int)(y2 - y1));
}

Fixed version (ground truth):
protected void textCharModelImpl(Glyph.TextureInfo tex,float x1,float y1,float x2,float y2,int u2,int v2){
  if (textFontTexID != tex.glid) {
    textFontTexID=tex.glid;
    gl.glBindTexture(GL10.GL_TEXTURE_2D,textFontTexID);
  }
  ((GL11)gl).glTexParameteriv(GL10.GL_TEXTURE_2D,GL11Ext.GL_TEXTURE_CROP_RECT_OES,tex.crop,0);
  ((GL11Ext)gl).glDrawTexiOES((int)x1,height - (int)y1,0,(int)(x2 - x1),(int)(y2 - y1));
}
Program: 109301
Project: 109301
Buggy source:
/** 
 * Implementation of actual drawing for a line of text.
 */
protected void textLineImpl(char buffer[],int start,int stop,float x,float y){
  if (textFont.mTextureID == -1) {
    textFont.initialize(gl,maxTextureSize,maxTextureSize);
    textFont.addToTexture(gl);
  }
  textFontTexID=textFont.currentID;
  gl.glBindTexture(GL10.GL_TEXTURE_2D,textFontTexID);
  gl.glEnable(GL10.GL_TEXTURE_2D);
  gl.glShadeModel(GL10.GL_FLAT);
  gl.glMatrixMode(GL10.GL_PROJECTION);
  gl.glPushMatrix();
  gl.glLoadIdentity();
  gl.glOrthof(0.0f,width,0.0f,height,0.0f,1.0f);
  gl.glMatrixMode(GL10.GL_MODELVIEW);
  gl.glPushMatrix();
  gl.glLoadIdentity();
  super.textLineImpl(buffer,start,stop,x,y);
  gl.glMatrixMode(GL10.GL_PROJECTION);
  gl.glPopMatrix();
  gl.glMatrixMode(GL10.GL_MODELVIEW);
  gl.glPopMatrix();
}

Fixed version (ground truth):
/** 
 * Implementation of actual drawing for a line of text.
 */
protected void textLineImpl(char buffer[],int start,int stop,float x,float y){
  if (textFont.mTextureID == -1) {
    textFont.initialize(gl,maxTextureSize,maxTextureSize);
    textFont.addToTexture(gl);
  }
  textFontTexID=textFont.currentID;
  gl.glBindTexture(GL10.GL_TEXTURE_2D,textFontTexID);
  gl.glEnable(GL10.GL_TEXTURE_2D);
  gl.glMatrixMode(GL10.GL_PROJECTION);
  gl.glPushMatrix();
  gl.glLoadIdentity();
  gl.glOrthof(0.0f,width,0.0f,height,0.0f,1.0f);
  gl.glMatrixMode(GL10.GL_MODELVIEW);
  gl.glPushMatrix();
  gl.glLoadIdentity();
  super.textLineImpl(buffer,start,stop,x,y);
  gl.glMatrixMode(GL10.GL_PROJECTION);
  gl.glPopMatrix();
  gl.glMatrixMode(GL10.GL_MODELVIEW);
  gl.glPopMatrix();
}
Program: 109302
Project: 109302
Buggy source:
protected void textCharScreenImpl(Glyph.TextureInfo tex,int xx,int yy,int w0,int h0){
  if (textFontTexID != textFont.currentID) {
    textFontTexID=textFont.currentID;
    gl.glBindTexture(GL10.GL_TEXTURE_2D,textFontTexID);
  }
  ((GL11)gl).glTexParameteriv(GL10.GL_TEXTURE_2D,GL11Ext.GL_TEXTURE_CROP_RECT_OES,tex.crop,0);
  ((GL11Ext)gl).glDrawTexiOES((int)xx,(int)yy,0,(int)w0,(int)h0);
}

Fixed version (ground truth):
protected void textCharScreenImpl(Glyph.TextureInfo tex,int xx,int yy,int w0,int h0){
  if (textFontTexID != tex.glid) {
    textFontTexID=tex.glid;
    gl.glBindTexture(GL10.GL_TEXTURE_2D,textFontTexID);
  }
  ((GL11)gl).glTexParameteriv(GL10.GL_TEXTURE_2D,GL11Ext.GL_TEXTURE_CROP_RECT_OES,tex.crop,0);
  ((GL11Ext)gl).glDrawTexiOES((int)xx,(int)yy,0,(int)w0,(int)h0);
}