nus-yam/ex-repair huggingface dataset:
Program: 11458
Project: 11458
Buggy source:
protected Axis1D getOrthogonalAxis(Axis2D axis){
  return orient == HORIZONTAL ? axis.getAxisX() : axis.getAxisY();
}

Fixed version (ground truth):
public Axis1D getOrthogonalAxis(Axis2D axis){
  return orient == HORIZONTAL ? axis.getAxisX() : axis.getAxisY();
}
Program: 11460
Project: 11460
Buggy source:
public synchronized TooltipPainter setFixedWidth(int fixedWidth){
  this.fixedWidth=fixedWidth;
  this.isFixedWidth=true;
  this.textLayout=null;
  return this;
}

Fixed version (ground truth):
public synchronized TooltipPainter setFixedWidth(int fixedWidth){
  this.fixedWidth=fixedWidth;
  this.isFixedWidth=true;
  this.resetTextLayout();
  return this;
}
Program: 11461
Project: 11461
Buggy source:
public synchronized TooltipPainter setBreakOnEol(boolean breakOnEol){
  this.breakOnEol=breakOnEol;
  this.textLayout=null;
  return this;
}

Fixed version (ground truth):
public synchronized TooltipPainter setBreakOnEol(boolean breakOnEol){
  this.breakOnEol=breakOnEol;
  this.resetTextLayout();
  return this;
}
Program: 11462
Project: 11462
Buggy source:
public synchronized TooltipPainter setBorderSize(int size){
  this.borderSize=size;
  this.textLayout=null;
  return this;
}

Fixed version (ground truth):
public synchronized TooltipPainter setBorderSize(int size){
  this.borderSize=size;
  this.resetTextLayout();
  return this;
}
Program: 11463
Project: 11463
Buggy source:
public synchronized TooltipPainter setUnlimitedWidth(){
  this.isFixedWidth=false;
  this.textLayout=null;
  return this;
}

Fixed version (ground truth):
public synchronized TooltipPainter setUnlimitedWidth(){
  this.isFixedWidth=false;
  this.resetTextLayout();
  return this;
}
Program: 11464
Project: 11464
Buggy source:
public synchronized TooltipPainter setWrapTextAroundIcon(boolean wrap){
  this.wrapTextAroundIcon=wrap;
  this.textLayout=null;
  return this;
}

Fixed version (ground truth):
public synchronized TooltipPainter setWrapTextAroundIcon(boolean wrap){
  this.wrapTextAroundIcon=wrap;
  this.resetTextLayout();
  return this;
}
Program: 11465
Project: 11465
Buggy source:
/** 
 * Sets the icon to be displayed on the first line of the tool tip.
 * @param id the id of the icon in TooltipPainter's TextureAtlas
 */
public synchronized TooltipPainter setIcon(Object iconId){
  this.iconIds=Collections.singletonList(iconId);
  this.iconColors=null;
  this.icons=null;
  return this;
}

Fixed version (ground truth):
/** 
 * Sets the icon to be displayed on the first line of the tool tip.
 * @param id the id of the icon in TooltipPainter's TextureAtlas
 */
public synchronized TooltipPainter setIcon(Object iconId){
  this.iconIds=iconId != null ? Collections.singletonList(iconId) : null;
  this.iconColors=null;
  this.icons=null;
  return this;
}
Program: 11466
Project: 11466
Buggy source:
public synchronized TooltipPainter setBreakIterator(BreakIterator breakIterator){
  this.breakIterator=breakIterator;
  this.textLayout=null;
  return this;
}

Fixed version (ground truth):
public synchronized TooltipPainter setBreakIterator(BreakIterator breakIterator){
  this.breakIterator=breakIterator;
  this.resetTextLayout();
  return this;
}
Program: 11467
Project: 11467
Buggy source:
public synchronized TooltipPainter setLineSpacing(int lineSpacing){
  this.lineSpacing=lineSpacing;
  this.textLayout=null;
  return this;
}

Fixed version (ground truth):
public synchronized TooltipPainter setLineSpacing(int lineSpacing){
  this.lineSpacing=lineSpacing;
  this.resetTextLayout();
  return this;
}
Program: 11468
Project: 11468
Buggy source:
@Override public synchronized TooltipPainter setText(String text){
  this.text=text;
  this.textLayout=null;
  return this;
}

Fixed version (ground truth):
@Override public synchronized TooltipPainter setText(String text){
  this.text=text;
  this.resetTextLayout();
  return this;
}
Program: 11470
Project: 11470
Buggy source:
protected void updateTextLayout(){
  Font font=textRenderer.getFont();
  FontRenderContext frc=textRenderer.getFontRenderContext();
  textLayout=new SimpleTextLayoutCenter(font,frc,breakIterator);
  textLayout.setBreakOnEol(breakOnEol);
  textLayout.setLineSpacing(lineSpacing);
  if (iconSize == 0)   iconSize=(float)textLayout.getAscent();
  textLayout.doLayout(text,0,0,isFixedWidth ? fixedWidth : Float.MAX_VALUE);
  lines=textLayout.getLines();
}

Fixed version (ground truth):
protected void updateTextLayout(){
  Font font=textRenderer.getFont();
  FontRenderContext frc=textRenderer.getFontRenderContext();
  textLayout=new SimpleTextLayoutCenter(font,frc,breakIterator);
  textLayout.setBreakOnEol(breakOnEol);
  textLayout.setLineSpacing(lineSpacing);
  if (iconSize == 0)   iconSize=(float)textLayout.getLineHeight();
  textLayout.doLayout(text,0,0,isFixedWidth ? fixedWidth : Float.MAX_VALUE);
  lines=textLayout.getLines();
}
Program: 11471
Project: 11471
Buggy source:
public synchronized TooltipPainter setFixedWidth(int fixedWidth){
  this.fixedWidth=fixedWidth;
  this.isFixedWidth=true;
  this.lines=null;
  return this;
}

Fixed version (ground truth):
public synchronized TooltipPainter setFixedWidth(int fixedWidth){
  this.fixedWidth=fixedWidth;
  this.isFixedWidth=true;
  this.textLayout=null;
  return this;
}
Program: 11472
Project: 11472
Buggy source:
public synchronized TooltipPainter setBorderSize(int size){
  this.borderSize=size;
  this.lines=null;
  return this;
}

Fixed version (ground truth):
public synchronized TooltipPainter setBorderSize(int size){
  this.borderSize=size;
  this.textLayout=null;
  return this;
}
Program: 11473
Project: 11473
Buggy source:
public synchronized TooltipPainter setUnlimitedWidth(){
  this.isFixedWidth=false;
  this.lines=null;
  return this;
}

Fixed version (ground truth):
public synchronized TooltipPainter setUnlimitedWidth(){
  this.isFixedWidth=false;
  this.textLayout=null;
  return this;
}
Program: 11474
Project: 11474
Buggy source:
public synchronized TooltipPainter setWrapTextAroundIcon(boolean wrap){
  this.wrapTextAroundIcon=wrap;
  this.lines=null;
  return this;
}

Fixed version (ground truth):
public synchronized TooltipPainter setWrapTextAroundIcon(boolean wrap){
  this.wrapTextAroundIcon=wrap;
  this.textLayout=null;
  return this;
}
Program: 11475
Project: 11475
Buggy source:
@Override public synchronized TooltipPainter setText(String text){
  this.text=text;
  this.lines=null;
  return this;
}

Fixed version (ground truth):
@Override public synchronized TooltipPainter setText(String text){
  this.text=text;
  this.textLayout=null;
  return this;
}
Program: 11476
Project: 11476
Buggy source:
/** 
 * @param font The font to use for the layout
 * @param frc The FontRenderContext used to rasterize the font. This will help define the character bounds
 * @param breaker The BreakIterator that is used to break the text (also see {@link #forceBreakAfter(int)})
 */
public SimpleTextLayout(Font font,FontRenderContext frc,BreakIterator breaker){
  this.font=font;
  this.frc=frc;
  this.breaker=breaker;
  Rectangle2D rect=font.getMaxCharBounds(frc);
  ascent=(float)(rect.getMaxY() - rect.getY());
  descent=(float)-rect.getY();
  setLineSpacing(0);
  setBreakOnEol(true);
}

Fixed version (ground truth):
/** 
 * @param font The font to use for the layout
 * @param frc The FontRenderContext used to rasterize the font. This will help define the character bounds
 * @param breaker The BreakIterator that is used to break the text (also see {@link #forceBreakAfter(int)})
 */
public SimpleTextLayout(Font font,FontRenderContext frc,BreakIterator breaker){
  this.font=font;
  this.frc=frc;
  this.breaker=breaker;
  Rectangle2D rect=font.getMaxCharBounds(frc);
  ascent=(float)(rect.getMaxY() - rect.getY());
  descent=(float)-rect.getY();
  lineHeight=font.getSize();
  setLineSpacing(0);
  setBreakOnEol(true);
}
Program: 11477
Project: 11477
Buggy source:
protected void loadIcons(){
  int size=iconIds == null ? 0 : iconIds.size();
  this.icons=Lists.newArrayListWithCapacity(size);
  this.noIcons=true;
  for (int i=0; i < size; i++) {
    Object iconId=this.iconIds.get(i);
    ImageData icon=iconId != null ? atlas.getImageData(iconId) : null;
    if (icon != null)     noIcons=false;
    this.icons.add(icon);
  }
}

Fixed version (ground truth):
protected void loadIcons(){
  atlas.beginRendering();
  atlas.endRendering();
  int size=iconIds == null ? 0 : iconIds.size();
  this.icons=Lists.newArrayListWithCapacity(size);
  this.noIcons=true;
  for (int i=0; i < size; i++) {
    Object iconId=this.iconIds.get(i);
    ImageData icon=iconId != null ? atlas.getImageData(iconId) : null;
    if (icon != null)     noIcons=false;
    this.icons.add(icon);
  }
}
Program: 11479
Project: 11479
Buggy source:
@Override public void tagsUpdated(TaggedAxis1D axis){
  Tag s=plot.getTimeSelectionTag();
  Tag m=plot.getTimeSelectionMaxTag();
  if (s != null && m != null && s.getValue() != m.getValue()) {
    s.setValue(m.getValue());
    axis.validateTags();
  }
}

Fixed version (ground truth):
@Override public void tagsUpdated(TaggedAxis1D axis){
  Tag s=plot.getTimeSelectionTag();
  Tag m=plot.getTimeSelectionMaxTag();
  if (s != null && m != null && s.getValue() != m.getValue()) {
    s.setValue(m.getValue());
    plot.getTimeAxis().validateTags();
  }
}
Program: 11480
Project: 11480
Buggy source:
protected void axisUpdated0(Axis1D axis){
  this.updateMode=axis.getUpdateMode();
  this.minDiff=axis.getMinSpan();
  this.maxDiff=axis.getMaxSpan();
  this.constrainMinDiff=axis.isMinSpanConstrained();
  this.constrainMaxDiff=axis.isMaxSpanConstrained();
  this.lockMin=axis.isLockMin();
  this.lockMax=axis.isLockMax();
  this.lockMinValue=axis.getLockMin();
  this.lockMaxValue=axis.getLockMax();
  this.absoluteMin=axis.getAbsoluteMin();
  this.absoluteMax=axis.getAbsoluteMax();
  this.selectionCenterValue=axis.getSelectionCenter();
  this.selectionSizeValue=axis.getSelectionSize();
  this.selectionLocked=axis.isSelectionLocked();
  if (!this.isInitialized()) {
    this.minValue=axis.getMin();
    this.maxValue=axis.getMax();
    this.pixelsPerValue=axis.getPixelsPerValue();
  }
 else   if (this.updateMode == UpdateMode.MinScale) {
    this.minValue=axis.getMin();
    this.pixelsPerValue=axis.getPixelsPerValue();
    this.recalculateMaxValue0();
    this.applyConstraints();
  }
 else   if (this.updateMode == UpdateMode.CenterScale) {
    this.pixelsPerValue=axis.getPixelsPerValue();
    double centerValue=(axis.getMax() - axis.getMin()) / 2.0 + axis.getMin();
    this.recalculateMinMaxValue0(centerValue);
    this.applyConstraints();
  }
 else   if (this.updateMode == UpdateMode.MinMax) {
    this.minValue=axis.getMin();
    this.maxValue=axis.getMax();
    this.recalculatePixelsPerValue0();
    this.applyConstraints();
  }
 else   if (this.updateMode == UpdateMode.FixedPixel) {
  }
}

Fixed version (ground truth):
protected void axisUpdated0(Axis1D axis){
  this.updateMode=axis.getUpdateMode();
  this.mousePosValue=axis.getMouseValue();
  this.minDiff=axis.getMinSpan();
  this.maxDiff=axis.getMaxSpan();
  this.constrainMinDiff=axis.isMinSpanConstrained();
  this.constrainMaxDiff=axis.isMaxSpanConstrained();
  this.lockMin=axis.isLockMin();
  this.lockMax=axis.isLockMax();
  this.lockMinValue=axis.getLockMin();
  this.lockMaxValue=axis.getLockMax();
  this.absoluteMin=axis.getAbsoluteMin();
  this.absoluteMax=axis.getAbsoluteMax();
  this.selectionCenterValue=axis.getSelectionCenter();
  this.selectionSizeValue=axis.getSelectionSize();
  this.selectionLocked=axis.isSelectionLocked();
  if (!this.isInitialized()) {
    this.minValue=axis.getMin();
    this.maxValue=axis.getMax();
    this.pixelsPerValue=axis.getPixelsPerValue();
  }
 else   if (this.updateMode == UpdateMode.MinScale) {
    this.minValue=axis.getMin();
    this.pixelsPerValue=axis.getPixelsPerValue();
    this.recalculateMaxValue0();
    this.applyConstraints();
  }
 else   if (this.updateMode == UpdateMode.CenterScale) {
    this.pixelsPerValue=axis.getPixelsPerValue();
    double centerValue=(axis.getMax() - axis.getMin()) / 2.0 + axis.getMin();
    this.recalculateMinMaxValue0(centerValue);
    this.applyConstraints();
  }
 else   if (this.updateMode == UpdateMode.MinMax) {
    this.minValue=axis.getMin();
    this.maxValue=axis.getMax();
    this.recalculatePixelsPerValue0();
    this.applyConstraints();
  }
 else   if (this.updateMode == UpdateMode.FixedPixel) {
  }
}
Program: 11481
Project: 11481
Buggy source:
public Axis1D getAxis(GlimpseTargetStack stack){
  AxisFactory1D factory=getAxisFactory0(stack);
  for (  GlimpseTarget target : stack.getTargetList()) {
    if (target instanceof GlimpseAxisLayout2D) {
      GlimpseAxisLayout2D layout=(GlimpseAxisLayout2D)target;
      if (layout.isAxisSet()) {
        return getCachedAxis0(getAxis(layout.getAxis()),factory,stack);
      }
    }
 else     if (target instanceof GlimpseAxisLayout1D) {
      GlimpseAxisLayout1D layout=(GlimpseAxisLayout1D)target;
      if (layout.isAxisSet()) {
        return getCachedAxis0(layout.getAxis(),factory,stack);
      }
    }
  }
  return null;
}

Fixed version (ground truth):
public Collection<Axis1D> getAxis(TargetStackMatcher matcher){
  return this.cache.getMatching(matcher);
}
Program: 11482
Project: 11482
Buggy source:
public Collection<Axis2D> getAxis(GlimpseLayoutPredicate predicate){
  return this.cache.getMatching(predicate);
}

Fixed version (ground truth):
public Collection<Axis2D> getAxis(TargetStackMatcher matcher){
  return this.cache.getMatching(matcher);
}
Program: 11483
Project: 11483
Buggy source:
/** 
 * @return all keys in the cache which match the provided predicate
 */
public Collection<D> getMatching(GlimpseLayoutPredicate predicate){
  ArrayList<D> acum=Lists.newArrayList();
  for (  List<GlimpseTarget> key : map.keySet()) {
    if (predicate.matches(key)) {
      acum.add(map.get(key).second());
    }
  }
  return acum;
}

Fixed version (ground truth):
/** 
 * @return all keys in the cache which match the provided predicate
 */
public Collection<D> getMatching(TargetStackMatcher matcher){
  ArrayList<D> acum=Lists.newArrayList();
  for (  List<GlimpseTarget> key : map.keySet()) {
    if (matcher.matches(key)) {
      acum.add(map.get(key).second());
    }
  }
  return acum;
}
Program: 11484
Project: 11484
Buggy source:
protected void addTimeTags(TaggedAxis1D axis){
  axis.addTag(MIN_TIME,0);
  axis.addTag(MAX_TIME,10);
  axis.addTag(CURRENT_TIME,10);
  axis.addConstraint(new Constraint(){
    @Override public void applyConstraint(    TaggedAxis1D axis){
      Tag minTag=axis.getTag(MIN_TIME);
      Tag maxTag=axis.getTag(MAX_TIME);
      Tag currentTag=axis.getTag(CURRENT_TIME);
      double minValue=minTag.getValue();
      double maxValue=maxTag.getValue();
      double currentValue=currentTag.getValue();
      if (minValue > maxValue) {
        minTag.setValue(maxValue);
      }
      if (currentValue < minValue) {
        currentTag.setValue(minValue);
      }
 else       if (currentValue > maxValue) {
        currentTag.setValue(maxValue);
      }
    }
    @Override public String getName(){
      return "String_Node_Str";
    }
  }
);
}

Fixed version (ground truth):
protected void addTimeTags(TaggedAxis1D axis){
  axis.addTag(MIN_TIME,0);
  axis.addTag(MAX_TIME,10);
  axis.addTag(CURRENT_TIME,10);
  axis.addConstraint(new OrderedConstraint("String_Node_Str",Arrays.asList(MIN_TIME,CURRENT_TIME,MAX_TIME)));
}
Program: 11486
Project: 11486
Buggy source:
@Override public ColorAxisPlot2D getLayout(){
  return getLayout(ColorGradients.purpleBone);
}

Fixed version (ground truth):
@Override public ColorAxisPlot2D getLayout(){
  return getLayout(ColorGradients.lighten(ColorGradients.winter,.25));
}
Program: 11487
Project: 11487
Buggy source:
public NamedConstraint(String name){
  this.name=name;
}

Fixed version (ground truth):
public NamedConstraint(String name){
  this.name=name;
  this.previousTags=Collections.emptyMap();
}
Program: 11488
Project: 11488
Buggy source:
@Override public Axis1D clone(){
  TaggedAxis1D axis=new TaggedAxis1D(this);
  for (  Tag tag : this.getSortedTags()) {
    axis.addTag(new Tag(tag));
  }
  for (  Constraint constraint : this.getAllConstraints()) {
    axis.addConstraint(constraint);
  }
  return axis;
}

Fixed version (ground truth):
@Override public TaggedAxis1D clone(){
  TaggedAxis1D axis=new TaggedAxis1D(this);
  for (  Tag tag : this.getSortedTags()) {
    axis.addTag(new Tag(tag));
  }
  for (  Constraint constraint : this.getAllConstraints()) {
    axis.addConstraint(constraint);
  }
  return axis;
}
Program: 11492
Project: 11492
Buggy source:
protected boolean getContainingTargets(I e,GlimpseContext context,List<GlimpseTargetStack> accumulator){
  GlimpseTargetStack stack=context.getTargetStack();
  GlimpseTarget layout=stack.getTarget();
  GlimpseBounds bounds=stack.getBounds();
  List<GlimpseTarget> list=layout.getTargetChildren();
  int size=list.size();
  for (int i=size - 1; i >= 0; i--) {
    GlimpseTarget childLayout=list.get(i);
    GlimpseBounds childBounds=childLayout.getTargetBounds(context.getTargetStack());
    stack.push(childLayout,childBounds);
    boolean consumeEvent=getContainingTargets(e,context,accumulator);
    if (consumeEvent)     return true;
    stack.pop();
  }
  if (!layout.isEventConsumer() && !layout.isEventGenerator())   return false;
  if (handleInterior(e,context,bounds)) {
    if (layout.isEventGenerator()) {
      accumulator.add(newTargetStack(stack));
    }
    return layout.isEventConsumer();
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
protected boolean getContainingTargets(I e,GlimpseContext context,List<GlimpseTargetStack> accumulator){
  GlimpseTargetStack stack=context.getTargetStack();
  GlimpseTarget layout=stack.getTarget();
  GlimpseBounds bounds=stack.getBounds();
  List<GlimpseTarget> list=layout.getTargetChildren();
  int size=list.size();
  for (int i=size - 1; i >= 0; i--) {
    GlimpseTarget childLayout=list.get(i);
    if (childLayout.isVisible()) {
      GlimpseBounds childBounds=childLayout.getTargetBounds(context.getTargetStack());
      stack.push(childLayout,childBounds);
      boolean consumeEvent=getContainingTargets(e,context,accumulator);
      if (consumeEvent)       return true;
      stack.pop();
    }
  }
  if (!layout.isEventConsumer() && !layout.isEventGenerator())   return false;
  if (handleInterior(e,context,bounds)) {
    if (layout.isEventGenerator()) {
      accumulator.add(newTargetStack(stack));
    }
    return layout.isEventConsumer();
  }
 else {
    return false;
  }
}
Program: 11493
Project: 11493
Buggy source:
public void paintTo(GlimpseContext context){
  GL gl=context.getGL();
  GlimpseBounds bounds=context.getTargetStack().getBounds();
  GlimpseBounds clippedBounds=getClippedBounds(context);
  if (!clippedBounds.isValid())   return;
  for (  Member m : memberList) {
    try {
      if (!(m.painter instanceof GlimpseLayout) && !layout.isVisible)       continue;
      gl.glEnable(GL2.GL_SCISSOR_TEST);
      gl.glViewport(bounds.getX(),bounds.getY(),bounds.getWidth(),bounds.getHeight());
      gl.glScissor(clippedBounds.getX(),clippedBounds.getY(),clippedBounds.getWidth(),clippedBounds.getHeight());
      if (m.callback != null)       m.callback.prePaint(m.painter,context);
      m.painter.paintTo(context);
      if (m.callback != null)       m.callback.postPaint(m.painter,context);
    }
  finally {
      gl.glDisable(GL2.GL_SCISSOR_TEST);
    }
  }
}

Fixed version (ground truth):
public void paintTo(GlimpseContext context){
  GL gl=context.getGL();
  GlimpseBounds bounds=context.getTargetStack().getBounds();
  GlimpseBounds clippedBounds=getClippedBounds(context);
  if (!clippedBounds.isValid())   return;
  for (  Member m : memberList) {
    try {
      boolean isLayout=m.painter instanceof GlimpseLayout;
      boolean isVisible=layout.isVisible;
      if (isVisible) {
        gl.glEnable(GL2.GL_SCISSOR_TEST);
        gl.glViewport(bounds.getX(),bounds.getY(),bounds.getWidth(),bounds.getHeight());
        gl.glScissor(clippedBounds.getX(),clippedBounds.getY(),clippedBounds.getWidth(),clippedBounds.getHeight());
        if (m.callback != null)         m.callback.prePaint(m.painter,context);
        m.painter.paintTo(context);
        if (m.callback != null)         m.callback.postPaint(m.painter,context);
      }
 else       if (isLayout) {
        ((GlimpseLayout)m.painter).layoutTo(context);
      }
    }
  finally {
      gl.glDisable(GL2.GL_SCISSOR_TEST);
    }
  }
}
Program: 11494
Project: 11494
Buggy source:
@Override public void mouseMoved(GlimpseMouseEvent e){
  TimeStamp time=getTime(e);
  Set<EventSelection> newHoveredEvents=Collections.unmodifiableSet(Sets.newHashSet(eventManager.getNearestEvents(e)));
  SetView<EventSelection> eventsExited=Sets.difference(hoveredEvents,newHoveredEvents);
  for (  EventPlotListener listener : eventListeners) {
    listener.eventsExited(e,eventsExited,time);
  }
  SetView<EventSelection> eventsEntered=Sets.difference(newHoveredEvents,hoveredEvents);
  for (  EventPlotListener listener : eventListeners) {
    listener.eventsEntered(e,eventsEntered,time);
  }
  for (  EventPlotListener listener : eventListeners) {
    listener.eventsHovered(e,newHoveredEvents,time);
  }
  hoveredEvents=Sets.newHashSet(newHoveredEvents);
}

Fixed version (ground truth):
@Override public void mouseMoved(GlimpseMouseEvent e){
  TimeStamp time=getTime(e);
  Set<EventSelection> newHoveredEvents=Collections.unmodifiableSet(Sets.newHashSet(eventManager.getNearestEvents(e)));
  SetView<EventSelection> eventsExited=Sets.difference(hoveredEvents,newHoveredEvents);
  for (  EventPlotListener listener : eventListeners) {
    listener.eventsExited(e,eventsExited,time);
  }
  SetView<EventSelection> eventsEntered=Sets.difference(newHoveredEvents,hoveredEvents);
  for (  EventPlotListener listener : eventListeners) {
    listener.eventsEntered(e,eventsEntered,time);
  }
  for (  EventPlotListener listener : eventListeners) {
    listener.eventsHovered(e,newHoveredEvents,time);
  }
  hoveredEvents=newHoveredEvents;
}
Program: 11495
Project: 11495
Buggy source:
public double getWrappedMod(double value){
  double span=getWrapSpan();
  double v=value - minWrapVal;
  double mod=v % span;
  return mod + (mod > 0 ? 0 : span);
}

Fixed version (ground truth):
public double getWrappedMod(double value){
  double span=getWrapSpan();
  double v=value - minWrapVal;
  double mod=v % span;
  return mod + (mod >= 0 ? 0 : span);
}
Program: 11496
Project: 11496
Buggy source:
@Override protected double f(double x){
  Math.asin(x);
  return 0;
}

Fixed version (ground truth):
@Override protected double f(double x){
  return Math.asin(x);
}
Program: 11497
Project: 11497
Buggy source:
protected void shiftMaps(int lastDelete,int nextDelete,int deleteCount){
  for (int i=lastDelete + 1; i < nextDelete; i++) {
    Object id=this.indexMap.remove(i);
    this.indexMap.put(i - deleteCount,id);
    this.idMap.put(id,i - deleteCount);
  }
}

Fixed version (ground truth):
protected static void shiftMaps(Map<Object,Integer> idMap,Map<Integer,Object> indexMap,int lastDelete,int nextDelete,int deleteCount){
  for (int i=lastDelete + 1; i < nextDelete; i++) {
    Object id=indexMap.remove(i);
    indexMap.put(i - deleteCount,id);
    idMap.put(id,i - deleteCount);
  }
}
Program: 11498
Project: 11498
Buggy source:
protected void shift(FloatBuffer data,int dataSize,int endIndex,int startIndex,int length){
  int shiftCount=dataSize - startIndex;
  int shiftSize=endIndex - startIndex;
  if (tempBuffer == null || tempBuffer.capacity() < shiftCount * length) {
    tempBuffer=FloatBuffer.allocate(shiftCount * length);
  }
  tempBuffer.position(0);
  tempBuffer.limit(shiftCount * length);
  data.position(startIndex * length);
  data.limit(dataSize * length);
  tempBuffer.put(data);
  tempBuffer.rewind();
  data.position(endIndex * length);
  data.limit((dataSize - shiftSize) * length);
  data.put(tempBuffer);
}

Fixed version (ground truth):
/** 
 * @param data buffer to shift
 * @param shiftCount number of logical indices to shift (each index represents 'length' buffer entries)
 * @param toIndex the logical index to start copying data to
 * @param fromIndex the logical index to start copying data from
 * @param length the number of buffer entries per logical index
 */
protected static void shift(FloatBuffer data,FloatBuffer tempBuffer,int shiftCount,int toIndex,int fromIndex,int length){
  if (shiftCount == 0 || toIndex == fromIndex)   return;
  if (tempBuffer == null || tempBuffer.capacity() < shiftCount * length) {
    tempBuffer=FloatBuffer.allocate(shiftCount * length);
  }
  tempBuffer.limit(shiftCount * length);
  tempBuffer.position(0);
  data.limit((fromIndex + shiftCount) * length);
  data.position(fromIndex * length);
  tempBuffer.put(data);
  tempBuffer.rewind();
  data.limit((toIndex + shiftCount) * length);
  data.position(toIndex * length);
  data.put(tempBuffer);
}
Program: 11499
Project: 11499
Buggy source:
protected boolean isIconOverlapping(int size,int buffer,double remainingSpaceX,int pixelX,int nextStartPixel){
  return (size + buffer > remainingSpaceX && overlapRenderingMode == Overfull) || (pixelX + size + buffer > nextStartPixel && overlapRenderingMode == Intersecting);
}

Fixed version (ground truth):
protected boolean isIconOverlapping(int size,int buffer,double remainingSpaceX,int pixelX,int nextStartPixel){
  return (size + buffer > remainingSpaceX && getOverlapRenderingMode() == Overfull) || (pixelX + size + buffer > nextStartPixel && getOverlapRenderingMode() == Intersecting);
}
Program: 11500
Project: 11500
Buggy source:
protected boolean isTextIntersecting(int size,int buffer,double remainingSpaceX,int pixelX,int nextStartPixel,Rectangle2D bounds){
  return pixelX + bounds.getWidth() + buffer > nextStartPixel && overlapRenderingMode == Intersecting;
}

Fixed version (ground truth):
protected boolean isTextIntersecting(int size,int buffer,double remainingSpaceX,int pixelX,int nextStartPixel,Rectangle2D bounds){
  return pixelX + bounds.getWidth() + buffer > nextStartPixel && getOverlapRenderingMode() == Intersecting;
}
Program: 11501
Project: 11501
Buggy source:
protected double getTextAvailableSpace(int size,int buffer,double remainingSpaceX,int pixelX,int nextStartPixel){
  double insideBoxSpace=remainingSpaceX - buffer;
  double outsideBoxSpace=nextStartPixel - pixelX - buffer;
switch (overlapRenderingMode) {
case Overfull:
    return insideBoxSpace;
case Intersecting:
  return outsideBoxSpace;
case None:
default :
return Double.MAX_VALUE;
}
}

Fixed version (ground truth):
protected double getTextAvailableSpace(int size,int buffer,double remainingSpaceX,int pixelX,int nextStartPixel){
  double insideBoxSpace=remainingSpaceX - buffer;
  double outsideBoxSpace=nextStartPixel - pixelX - buffer;
switch (getOverlapRenderingMode()) {
case Overfull:
    return insideBoxSpace;
case Intersecting:
  return outsideBoxSpace;
case None:
default :
return Double.MAX_VALUE;
}
}
Program: 11502
Project: 11502
Buggy source:
protected boolean isTextOverfull(int size,int buffer,double remainingSpaceX,int pixelX,int nextStartPixel,Rectangle2D bounds){
  return bounds.getWidth() + buffer > remainingSpaceX && overlapRenderingMode == Overfull;
}

Fixed version (ground truth):
protected boolean isTextOverfull(int size,int buffer,double remainingSpaceX,int pixelX,int nextStartPixel,Rectangle2D bounds){
  return bounds.getWidth() + buffer > remainingSpaceX && getOverlapRenderingMode() == Overfull;
}
Program: 11503
Project: 11503
Buggy source:
@Override public void paintTo(GL2 gl,GlimpseBounds bounds,Axis2D axis){
  if (dataSize == 0)   return;
  if (!bufferInitialized) {
    bufferHandle=new int[1];
    gl.glGenBuffers(1,bufferHandle,0);
    bufferInitialized=true;
  }
  gl.glBindBuffer(GL2.GL_ARRAY_BUFFER,bufferHandle[0]);
  if (newData) {
    dataBufferLock.lock();
    try {
      gl.glBufferData(GL2.GL_ARRAY_BUFFER,dataSize * FLOATS_PER_BAR * BYTES_PER_FLOAT,dataBuffer.rewind(),GL2.GL_DYNAMIC_DRAW);
      glHandleError(gl);
      newData=false;
    }
  finally {
      dataBufferLock.unlock();
    }
  }
  gl.glBindBuffer(GL2.GL_ARRAY_BUFFER,bufferHandle[0]);
  gl.glVertexPointer(2,GL2.GL_FLOAT,0,0);
  gl.glEnableClientState(GL2.GL_VERTEX_ARRAY);
  gl.glColor4fv(barColor,0);
  gl.glDrawArrays(GL2.GL_QUADS,0,dataSize * 4);
}

Fixed version (ground truth):
@Override public void paintTo(GL2 gl,GlimpseBounds bounds,Axis2D axis){
  if (dataSize == 0)   return;
  if (!bufferInitialized) {
    bufferHandle=new int[1];
    gl.glGenBuffers(1,bufferHandle,0);
    bufferInitialized=true;
  }
  gl.glBindBuffer(GL2.GL_ARRAY_BUFFER,bufferHandle[0]);
  int dataSizeTemp=dataSize;
  if (newData) {
    dataBufferLock.lock();
    try {
      dataSizeTemp=dataSize;
      gl.glBufferData(GL2.GL_ARRAY_BUFFER,dataSizeTemp * FLOATS_PER_BAR * BYTES_PER_FLOAT,dataBuffer.rewind(),GL2.GL_DYNAMIC_DRAW);
      glHandleError(gl);
      newData=false;
    }
  finally {
      dataBufferLock.unlock();
    }
  }
  gl.glBindBuffer(GL2.GL_ARRAY_BUFFER,bufferHandle[0]);
  gl.glVertexPointer(2,GL2.GL_FLOAT,0,0);
  gl.glEnableClientState(GL2.GL_VERTEX_ARRAY);
  gl.glColor4fv(barColor,0);
  gl.glDrawArrays(GL2.GL_QUADS,0,dataSizeTemp * 4);
}
Program: 11504
Project: 11504
Buggy source:
public void autoAdjustAxisBounds(Axis2D axis){
  axis.getAxisX().setMin(minX);
  axis.getAxisX().setMax(maxX);
  axis.getAxisY().setMin(minY);
  axis.getAxisY().setMax(maxY);
}

Fixed version (ground truth):
public void autoAdjustAxisBounds(Axis2D axis){
  axis.getAxisX().setMin(minX);
  axis.getAxisX().setMax(maxX + getBinSize());
  axis.getAxisY().setMin(minY);
  axis.getAxisY().setMax(maxY);
}
Program: 11505
Project: 11505
Buggy source:
/** 
 * @deprecated Use {@link #NewtSwtGlimpseCanvas(Composite,GLContext,int)} instead. The context implicitly provides a GLProfile.
 */
public NewtSwtGlimpseCanvas(Composite parent,String profile,GLContext context,int options){
  this(parent,GLProfile.get(profile),context,options);
}

Fixed version (ground truth):
/** 
 * @deprecated Use {@link #NewtSwtGlimpseCanvas(Composite,GLContext,int)} instead. The context implicitly provides a GLProfile.
 */
@Deprecated public NewtSwtGlimpseCanvas(Composite parent,String profile,GLContext context,int options){
  this(parent,GLProfile.get(profile),context,options);
}
Program: 11506
Project: 11506
Buggy source:
@Override public void windowClosing(WindowEvent e){
  glDrawable.destroy();
  leftPanel.dispose();
  rightPanel.dispose();
}

Fixed version (ground truth):
@Override public void windowClosing(WindowEvent e){
  leftPanel.destroy();
  rightPanel.destroy();
  leftPanel.disposeAttached();
  rightPanel.disposeAttached();
}
Program: 11508
Project: 11508
Buggy source:
public static void main(String[] args) throws Exception {
  ScatterplotExample provider=new ScatterplotExample();
  Example example=Example.showWithSwing(provider);
  provider.addDisposeListener(example.getCanvas());
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  ScatterplotExample provider=new ScatterplotExample();
  Example.showWithSwing(provider);
}
Program: 11509
Project: 11509
Buggy source:
@Override public void windowClosing(WindowEvent e){
  canvas.dispose();
}

Fixed version (ground truth):
@Override public void windowClosing(WindowEvent e){
  canvas.disposeAttached();
}
Program: 11510
Project: 11510
Buggy source:
public static void main(String[] args) throws Exception {
  final NewtSwingGlimpseCanvas canvas=new NewtSwingGlimpseCanvas();
  GlimpseLayout plot=buildPlot(canvas);
  canvas.addLayout(plot);
  canvas.setLookAndFeel(new SwingLookAndFeel());
  new FPSAnimator(canvas.getGLDrawable(),120).start();
  final JFrame frame=new JFrame("String_Node_Str");
  frame.addWindowListener(new WindowAdapter(){
    @Override public void windowClosing(    WindowEvent e){
      canvas.dispose();
    }
  }
);
  frame.add(canvas);
  frame.pack();
  frame.setSize(800,800);
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.setVisible(true);
  return;
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  final NewtSwingGlimpseCanvas canvas=new NewtSwingGlimpseCanvas();
  GlimpseLayout plot=buildPlot(canvas);
  canvas.addLayout(plot);
  canvas.setLookAndFeel(new SwingLookAndFeel());
  new FPSAnimator(canvas.getGLDrawable(),120).start();
  final JFrame frame=new JFrame("String_Node_Str");
  frame.addWindowListener(new WindowAdapter(){
    @Override public void windowClosing(    WindowEvent e){
      canvas.disposeAttached();
    }
  }
);
  frame.add(canvas);
  frame.pack();
  frame.setSize(800,800);
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.setVisible(true);
  return;
}
Program: 11511
Project: 11511
Buggy source:
public static JFrame createFrame(String name,final NewtSwingGlimpseCanvas canvas){
  final JFrame frame=new JFrame(name);
  frame.addWindowListener(new WindowAdapter(){
    @Override public void windowClosing(    WindowEvent e){
      canvas.dispose();
      frame.remove(canvas);
    }
  }
);
  frame.add(canvas);
  frame.pack();
  frame.setSize(800,800);
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.setVisible(true);
  return frame;
}

Fixed version (ground truth):
public static JFrame createFrame(String name,final NewtSwingGlimpseCanvas canvas){
  final JFrame frame=new JFrame(name);
  frame.addWindowListener(new WindowAdapter(){
    @Override public void windowClosing(    WindowEvent e){
      canvas.disposeAttached();
      frame.remove(canvas);
    }
  }
);
  frame.add(canvas);
  frame.pack();
  frame.setSize(800,800);
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.setVisible(true);
  return frame;
}
Program: 11512
Project: 11512
Buggy source:
@Override public void windowClosing(WindowEvent e){
  canvas.dispose();
  frame.remove(canvas);
}

Fixed version (ground truth):
@Override public void windowClosing(WindowEvent e){
  canvas.disposeAttached();
  frame.remove(canvas);
}
Program: 11513
Project: 11513
Buggy source:
public static void main(String[] args) throws Exception {
  GLProfile glProfile=GLUtils.getDefaultGLProfile();
  ;
  GLOffscreenAutoDrawable glDrawable=GLUtils.newOffscreenDrawable(glProfile);
  GLContext glContext=glDrawable.getContext();
  final NewtSwingGlimpseCanvas canvas=new NewtSwingGlimpseCanvas(glContext);
  ColorAxisPlot2D layout=new HeatMapExample().getLayout();
  canvas.addLayout(layout);
  canvas.setLookAndFeel(new SwingLookAndFeel());
  final FBOGlimpseCanvas offscreenCanvas=new FBOGlimpseCanvas(glContext,800,800);
  offscreenCanvas.addLayout(layout);
  final NewtSwingGlimpseCanvas canvas2=new NewtSwingGlimpseCanvas(glContext);
  canvas2.addLayout(new ReprojectionExample().getLayout(offscreenCanvas));
  canvas2.setLookAndFeel(new SwingLookAndFeel());
  FPSAnimator animator=new FPSAnimator(120);
  animator.add(offscreenCanvas.getGLDrawable());
  animator.add(canvas2.getGLDrawable());
  animator.add(canvas.getGLDrawable());
  animator.start();
  createFrame("String_Node_Str",canvas);
  createFrame("String_Node_Str",canvas2);
  Runtime.getRuntime().addShutdownHook(new Thread(){
    @Override public void run(){
      offscreenCanvas.dispose();
    }
  }
);
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  GLProfile glProfile=GLUtils.getDefaultGLProfile();
  ;
  GLOffscreenAutoDrawable glDrawable=GLUtils.newOffscreenDrawable(glProfile);
  GLContext glContext=glDrawable.getContext();
  final NewtSwingGlimpseCanvas canvas=new NewtSwingGlimpseCanvas(glContext);
  ColorAxisPlot2D layout=new HeatMapExample().getLayout();
  canvas.addLayout(layout);
  canvas.setLookAndFeel(new SwingLookAndFeel());
  final FBOGlimpseCanvas offscreenCanvas=new FBOGlimpseCanvas(glContext,800,800);
  offscreenCanvas.addLayout(layout);
  final NewtSwingGlimpseCanvas canvas2=new NewtSwingGlimpseCanvas(glContext);
  canvas2.addLayout(new ReprojectionExample().getLayout(offscreenCanvas));
  canvas2.setLookAndFeel(new SwingLookAndFeel());
  FPSAnimator animator=new FPSAnimator(120);
  animator.add(offscreenCanvas.getGLDrawable());
  animator.add(canvas2.getGLDrawable());
  animator.add(canvas.getGLDrawable());
  animator.start();
  createFrame("String_Node_Str",canvas);
  createFrame("String_Node_Str",canvas2);
  Runtime.getRuntime().addShutdownHook(new Thread(){
    @Override public void run(){
      offscreenCanvas.disposeAttached();
    }
  }
);
}
Program: 11514
Project: 11514
Buggy source:
@Override public void run(){
  offscreenCanvas.dispose();
}

Fixed version (ground truth):
@Override public void run(){
  offscreenCanvas.disposeAttached();
}
Program: 11516
Project: 11516
Buggy source:
public static void main(String[] args) throws Exception {
  Example.showWithSwing(new PointShaderExample());
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  Example example=Example.showWithSwing(new PointShaderExample());
  example.getCanvas().getGLDrawable().addGLEventListener(new GLCapabilityEventListener());
}
Program: 11517
Project: 11517
Buggy source:
private GLEventListener createGLEventListener(){
  return new GLEventListener(){
    @Override public void init(    GLAutoDrawable drawable){
      try {
        GL gl=drawable.getGL();
        gl.setSwapInterval(0);
      }
 catch (      Exception e) {
        logWarning(logger,"String_Node_Str",e);
      }
    }
    @Override public void display(    GLAutoDrawable drawable){
      for (      GlimpseLayout layout : layoutManager.getLayoutList()) {
        layout.paintTo(getGlimpseContext());
      }
    }
    @Override public void reshape(    GLAutoDrawable drawable,    int x,    int y,    int width,    int height){
      for (      GlimpseLayout layout : layoutManager.getLayoutList()) {
        layout.layoutTo(getGlimpseContext());
      }
    }
    @Override public void dispose(    GLAutoDrawable drawable){
      for (      GlimpseLayout layout : layoutManager.getLayoutList()) {
        layout.dispose(getGlimpseContext());
      }
      for (      GLRunnable runnable : disposeListeners) {
        runnable.run(drawable.getContext());
      }
    }
  }
;
}

Fixed version (ground truth):
protected GLEventListener createGLEventListener(){
  return new GLEventListener(){
    @Override public void init(    GLAutoDrawable drawable){
      try {
        GL gl=drawable.getGL();
        gl.setSwapInterval(0);
      }
 catch (      Exception e) {
        logWarning(logger,"String_Node_Str",e);
      }
    }
    @Override public void display(    GLAutoDrawable drawable){
      for (      GlimpseLayout layout : layoutManager.getLayoutList()) {
        layout.paintTo(getGlimpseContext());
      }
    }
    @Override public void reshape(    GLAutoDrawable drawable,    int x,    int y,    int width,    int height){
      for (      GlimpseLayout layout : layoutManager.getLayoutList()) {
        layout.layoutTo(getGlimpseContext());
      }
    }
    @Override public void dispose(    GLAutoDrawable drawable){
      for (      GLRunnable runnable : disposeListeners) {
        runnable.run(drawable);
      }
    }
  }
;
}
Program: 11518
Project: 11518
Buggy source:
@Override public void dispose(){
  if (!isDisposed) {
    this.drawable.destroy();
    this.isDisposed=true;
  }
}

Fixed version (ground truth):
@Override public void dispose(GLAutoDrawable drawable){
  for (  GLRunnable runnable : disposeListeners) {
    runnable.run(drawable);
  }
}
Program: 11519
Project: 11519
Buggy source:
/** 
 * Called when the canvas is disposed. Can be used to clean up native resources used by this Canvas.
 */
public void addDisposeListener(GLRunnable runnable);

Fixed version (ground truth):
/** 
 * Called when   {@link GLEventListener#dispose(GLAutoDrawable)} event is fired by the {@link GLAutoDrawable} associated with theGlimpseCanvas. This can happen for reasons other than the window containing the GlimpseCanvas being closed (for example, moving the window between physical monitors or moving the container between docks in a docking framework). Thus, GlimpsePainters and GlimpseLayouts attached to this GlimpseCanvas should generally not be disposed when this callback occurs.
 */
public void addDisposeListener(GLRunnable runnable);
Program: 11520
Project: 11520
Buggy source:
protected void updateLayoutList(){
  Collections.sort(this.layoutList,this.comparator);
  ArrayList<GlimpseLayout> temp=Lists.newArrayListWithCapacity(this.layoutList.size());
  for (  LayoutOrder order : this.layoutList) {
    temp.add(order.getLayout());
  }
  this.unmodifiableLayoutList=Collections.unmodifiableList(temp);
}

Fixed version (ground truth):
protected void updateLayoutList(){
  Collections.sort(this.layoutList,this.comparator);
  ArrayList<GlimpseLayout> temp=Lists.newArrayListWithCapacity(this.layoutList.size());
  for (  LayoutOrder order : this.layoutList) {
    temp.add(order.getLayout());
  }
  this.unmodifiableLayoutList=Collections.unmodifiableList(Lists.newArrayList(temp));
}
Program: 11521
Project: 11521
Buggy source:
@Override public void mousePressed(GlimpseMouseEvent e){
  TimeStamp time=getTime(e);
  Set<EventSelection> tempEvents=Collections.unmodifiableSet(Sets.newHashSet(eventManager.getNearestEvents(e)));
  for (  EventPlotListener listener : eventListeners) {
    listener.eventsClicked(e,tempEvents,time);
  }
  EventSelection eventSelection=eventManager.getNearestEvent(tempEvents,e);
  if (eventSelection != null) {
    Event event=eventSelection.getEvent();
    if (event.isSelectable()) {
      if (e.isKeyDown(ModifierKey.Ctrl)) {
        if (selectionHandler.isEventSelected(event)) {
          selectionHandler.removeSelectedEvent(event);
        }
 else {
          selectionHandler.addSelectedEvent(event);
        }
      }
 else {
        selectionHandler.setSelectedEvents(Collections.singleton(event));
      }
    }
  }
 else   if (selectionHandler.isClearSelectionOnClick()) {
    selectionHandler.clearSelectedEvents();
  }
}

Fixed version (ground truth):
@Override public void mousePressed(GlimpseMouseEvent e){
  TimeStamp time=getTime(e);
  Set<EventSelection> tempEvents=Collections.unmodifiableSet(Sets.newHashSet(eventManager.getNearestEvents(e)));
  for (  EventPlotListener listener : eventListeners) {
    listener.eventsClicked(e,tempEvents,time);
  }
  EventSelection eventSelection=eventManager.getNearestEvent(tempEvents,e);
  if (eventSelection != null && selectionHandler.isAllowMouseEventSelection()) {
    Event event=eventSelection.getEvent();
    if (event.isSelectable()) {
      if (e.isKeyDown(ModifierKey.Ctrl) && selectionHandler.isAllowMultipleEventSelection()) {
        if (selectionHandler.isEventSelected(event)) {
          selectionHandler.removeSelectedEvent(event);
        }
 else {
          selectionHandler.addSelectedEvent(event);
        }
      }
 else {
        if (isDeselectSingleEvent(event)) {
          selectionHandler.setSelectedEvents(Collections.<Event>emptySet());
        }
 else {
          selectionHandler.setSelectedEvents(Collections.singleton(event));
        }
      }
    }
  }
 else   if (selectionHandler.isClearSelectionOnClick()) {
    selectionHandler.clearSelectedEvents();
  }
}
Program: 11522
Project: 11522
Buggy source:
public void setSelectedEvents(Set<Event> events){
  Set<Event> deselectedEvents=Sets.difference(selectedEvents,events).immutableCopy();
  Set<Event> newSelectedEvents=Sets.difference(events,selectedEvents).immutableCopy();
  selectedEvents.clear();
  selectedEvents.addAll(events);
  notifyEventsSelected(newSelectedEvents,deselectedEvents);
}

Fixed version (ground truth):
public void setSelectedEvents(Set<Event> events){
  if (events.equals(selectedEvents))   return;
  Set<Event> deselectedEvents=Sets.difference(selectedEvents,events).immutableCopy();
  Set<Event> newSelectedEvents=Sets.difference(events,selectedEvents).immutableCopy();
  selectedEvents.clear();
  selectedEvents.addAll(events);
  notifyEventsSelected(newSelectedEvents,deselectedEvents);
}
Program: 11523
Project: 11523
Buggy source:
@Override public void paintTo(GlimpseContext context){
  lock.lock();
  try {
    GlimpseBounds bounds=layoutTo(context);
    if (!isVisible)     return;
    context.getTargetStack().push(this,bounds);
    layoutDelegate.paintTo(context);
    context.getTargetStack().pop();
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
@Override public void paintTo(GlimpseContext context){
  lock.lock();
  try {
    GlimpseBounds bounds=layoutTo(context);
    context.getTargetStack().push(this,bounds);
    layoutDelegate.paintTo(context);
    context.getTargetStack().pop();
  }
  finally {
    lock.unlock();
  }
}
Program: 11524
Project: 11524
Buggy source:
public void paintTo(GlimpseContext context){
  GL gl=context.getGL();
  GlimpseBounds bounds=context.getTargetStack().getBounds();
  GlimpseBounds clippedBounds=getClippedBounds(context);
  if (!clippedBounds.isValid())   return;
  for (  Member m : memberList) {
    try {
      gl.glEnable(GL2.GL_SCISSOR_TEST);
      gl.glViewport(bounds.getX(),bounds.getY(),bounds.getWidth(),bounds.getHeight());
      gl.glScissor(clippedBounds.getX(),clippedBounds.getY(),clippedBounds.getWidth(),clippedBounds.getHeight());
      if (m.callback != null)       m.callback.prePaint(m.painter,context);
      m.painter.paintTo(context);
      if (m.callback != null)       m.callback.postPaint(m.painter,context);
    }
  finally {
      gl.glDisable(GL2.GL_SCISSOR_TEST);
    }
  }
}

Fixed version (ground truth):
public void paintTo(GlimpseContext context){
  GL gl=context.getGL();
  GlimpseBounds bounds=context.getTargetStack().getBounds();
  GlimpseBounds clippedBounds=getClippedBounds(context);
  if (!clippedBounds.isValid())   return;
  for (  Member m : memberList) {
    try {
      if (!(m.painter instanceof GlimpseLayout) && !layout.isVisible)       continue;
      gl.glEnable(GL2.GL_SCISSOR_TEST);
      gl.glViewport(bounds.getX(),bounds.getY(),bounds.getWidth(),bounds.getHeight());
      gl.glScissor(clippedBounds.getX(),clippedBounds.getY(),clippedBounds.getWidth(),clippedBounds.getHeight());
      if (m.callback != null)       m.callback.prePaint(m.painter,context);
      m.painter.paintTo(context);
      if (m.callback != null)       m.callback.postPaint(m.painter,context);
    }
  finally {
      gl.glDisable(GL2.GL_SCISSOR_TEST);
    }
  }
}
Program: 11525
Project: 11525
Buggy source:
public void add(V value){
  V oldValue=this.set.get(value);
  if (oldValue != null) {
    this.tree.remove(oldValue);
  }
  this.tree.add(value);
}

Fixed version (ground truth):
public void add(V value){
  V oldValue=this.map.get(value);
  if (oldValue != null) {
    this.tree.remove(oldValue);
  }
  this.tree.add(value);
  this.map.put(value,value);
}
Program: 11526
Project: 11526
Buggy source:
public Set<V> getAll(){
  return Collections.unmodifiableSet(this.set.keySet());
}

Fixed version (ground truth):
public Set<V> getAll(){
  return Collections.unmodifiableSet(this.map.keySet());
}
Program: 11527
Project: 11527
Buggy source:
public void clear(){
  this.tree=buildTree(maxBucketSize);
  this.set.clear();
}

Fixed version (ground truth):
public void clear(){
  this.tree=buildTree(maxBucketSize);
  this.map.clear();
}
Program: 11528
Project: 11528
Buggy source:
public void remove(V value){
  V oldValue=this.set.remove(value);
  if (oldValue != null) {
    this.tree.remove(oldValue);
  }
}

Fixed version (ground truth):
public void remove(V value){
  V oldValue=this.map.remove(value);
  if (oldValue != null) {
    this.tree.remove(oldValue);
  }
}
Program: 11529
Project: 11529
Buggy source:
public int size(){
  return this.set.size();
}

Fixed version (ground truth):
public int size(){
  return this.map.size();
}
Program: 11530
Project: 11530
Buggy source:
public IntervalQuadTree(int maxBucketSize){
  this.maxBucketSize=maxBucketSize;
  this.tree=buildTree(maxBucketSize);
  this.set=Maps.newHashMap();
}

Fixed version (ground truth):
public IntervalQuadTree(int maxBucketSize){
  this.maxBucketSize=maxBucketSize;
  this.tree=buildTree(maxBucketSize);
  this.map=Maps.newHashMap();
}
Program: 11531
Project: 11531
Buggy source:
/** 
 * The spacing between the bottom (descent) of one line of text to the top (ascent) of the next line.
 */
public float getLineSpacing(){
  return lineSpacing;
}

Fixed version (ground truth):
/** 
 * The spacing between the bottom (descent) of one line of text to the top (ascent) of the next line.
 */
public synchronized float getLineSpacing(){
  return lineSpacing;
}
Program: 11533
Project: 11533
Buggy source:
public int getBorderSize(){
  return this.borderSize;
}

Fixed version (ground truth):
public synchronized int getBorderSize(){
  return this.borderSize;
}