nus-yam/ex-repair huggingface dataset:
Program: 108374
Project: 108374
Buggy source:
/** 
 * Tests the result
 * @param testcase 
 * @param result
 */
private void checkResult(ARXUtilityMetricsTestCase testcase,ARXResult result){
  checkLattice(result.getLattice());
  for (  ARXNode[] level : result.getLattice().getLevels()) {
    for (    ARXNode node : level) {
      String label=Arrays.toString(node.getTransformation());
      if (testcase.informationLoss.containsKey(label)) {
        if (node.getMaximumInformationLoss().compareTo(node.getMinimumInformationLoss()) != 0) {
          checkTransformation(testcase,result,node);
          checkLattice(result.getLattice());
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Tests the result
 * @param testcase 
 * @param result
 */
private void checkResult(ARXUtilityMetricsTestCase testcase,ARXResult result){
  checkLattice(result.getLattice());
  for (  ARXNode[] level : result.getLattice().getLevels()) {
    for (    ARXNode node : level) {
      String label=Arrays.toString(node.getTransformation());
      if (testcase.informationLoss.containsKey(label)) {
        if (compareWithTolerance(node.getMaximumInformationLoss(),node.getMinimumInformationLoss()) != 0) {
          checkTransformation(testcase,result,node);
          checkLattice(result.getLattice());
        }
      }
    }
  }
}
Program: 108375
Project: 108375
Buggy source:
@Override protected void initializeInternal(DataDefinition definition,Data input,GeneralizationHierarchy[] hierarchies,ARXConfiguration config){
  super.initializeInternal(definition,input,hierarchies,config);
  RowSet subset=null;
  if (config.containsCriterion(DPresence.class)) {
    Set<DPresence> criterion=config.getCriteria(DPresence.class);
    if (criterion.size() > 1) {
      throw new IllegalArgumentException("String_Node_Str");
    }
    subset=criterion.iterator().next().getSubset().getSet();
  }
  this.cardinalities=new Cardinalities(input,subset,hierarchies);
  cache=new double[hierarchies.length][];
  for (int i=0; i < cache.length; i++) {
    cache[i]=new double[hierarchies[i].getArray()[0].length];
    Arrays.fill(cache[i],NOT_AVAILABLE);
  }
  final int[][] data=input.getArray();
  this.hierarchies=new int[data[0].length][][];
  for (int i=0; i < hierarchies.length; i++) {
    this.hierarchies[i]=hierarchies[i].getArray();
  }
}

Fixed version (ground truth):
@Override protected void initializeInternal(DataDefinition definition,Data input,GeneralizationHierarchy[] hierarchies,ARXConfiguration config){
  super.initializeInternal(definition,input,hierarchies,config);
  RowSet subset=null;
  if (config.containsCriterion(DPresence.class)) {
    Set<DPresence> criterion=config.getCriteria(DPresence.class);
    if (criterion.size() > 1) {
      throw new IllegalArgumentException("String_Node_Str");
    }
    subset=criterion.iterator().next().getSubset().getSet();
  }
  this.cardinalities=new Cardinalities(input,subset,hierarchies);
  cache=new double[hierarchies.length][];
  for (int i=0; i < cache.length; i++) {
    cache[i]=new double[hierarchies[i].getArray()[0].length];
    Arrays.fill(cache[i],NOT_AVAILABLE);
  }
  final int[][] data=input.getArray();
  this.hierarchies=new int[data[0].length][][];
  for (int i=0; i < hierarchies.length; i++) {
    this.hierarchies[i]=hierarchies[i].getArray();
  }
  double[] min=new double[hierarchies.length];
  Arrays.fill(min,0d);
  double[] max=new double[hierarchies.length];
  Arrays.fill(max,Double.MAX_VALUE / hierarchies.length);
  super.setMax(max);
  super.setMin(min);
}
Program: 108376
Project: 108376
Buggy source:
@Override public InformationLossDefault getLowerBound(Node node,IHashGroupify groupify){
  if (node.getLowerBound() != null) {
    return (InformationLossDefault)node.getLowerBound();
  }
  double lowerBound=0d;
  HashGroupifyEntry m=groupify.getFirstEntry();
  while (m != null) {
    if (m.count > 0) {
      for (int i=0; i < height.length; i++) {
        lowerBound+=height[i] == 0 ? 0 : (double)m.key[i] / (double)height[i];
      }
    }
    m=m.nextOrdered;
  }
  lowerBound/=cells;
  return new InformationLossDefault(lowerBound);
}

Fixed version (ground truth):
@Override public InformationLossDefault getLowerBound(Node node,IHashGroupify groupify){
  if (node.getLowerBound() != null) {
    return (InformationLossDefault)node.getLowerBound();
  }
  double lowerBound=0d;
  HashGroupifyEntry m=groupify.getFirstEntry();
  while (m != null) {
    if (m.count > 0) {
      for (int i=0; i < height.length; i++) {
        lowerBound+=m.count * (height[i] == 0 ? 0 : (double)m.key[i] / (double)height[i]);
      }
    }
    m=m.nextOrdered;
  }
  lowerBound/=cells;
  return new InformationLossDefault(lowerBound);
}
Program: 108377
Project: 108377
Buggy source:
@Override protected BoundInformationLoss<InformationLossDefault> evaluateInternal(final Node node,final IHashGroupify g){
  double total=0d;
  double lowerBound=0d;
  HashGroupifyEntry m=g.getFirstEntry();
  while (m != null) {
    if (m.count > 0) {
      for (int i=0; i < height.length; i++) {
        total+=m.isNotOutlier ? (height[i] == 0 ? 0 : (double)m.key[i] / (double)height[i]) : 1d;
        lowerBound+=height[i] == 0 ? 0 : (double)m.key[i] / (double)height[i];
      }
    }
    m=m.nextOrdered;
  }
  total/=cells;
  lowerBound/=cells;
  return new BoundInformationLossDefault(total,lowerBound);
}

Fixed version (ground truth):
@Override protected BoundInformationLoss<InformationLossDefault> evaluateInternal(final Node node,final IHashGroupify g){
  double total=0d;
  double lowerBound=0d;
  HashGroupifyEntry m=g.getFirstEntry();
  while (m != null) {
    if (m.count > 0) {
      for (int i=0; i < height.length; i++) {
        total+=m.count * (m.isNotOutlier ? (height[i] == 0 ? 0 : (double)m.key[i] / (double)height[i]) : 1d);
        lowerBound+=m.count * (height[i] == 0 ? 0 : (double)m.key[i] / (double)height[i]);
      }
    }
    m=m.nextOrdered;
  }
  total/=cells;
  lowerBound/=cells;
  return new BoundInformationLossDefault(total,lowerBound);
}
Program: 108378
Project: 108378
Buggy source:
@Override protected BoundInformationLoss<InformationLossDefault> evaluateInternal(final Node node,final IHashGroupify g){
  int suppressedTuples=0;
  int unsuppressedTuples=0;
  HashGroupifyEntry m=g.getFirstEntry();
  while (m != null) {
    unsuppressedTuples+=m.isNotOutlier ? m.count : 0;
    suppressedTuples+=m.isNotOutlier ? 0 : m.count;
    m=m.nextOrdered;
  }
  double precision=0;
  double lowerBound=0;
  for (int i=0; i < height.length; i++) {
    double weight=weights != null ? weights[i] : 1d;
    double value=height[i] == 0 ? 0 : (double)node.getTransformation()[i] / (double)height[i];
    precision+=(double)unsuppressedTuples * value * weight;
    precision+=(double)suppressedTuples * 1d * weight;
    lowerBound+=(double)unsuppressedTuples * value * weight;
  }
  precision/=cells;
  lowerBound/=cells;
  return new BoundInformationLossDefault(precision,lowerBound);
}

Fixed version (ground truth):
@Override protected BoundInformationLoss<InformationLossDefault> evaluateInternal(final Node node,final IHashGroupify g){
  int suppressedTuples=0;
  int unsuppressedTuples=0;
  HashGroupifyEntry m=g.getFirstEntry();
  while (m != null) {
    unsuppressedTuples+=m.isNotOutlier ? m.count : 0;
    suppressedTuples+=m.isNotOutlier ? 0 : m.count;
    m=m.nextOrdered;
  }
  double precision=0;
  for (int i=0; i < height.length; i++) {
    double weight=weights != null ? weights[i] : 1d;
    double value=height[i] == 0 ? 0 : (double)node.getTransformation()[i] / (double)height[i];
    precision+=(double)unsuppressedTuples * value * weight;
    precision+=(double)suppressedTuples * 1d * weight;
  }
  precision/=cells;
  return new BoundInformationLossDefault(precision,getLowerBound(node).getValue());
}
Program: 108380
Project: 108380
Buggy source:
@Override protected void initializeInternal(final DataDefinition definition,final Data input,final GeneralizationHierarchy[] hierarchies,final ARXConfiguration config){
  super.initializeInternal(definition,input,hierarchies,config);
  height=new int[hierarchies.length];
  for (int j=0; j < height.length; j++) {
    height[j]=hierarchies[j].getArray()[0].length - 1;
  }
  this.cells=(double)input.getDataLength() * (double)input.getHeader().length;
}

Fixed version (ground truth):
@Override protected void initializeInternal(final DataDefinition definition,final Data input,final GeneralizationHierarchy[] hierarchies,final ARXConfiguration config){
  super.initializeInternal(definition,input,hierarchies,config);
  height=new int[hierarchies.length];
  for (int j=0; j < height.length; j++) {
    height[j]=hierarchies[j].getArray()[0].length - 1;
  }
  int rowCount=0;
  if (config.containsCriterion(DPresence.class)) {
    Set<DPresence> crits=config.getCriteria(DPresence.class);
    if (crits.size() > 1) {
      throw new IllegalArgumentException("String_Node_Str");
    }
    for (    DPresence dPresence : crits) {
      rowCount=dPresence.getSubset().getArray().length;
    }
  }
 else {
    rowCount=input.getDataLength();
  }
  this.cells=(double)rowCount * (double)input.getHeader().length;
}
Program: 108381
Project: 108381
Buggy source:
@Override public InformationLossDefault getLowerBound(Node node,IHashGroupify groupify){
  if (node.getLowerBound() != null) {
    return (InformationLossDefault)node.getLowerBound();
  }
  double lowerBound=0d;
  HashGroupifyEntry m=groupify.getFirstEntry();
  while (m != null) {
    if (m.count > 0) {
      double factor=0;
      for (int i=0; i < height.length; i++) {
        factor+=height[i] == 0 ? 0 : (double)m.key[i] / (double)height[i];
      }
      lowerBound+=m.count * factor;
    }
    m=m.nextOrdered;
  }
  lowerBound/=cells;
  return new InformationLossDefault(lowerBound);
}

Fixed version (ground truth):
@Override public InformationLossDefault getLowerBound(Node node,IHashGroupify groupify){
  return getLowerBound(node);
}
Program: 108382
Project: 108382
Buggy source:
@Override protected BoundInformationLoss<InformationLossDefault> evaluateInternal(final Node node,final IHashGroupify g){
  double total=0d;
  double lowerBound=0d;
  HashGroupifyEntry m=g.getFirstEntry();
  while (m != null) {
    if (m.count > 0) {
      double factor=0d;
      double factorLowerBound=0d;
      for (int i=0; i < height.length; i++) {
        factor+=m.isNotOutlier ? (height[i] == 0 ? 0 : (double)m.key[i] / (double)height[i]) : 1d;
        factorLowerBound+=height[i] == 0 ? 0 : (double)m.key[i] / (double)height[i];
      }
      lowerBound+=m.count * factorLowerBound;
      total+=m.count * factor;
    }
    m=m.nextOrdered;
  }
  total/=cells;
  lowerBound/=cells;
  return new BoundInformationLossDefault(total,lowerBound);
}

Fixed version (ground truth):
@Override protected BoundInformationLoss<InformationLossDefault> evaluateInternal(final Node node,final IHashGroupify g){
  int suppressedTuples=0;
  int unsuppressedTuples=0;
  HashGroupifyEntry m=g.getFirstEntry();
  while (m != null) {
    unsuppressedTuples+=m.isNotOutlier ? m.count : 0;
    suppressedTuples+=m.isNotOutlier ? 0 : m.count;
    m=m.nextOrdered;
  }
  double precision=0;
  double lowerBound=0;
  for (int i=0; i < height.length; i++) {
    double weight=weights != null ? weights[i] : 1d;
    double value=height[i] == 0 ? 0 : (double)node.getTransformation()[i] / (double)height[i];
    precision+=(double)unsuppressedTuples * value * weight;
    precision+=(double)suppressedTuples * 1d * weight;
    lowerBound+=(double)unsuppressedTuples * value * weight;
  }
  precision/=cells;
  lowerBound/=cells;
  return new BoundInformationLossDefault(precision,lowerBound);
}
Program: 108383
Project: 108383
Buggy source:
@Override public InformationLossDefault getLowerBound(Node node,IHashGroupify groupify){
  if (node.getLowerBound() != null) {
    return (InformationLossDefault)node.getLowerBound();
  }
  double lowerBound=0d;
  HashGroupifyEntry m=groupify.getFirstEntry();
  while (m != null) {
    if (m.count > 0) {
      for (int i=0; i < height.length; i++) {
        lowerBound+=m.count * (height[i] == 0 ? 0 : (double)m.key[i] / (double)height[i]);
      }
    }
    m=m.nextOrdered;
  }
  lowerBound/=cells;
  return new InformationLossDefault(lowerBound);
}

Fixed version (ground truth):
@Override public InformationLossDefault getLowerBound(Node node,IHashGroupify groupify){
  if (node.getLowerBound() != null) {
    return (InformationLossDefault)node.getLowerBound();
  }
  double lowerBound=0d;
  HashGroupifyEntry m=groupify.getFirstEntry();
  while (m != null) {
    if (m.count > 0) {
      double factor=0;
      for (int i=0; i < height.length; i++) {
        factor+=height[i] == 0 ? 0 : (double)m.key[i] / (double)height[i];
      }
      lowerBound+=m.count * factor;
    }
    m=m.nextOrdered;
  }
  lowerBound/=cells;
  return new InformationLossDefault(lowerBound);
}
Program: 108384
Project: 108384
Buggy source:
@Override protected BoundInformationLoss<InformationLossDefault> evaluateInternal(final Node node,final IHashGroupify g){
  double total=0d;
  double lowerBound=0d;
  HashGroupifyEntry m=g.getFirstEntry();
  while (m != null) {
    if (m.count > 0) {
      for (int i=0; i < height.length; i++) {
        total+=m.count * (m.isNotOutlier ? (height[i] == 0 ? 0 : (double)m.key[i] / (double)height[i]) : 1d);
        lowerBound+=m.count * (height[i] == 0 ? 0 : (double)m.key[i] / (double)height[i]);
      }
    }
    m=m.nextOrdered;
  }
  total/=cells;
  lowerBound/=cells;
  return new BoundInformationLossDefault(total,lowerBound);
}

Fixed version (ground truth):
@Override protected BoundInformationLoss<InformationLossDefault> evaluateInternal(final Node node,final IHashGroupify g){
  double total=0d;
  double lowerBound=0d;
  HashGroupifyEntry m=g.getFirstEntry();
  while (m != null) {
    if (m.count > 0) {
      double factor=0d;
      double factorLowerBound=0d;
      for (int i=0; i < height.length; i++) {
        factor+=m.isNotOutlier ? (height[i] == 0 ? 0 : (double)m.key[i] / (double)height[i]) : 1d;
        factorLowerBound+=height[i] == 0 ? 0 : (double)m.key[i] / (double)height[i];
      }
      lowerBound+=m.count * factorLowerBound;
      total+=m.count * factor;
    }
    m=m.nextOrdered;
  }
  total/=cells;
  lowerBound/=cells;
  return new BoundInformationLossDefault(total,lowerBound);
}
Program: 108385
Project: 108385
Buggy source:
private void checkScrollBars(){
  if (context.getTable().isDisposed()) {
    return;
  }
  Listener[] listeners=context.getTable().getListeners(SWT.Resize);
  for (  Listener listener : listeners) {
    context.getTable().removeListener(SWT.Resize,listener);
  }
  if (context.isColumnExpanded()) {
    context.getTable().getHorizontalBar().setVisible(true);
    context.getTable().getHorizontalBar().setValues(0,0,1,1,1,1);
    context.getTable().getHorizontalBar().setEnabled(false);
  }
  if (context.isRowExpanded()) {
    context.getTable().getVerticalBar().setVisible(true);
    context.getTable().getVerticalBar().setValues(0,0,1,1,1,1);
    context.getTable().getVerticalBar().setEnabled(false);
  }
  for (  Listener listener : listeners) {
    context.getTable().addListener(SWT.Resize,listener);
  }
}

Fixed version (ground truth):
private void checkScrollBars(){
  if (context.getTable().isDisposed()) {
    return;
  }
  Listener[] listeners=null;
  if (context.getTable() != null && !context.getTable().isDisposed()) {
    listeners=context.getTable().getListeners(SWT.Resize);
    for (    Listener listener : listeners) {
      context.getTable().removeListener(SWT.Resize,listener);
    }
  }
  if (context.isColumnExpanded()) {
    context.getTable().getHorizontalBar().setVisible(true);
    context.getTable().getHorizontalBar().setValues(0,0,1,1,1,1);
    context.getTable().getHorizontalBar().setEnabled(false);
  }
  if (context.isRowExpanded()) {
    context.getTable().getVerticalBar().setVisible(true);
    context.getTable().getVerticalBar().setValues(0,0,1,1,1,1);
    context.getTable().getVerticalBar().setEnabled(false);
  }
  if (context.getTable() != null && !context.getTable().isDisposed()) {
    for (    Listener listener : listeners) {
      context.getTable().addListener(SWT.Resize,listener);
    }
  }
}
Program: 108386
Project: 108386
Buggy source:
@Override public boolean doCommand(ILayerCommand command){
  context.getTable().getHorizontalBar().getParent().setRedraw(false);
  context.getTable().getVerticalBar().getParent().setRedraw(false);
  boolean result=super.doCommand(command);
  if (command instanceof ClientAreaResizeCommand) {
    checkScrollBars();
  }
 else   if (command instanceof RecalculateScrollBarsCommand) {
    checkScrollBars();
  }
 else   if (command instanceof StructuralRefreshCommand) {
    checkScrollBars();
  }
  context.getTable().getHorizontalBar().getParent().setRedraw(true);
  context.getTable().getVerticalBar().getParent().setRedraw(true);
  return result;
}

Fixed version (ground truth):
@Override public boolean doCommand(ILayerCommand command){
  if (context.getTable() != null && !context.getTable().isDisposed()) {
    context.getTable().getHorizontalBar().getParent().setRedraw(false);
    context.getTable().getVerticalBar().getParent().setRedraw(false);
  }
  boolean result=super.doCommand(command);
  if (command instanceof ClientAreaResizeCommand) {
    checkScrollBars();
  }
 else   if (command instanceof RecalculateScrollBarsCommand) {
    checkScrollBars();
  }
 else   if (command instanceof StructuralRefreshCommand) {
    checkScrollBars();
  }
  if (context.getTable() != null && !context.getTable().isDisposed()) {
    context.getTable().getHorizontalBar().getParent().setRedraw(true);
    context.getTable().getVerticalBar().getParent().setRedraw(true);
  }
  return result;
}
Program: 108387
Project: 108387
Buggy source:
/** 
 * We may be able to prune some transformations based on weak lower bounds on the monotonic share of a node's information loss
 * @param node
 */
private void prune(Node node){
  if (node.getInformationLoss() == null || node.getLowerBound() == null) {
    return;
  }
  if (node.hasProperty(Node.PROPERTY_SUCCESSORS_PRUNED)) {
    return;
  }
  if (super.getGlobalOptimum() == null) {
    pruningCandidates.add(node);
    return;
  }
  Node optimalTransformation=getGlobalOptimum();
  InformationLoss<?> optimalInfoLoss=optimalTransformation.getInformationLoss();
  if (node != optimalTransformation) {
    if (optimalInfoLoss.compareTo(node.getLowerBound()) <= 0) {
      lattice.setPropertyUpwards(node,true,Node.PROPERTY_INSUFFICIENT_UTILITY | Node.PROPERTY_SUCCESSORS_PRUNED);
    }
 else {
      pruningCandidates.add(node);
    }
  }
 else {
    Iterator<Node> iterator=pruningCandidates.iterator();
    while (iterator.hasNext()) {
      Node current=iterator.next();
      if (current.hasProperty(Node.PROPERTY_SUCCESSORS_PRUNED)) {
        iterator.remove();
      }
 else       if (optimalInfoLoss.compareTo(current.getLowerBound()) <= 0) {
        lattice.setPropertyUpwards(current,true,Node.PROPERTY_INSUFFICIENT_UTILITY | Node.PROPERTY_SUCCESSORS_PRUNED);
        iterator.remove();
      }
    }
    pruningCandidates.add(node);
  }
}

Fixed version (ground truth):
/** 
 * We may be able to prune some transformations based on weak lower bounds on the monotonic share of a node's information loss
 * @param node
 */
private void prune(Node node){
  if (node.getLowerBound() == null) {
    return;
  }
  if (node.hasProperty(Node.PROPERTY_SUCCESSORS_PRUNED)) {
    return;
  }
  if (super.getGlobalOptimum() == null) {
    pruningCandidates.add(node);
    return;
  }
  Node optimalTransformation=getGlobalOptimum();
  InformationLoss<?> optimalInfoLoss=optimalTransformation.getInformationLoss();
  if (node != optimalTransformation) {
    if (optimalInfoLoss.compareTo(node.getLowerBound()) <= 0) {
      lattice.setPropertyUpwards(node,true,Node.PROPERTY_INSUFFICIENT_UTILITY | Node.PROPERTY_SUCCESSORS_PRUNED);
    }
 else {
      pruningCandidates.add(node);
    }
  }
 else {
    Iterator<Node> iterator=pruningCandidates.iterator();
    while (iterator.hasNext()) {
      Node current=iterator.next();
      if (current.hasProperty(Node.PROPERTY_SUCCESSORS_PRUNED)) {
        iterator.remove();
      }
 else       if (optimalInfoLoss.compareTo(current.getLowerBound()) <= 0) {
        lattice.setPropertyUpwards(current,true,Node.PROPERTY_INSUFFICIENT_UTILITY | Node.PROPERTY_SUCCESSORS_PRUNED);
        iterator.remove();
      }
    }
    pruningCandidates.add(node);
  }
}
Program: 108388
Project: 108388
Buggy source:
/** 
 * Analyze
 */
private void analyzeAll(){
  boolean dpresent=true;
  currentOutliers=0;
  HashGroupifyEntry entry=firstEntry;
  while (entry != null) {
    int anonymous=isAnonymous(entry);
    if (anonymous != -1) {
      if (dpresence && entry.count == 0 && anonymous == 1) {
        dpresent=false;
      }
      currentOutliers+=entry.count;
    }
    entry.isNotOutlier=entry.count != 0 ? (anonymous == -1) : true;
    entry=entry.nextOrdered;
  }
  this.anonymous=(currentOutliers <= absoluteMaxOutliers) && dpresent;
}

Fixed version (ground truth):
/** 
 * Analyze
 */
private void analyzeAll(){
  kAnonymous=(currentOutliers <= absoluteMaxOutliers);
  boolean dpresent=true;
  currentOutliers=0;
  HashGroupifyEntry entry=firstEntry;
  while (entry != null) {
    int anonymous=isAnonymous(entry);
    if (anonymous != -1) {
      if (dpresence && entry.count == 0 && anonymous == 1) {
        dpresent=false;
      }
      currentOutliers+=entry.count;
    }
    entry.isNotOutlier=entry.count != 0 ? (anonymous == -1) : true;
    entry=entry.nextOrdered;
  }
  this.anonymous=(currentOutliers <= absoluteMaxOutliers) && dpresent;
}
Program: 108389
Project: 108389
Buggy source:
@Override protected void initializeInternal(final DataDefinition definition,final Data input,final GeneralizationHierarchy[] hierarchies,final ARXConfiguration config){
  super.initializeInternal(definition,input,hierarchies,config);
  maxLevels=new int[hierarchies.length];
  for (int j=0; j < maxLevels.length; j++) {
    maxLevels[j]=hierarchies[j].getArray()[0].length;
  }
}

Fixed version (ground truth):
@Override protected void initializeInternal(final DataDefinition definition,final Data input,final GeneralizationHierarchy[] hierarchies,final ARXConfiguration config){
  super.initializeInternal(definition,input,hierarchies,config);
  height=new int[hierarchies.length];
  for (int j=0; j < height.length; j++) {
    height[j]=hierarchies[j].getArray()[0].length - 1;
  }
}
Program: 108390
Project: 108390
Buggy source:
protected MetricPrecision(){
  super(true,true);
}

Fixed version (ground truth):
/** 
 * Creates a new instance
 */
protected MetricPrecision(){
  super(true,true);
}
Program: 108391
Project: 108391
Buggy source:
@Override protected InformationLossDefault evaluateInternal(final Node node,final IHashGroupify g){
  double value=0;
  double divisor=0;
  final int[] state=node.getTransformation();
  for (int i=0; i < state.length; i++) {
    divisor++;
    double weight=weights != null ? weights[i] : 1d;
    value+=((double)state[i] / (double)maxLevels[i]) * weight;
  }
  return new InformationLossDefault(value / divisor,value / divisor);
}

Fixed version (ground truth):
@Override protected InformationLossDefault evaluateInternal(final Node node,final IHashGroupify g){
  double result=0;
  final int[] transformation=node.getTransformation();
  for (int i=0; i < transformation.length; i++) {
    double weight=weights != null ? weights[i] : 1d;
    double level=(double)transformation[i];
    result+=height[i] == 0 ? 0 : (level / (double)height[i]) * weight;
  }
  result/=(double)transformation.length;
  return new InformationLossDefault(result,result);
}
Program: 108392
Project: 108392
Buggy source:
/** 
 * Estimates minimal information loss
 */
private void estimateNonMonotonicLoss(){
  InformationLoss<?> min=null;
  InformationLoss<?> max=null;
  for (int i=0; i < levels.length; i++) {
    final ARXNode[] level=levels[i];
    for (    final ARXNode node : level) {
      InformationLoss<?> nodeMin=node.getMinimumInformationLoss();
      InformationLoss<?> nodeMax=node.getMaximumInformationLoss();
      if (nodeMin != null && nodeMin.equals(nodeMax)) {
        if (min == null || min.compareTo(nodeMin) > 0) {
          min=nodeMin.clone();
        }
        if (max == null || max.compareTo(nodeMax) < 0) {
          max=nodeMax.clone();
        }
      }
    }
  }
  for (int i=0; i < levels.length; i++) {
    final ARXNode[] level=levels[i];
    for (    final ARXNode node : level) {
      if (node.minInformationLoss == null) {
        node.minInformationLoss=min.clone();
      }
      if (node.maxInformationLoss == null) {
        node.maxInformationLoss=max.clone();
      }
    }
  }
  this.minimumInformationLoss=min.clone();
  this.maximumInformationLoss=max.clone();
}

Fixed version (ground truth):
/** 
 * Estimates minimal information loss
 */
private void estimateNonMonotonicLoss(){
  InformationLoss<?> min=null;
  InformationLoss<?> max=null;
  for (int i=0; i < levels.length; i++) {
    final ARXNode[] level=levels[i];
    for (    final ARXNode node : level) {
      InformationLoss<?> nodeMin=node.getMinimumInformationLoss();
      InformationLoss<?> nodeMax=node.getMaximumInformationLoss();
      if (nodeMin != null && nodeMin.equals(nodeMax)) {
        if (min == null || min.compareTo(nodeMin) > 0) {
          min=nodeMin.clone();
        }
        if (max == null || max.compareTo(nodeMax) < 0) {
          max=nodeMax.clone();
        }
      }
    }
  }
  if (min == null)   min=metric.createMinInformationLoss();
  if (max == null)   max=metric.createMaxInformationLoss();
  for (int i=0; i < levels.length; i++) {
    final ARXNode[] level=levels[i];
    for (    final ARXNode node : level) {
      if (node.minInformationLoss == null) {
        node.minInformationLoss=min.clone();
      }
      if (node.maxInformationLoss == null) {
        node.maxInformationLoss=max.clone();
      }
    }
  }
  this.minimumInformationLoss=min.clone();
  this.maximumInformationLoss=max.clone();
}
Program: 108393
Project: 108393
Buggy source:
/** 
 * We may be able to prune some transformations based on weak lower bounds on the monotonic share of a node's information loss
 * @param node
 */
private void prune(Node node){
  if (node.getInformationLoss().getLowerBound() == null) {
    return;
  }
  if (node.hasProperty(Node.PROPERTY_SUCCESSORS_PRUNED)) {
    return;
  }
  if (super.getGlobalOptimum() == null) {
    pruningCandidates.add(node);
    return;
  }
  Node optimalTransformation=getGlobalOptimum();
  InformationLoss<?> optimalInfoLoss=optimalTransformation.getInformationLoss();
  if (node != optimalTransformation) {
    if (optimalInfoLoss.compareTo(node.getInformationLoss().getLowerBound()) <= 0) {
      lattice.setPropertyUpwards(node,true,Node.PROPERTY_INSUFFICIENT_UTILITY | Node.PROPERTY_SUCCESSORS_PRUNED);
    }
 else {
      pruningCandidates.add(node);
    }
  }
 else {
    Iterator<Node> iterator=pruningCandidates.iterator();
    while (iterator.hasNext()) {
      Node current=iterator.next();
      if (current.hasProperty(Node.PROPERTY_SUCCESSORS_PRUNED)) {
        iterator.remove();
      }
 else       if (optimalInfoLoss.compareTo(current.getInformationLoss().getLowerBound()) <= 0) {
        lattice.setPropertyUpwards(current,true,Node.PROPERTY_INSUFFICIENT_UTILITY | Node.PROPERTY_SUCCESSORS_PRUNED);
        iterator.remove();
      }
    }
    pruningCandidates.add(node);
  }
}

Fixed version (ground truth):
/** 
 * We may be able to prune some transformations based on weak lower bounds on the monotonic share of a node's information loss
 * @param node
 */
private void prune(Node node){
  if (node.getInformationLoss() == null || node.getInformationLoss().getLowerBound() == null) {
    return;
  }
  if (node.hasProperty(Node.PROPERTY_SUCCESSORS_PRUNED)) {
    return;
  }
  if (super.getGlobalOptimum() == null) {
    pruningCandidates.add(node);
    return;
  }
  Node optimalTransformation=getGlobalOptimum();
  InformationLoss<?> optimalInfoLoss=optimalTransformation.getInformationLoss();
  if (node != optimalTransformation) {
    if (optimalInfoLoss.compareTo(node.getInformationLoss().getLowerBound()) <= 0) {
      lattice.setPropertyUpwards(node,true,Node.PROPERTY_INSUFFICIENT_UTILITY | Node.PROPERTY_SUCCESSORS_PRUNED);
    }
 else {
      pruningCandidates.add(node);
    }
  }
 else {
    Iterator<Node> iterator=pruningCandidates.iterator();
    while (iterator.hasNext()) {
      Node current=iterator.next();
      if (current.hasProperty(Node.PROPERTY_SUCCESSORS_PRUNED)) {
        iterator.remove();
      }
 else       if (optimalInfoLoss.compareTo(current.getInformationLoss().getLowerBound()) <= 0) {
        lattice.setPropertyUpwards(current,true,Node.PROPERTY_INSUFFICIENT_UTILITY | Node.PROPERTY_SUCCESSORS_PRUNED);
        iterator.remove();
      }
    }
    pruningCandidates.add(node);
  }
}
Program: 108394
Project: 108394
Buggy source:
/** 
 * Creates a new instance
 * @param lowerBound
 * @param informationLoss
 */
public BoundInformationLossDefault(double lowerBound,double informationLoss){
  super(new InformationLossDefault(lowerBound),new InformationLossDefault(informationLoss));
}

Fixed version (ground truth):
/** 
 * Creates a new instance
 * @param informationLoss
 * @param lowerBound
 */
public BoundInformationLossDefault(double informationLoss,double lowerBound){
  super(new InformationLossDefault(lowerBound),new InformationLossDefault(informationLoss));
}
Program: 108395
Project: 108395
Buggy source:
/** 
 * Checks a path binary.
 * @param path The path
 * @param queue 
 */
private Node checkPath(List<Node> path,NodeAction triggerSkip,PriorityQueue<Node> queue){
  int anonymityProperty=config.getBinaryPhaseConfiguration().getAnonymityProperty();
  int low=0;
  int high=path.size() - 1;
  Node lastAnonymousNode=null;
  while (low <= high) {
    final int mid=(low + high) >>> 1;
    final Node node=path.get(mid);
    if (!skip(triggerSkip,node)) {
      checkAndTag(node,config.getBinaryPhaseConfiguration());
      if (!node.hasProperty(anonymityProperty)) {
        for (        final Node up : node.getSuccessors()) {
          if (!skip(triggerSkip,up)) {
            queue.add(up);
          }
        }
      }
      if (node.hasProperty(anonymityProperty)) {
        lastAnonymousNode=node;
        high=mid - 1;
      }
 else {
        low=mid + 1;
      }
    }
  }
  return lastAnonymousNode;
}

Fixed version (ground truth):
/** 
 * Checks a path binary.
 * @param path The path
 * @param queue 
 */
private Node checkPath(List<Node> path,NodeAction triggerSkip,PriorityQueue<Node> queue){
  int anonymityProperty=config.getBinaryPhaseConfiguration().getAnonymityProperty();
  int low=0;
  int high=path.size() - 1;
  Node lastAnonymousNode=null;
  while (low <= high) {
    final int mid=(low + high) / 2;
    final Node node=path.get(mid);
    if (!skip(triggerSkip,node)) {
      checkAndTag(node,config.getBinaryPhaseConfiguration());
      if (!node.hasProperty(anonymityProperty)) {
        for (        final Node up : node.getSuccessors()) {
          if (!skip(triggerSkip,up)) {
            queue.add(up);
          }
        }
      }
      if (node.hasProperty(anonymityProperty)) {
        lastAnonymousNode=node;
        high=mid - 1;
      }
 else {
        low=mid + 1;
      }
    }
 else {
      high=mid - 1;
    }
  }
  return lastAnonymousNode;
}
Program: 108396
Project: 108396
Buggy source:
/** 
 * Constructs a new hash groupify operator
 * @param capacity The capacity
 * @param config The config
 */
public HashGroupify(int capacity,final ARXConfiguration config){
  capacity=HashTableUtil.calculateCapacity(capacity);
  this.elementCount=0;
  this.buckets=new HashGroupifyEntry[capacity];
  this.threshold=HashTableUtil.calculateThreshold(buckets.length,loadFactor);
  this.currentOutliers=0;
  this.absoluteMaxOutliers=config.getAbsoluteMaxOutliers();
  if (config.containsCriterion(DPresence.class)) {
    this.subset=config.getCriterion(DPresence.class).getSubset().getSet();
  }
 else {
    this.subset=null;
  }
  this.criteria=config.getCriteriaAsArray();
  this.k=config.getMinimalGroupSize();
}

Fixed version (ground truth):
/** 
 * Constructs a new hash groupify operator
 * @param capacity The capacity
 * @param config The config
 */
public HashGroupify(int capacity,final ARXConfiguration config){
  capacity=HashTableUtil.calculateCapacity(capacity);
  this.elementCount=0;
  this.buckets=new HashGroupifyEntry[capacity];
  this.threshold=HashTableUtil.calculateThreshold(buckets.length,loadFactor);
  this.currentOutliers=0;
  this.absoluteMaxOutliers=config.getAbsoluteMaxOutliers();
  if (config.containsCriterion(DPresence.class)) {
    this.subset=config.getCriterion(DPresence.class).getSubset().getSet();
  }
 else {
    this.subset=null;
  }
  this.criteria=config.getCriteriaAsArray();
  this.k=config.getMinimalGroupSize();
  for (int i=1; i < criteria.length; i++) {
    if (criteria[i] instanceof DPresence) {
      throw new RuntimeException("String_Node_Str");
    }
  }
  dpresence=(criteria.length > 0 && (criteria[0] instanceof DPresence) && !(criteria[0] instanceof Inclusion));
}
Program: 108397
Project: 108397
Buggy source:
/** 
 * Checks whether the given entry is anonymous
 * @param entry
 * @return
 */
private boolean isAnonymous(HashGroupifyEntry entry){
  if (k != Integer.MAX_VALUE && entry.count < k) {
    return false;
  }
  for (int i=0; i < criteria.length; i++) {
    if (!criteria[i].isAnonymous(entry)) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Checks whether the given entry is anonymous
 * @param entry
 * @returns -1, if all criteria are fulfilled, 0, if minimal group size is not fulfilled, (index+1) if criteria[index] is not fulfilled
 */
private int isAnonymous(HashGroupifyEntry entry){
  if (k != Integer.MAX_VALUE && entry.count < k) {
    return 0;
  }
  for (int i=0; i < criteria.length; i++) {
    if (!criteria[i].isAnonymous(entry)) {
      return i + 1;
    }
  }
  return -1;
}
Program: 108398
Project: 108398
Buggy source:
@Override public void analyze(){
  kAnonymous=(currentOutliers <= absoluteMaxOutliers);
  if (criteria.length == 0) {
    anonymous=kAnonymous;
    return;
  }
  if (k != Integer.MAX_VALUE && !kAnonymous) {
    anonymous=false;
    return;
  }
  currentOutliers=0;
  HashGroupifyEntry entry=firstEntry;
  while (entry != null) {
    final boolean anonymous=isAnonymous(entry);
    if (!anonymous) {
      currentOutliers+=entry.count;
      if (currentOutliers > absoluteMaxOutliers) {
        this.anonymous=false;
        return;
      }
    }
    entry.isNotOutlier=anonymous;
    entry=entry.nextOrdered;
  }
  this.anonymous=true;
}

Fixed version (ground truth):
@Override public void analyze(){
  kAnonymous=(currentOutliers <= absoluteMaxOutliers);
  if (criteria.length == 0) {
    anonymous=kAnonymous;
    return;
  }
  if (k != Integer.MAX_VALUE && !kAnonymous) {
    anonymous=false;
    return;
  }
  currentOutliers=0;
  HashGroupifyEntry entry=firstEntry;
  while (entry != null) {
    int anonymous=isAnonymous(entry);
    if (anonymous != -1) {
      if (dpresence && entry.count == 0 && anonymous == 1) {
        this.anonymous=false;
        return;
      }
      currentOutliers+=entry.count;
      if (currentOutliers > absoluteMaxOutliers) {
        this.anonymous=false;
        return;
      }
    }
    entry.isNotOutlier=(anonymous == -1);
    entry=entry.nextOrdered;
  }
  this.anonymous=true;
}
Program: 108399
Project: 108399
Buggy source:
/** 
 * Updates the max generalization level
 * @return
 */
private boolean pushMax(){
  if (max.getSelectionIndex() >= 0 && max.getItemCount() > 1) {
    if (max.getSelectionIndex() < (min.getSelectionIndex() - 1)) {
      max.select(min.getSelectionIndex() - 1);
    }
    if (model != null) {
      String val=max.getItem(max.getSelectionIndex());
      if (val.equals(ITEM_ALL)) {
        model.getInputConfig().setMaximumGeneralization(attribute,null);
      }
 else {
        model.getInputConfig().setMaximumGeneralization(attribute,Integer.valueOf(val) - 1);
      }
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Updates the max generalization level
 * @return
 */
private boolean pushMax(){
  if (max.getSelectionIndex() >= 0) {
    if (max.getSelectionIndex() < (min.getSelectionIndex() - 1)) {
      max.select(min.getSelectionIndex() - 1);
    }
    if (model != null) {
      String val=max.getItem(max.getSelectionIndex());
      model.getInputConfig().setMaximumGeneralization(attribute,val.equals(ITEM_ALL) ? null : Integer.valueOf(val));
      return true;
    }
  }
  return false;
}
Program: 108400
Project: 108400
Buggy source:
/** 
 * Updates the combos
 */
private void updateCombos(){
  if (model == null || min == null || min.isDisposed()) {
    return;
  }
  final List<String> minItems=new ArrayList<String>();
  final List<String> maxItems=new ArrayList<String>();
  minItems.add(ITEM_ALL);
  for (int i=1; i <= (hierarchy == null ? 0 : hierarchy[0].length); i++) {
    minItems.add(String.valueOf(i));
    maxItems.add(String.valueOf(i));
  }
  maxItems.add(ITEM_ALL);
  Integer minModel=model.getInputConfig().getMinimumGeneralization(attribute);
  String minSelected=ITEM_ALL;
  if (minModel != null)   minSelected=String.valueOf(minModel + 1);
  int minIndex=minIndexOf(minSelected);
  Integer maxModel=model.getInputConfig().getMaximumGeneralization(attribute);
  String maxSelected=ITEM_ALL;
  if (maxModel != null)   maxSelected=String.valueOf(maxModel + 1);
  int maxIndex=maxIndexOf(maxSelected);
  if (minIndex > (maxIndex + 1)) {
    minIndex=maxIndex + 1;
  }
  min.setItems(minItems.toArray(new String[]{}));
  max.setItems(maxItems.toArray(new String[]{}));
  min.select(minIndex);
  max.select(maxIndex);
  pushMin();
  pushMax();
}

Fixed version (ground truth):
/** 
 * Updates the combos
 */
private void updateCombos(){
  if (model == null || min == null || min.isDisposed()) {
    return;
  }
  final List<String> minItems=new ArrayList<String>();
  final List<String> maxItems=new ArrayList<String>();
  minItems.add(ITEM_ALL);
  for (int i=0; i < (hierarchy == null ? 0 : hierarchy[0].length); i++) {
    minItems.add(String.valueOf(i));
    maxItems.add(String.valueOf(i));
  }
  maxItems.add(ITEM_ALL);
  Integer minModel=model.getInputConfig().getMinimumGeneralization(attribute);
  int minIndex=minModel != null ? minModel + 1 : 0;
  Integer maxModel=model.getInputConfig().getMaximumGeneralization(attribute);
  int maxIndex=maxModel != null ? maxModel : maxItems.size() - 1;
  maxIndex=maxIndex > maxItems.size() - 1 ? maxItems.size() - 1 : maxIndex;
  maxIndex=maxIndex < 0 ? maxItems.size() - 1 : maxIndex;
  minIndex=minIndex > minItems.size() - 1 ? minItems.size() - 1 : minIndex;
  minIndex=minIndex < 0 ? 0 : minIndex;
  minIndex=minIndex > (maxIndex + 1) ? maxIndex + 1 : minIndex;
  min.setItems(minItems.toArray(new String[minItems.size()]));
  max.setItems(maxItems.toArray(new String[maxItems.size()]));
  min.select(minIndex);
  max.select(maxIndex);
  pushMin();
  pushMax();
}
Program: 108401
Project: 108401
Buggy source:
/** 
 * Updates the min generalization level
 * @return
 */
private boolean pushMin(){
  if (min.getSelectionIndex() >= 0 && min.getItemCount() > 1) {
    if (min.getSelectionIndex() > (max.getSelectionIndex() + 1)) {
      min.select(max.getSelectionIndex() + 1);
    }
    if (model != null) {
      String val=min.getItem(min.getSelectionIndex());
      if (val.equals(ITEM_ALL)) {
        model.getInputConfig().setMinimumGeneralization(attribute,null);
      }
 else {
        model.getInputConfig().setMinimumGeneralization(attribute,Integer.valueOf(val) - 1);
      }
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Updates the min generalization level
 * @return
 */
private boolean pushMin(){
  if (min.getSelectionIndex() >= 0) {
    if (min.getSelectionIndex() > (max.getSelectionIndex() + 1)) {
      min.select(max.getSelectionIndex() + 1);
    }
    if (model != null) {
      String val=min.getItem(min.getSelectionIndex());
      model.getInputConfig().setMinimumGeneralization(attribute,val.equals(ITEM_ALL) ? null : Integer.valueOf(val));
      return true;
    }
  }
  return false;
}
Program: 108402
Project: 108402
Buggy source:
/** 
 * Clears the table
 */
public void clear(){
  this.dataProviderBody.clear();
  this.dataProviderColumnHeader.clear();
  this.dataProviderRowHeader.clear();
  this.table.refresh();
  this.selectedRow=null;
  this.selectedColumn=null;
}

Fixed version (ground truth):
/** 
 * Clears the table
 */
public void clear(){
  this.table.doCommand(new CTLayerCommandReset());
  this.dataProviderBody.clear();
  this.dataProviderColumnHeader.clear();
  this.dataProviderRowHeader.clear();
  this.table.refresh();
  this.selectedRow=null;
  this.selectedColumn=null;
}
Program: 108403
Project: 108403
Buggy source:
/** 
 * Resets the output
 */
private void actionResetOutput(){
  model.getViewConfig().setMode(Mode.UNSORTED);
  model.getViewConfig().setSubset(false);
  model.setGroups(null);
  update(new ModelEvent(this,ModelPart.VIEW_CONFIG,null));
  model.setResult(null);
  model.setOutputConfig(null);
  update(new ModelEvent(this,ModelPart.RESULT,null));
  model.setOutput(null,null);
  update(new ModelEvent(this,ModelPart.OUTPUT,null));
  model.setSelectedNode(null);
  update(new ModelEvent(this,ModelPart.SELECTED_NODE,null));
}

Fixed version (ground truth):
/** 
 * Resets the output
 */
private void actionResetOutput(){
  model.getViewConfig().setMode(Mode.UNSORTED);
  model.getViewConfig().setSubset(false);
  model.setGroups(null);
  model.setResult(null);
  model.setOutputConfig(null);
  model.setOutput(null,null);
  model.setSelectedNode(null);
  update(new ModelEvent(this,ModelPart.VIEW_CONFIG,null));
  update(new ModelEvent(this,ModelPart.RESULT,null));
  update(new ModelEvent(this,ModelPart.OUTPUT,null));
  update(new ModelEvent(this,ModelPart.SELECTED_NODE,null));
}
Program: 108404
Project: 108404
Buggy source:
/** 
 * Stops this analysis
 */
public synchronized void stop(){
  this.stopped=true;
  this.analysis.stop();
}

Fixed version (ground truth):
/** 
 * Stops all running analysis threads
 */
public void stop(){
  if (worker != null && !worker.isStopped()) {
    worker.stop();
    try {
      try {
        worker.getThread().interrupt();
      }
 catch (      SecurityException e) {
      }
      if (worker.getThread().isAlive()) {
        worker.getThread().join();
      }
    }
 catch (    InterruptedException e) {
    }
    worker=null;
  }
}
Program: 108405
Project: 108405
Buggy source:
/** 
 * Start a new analysis. Analyses already executing will be canceled.
 * @param analysis
 */
public synchronized void start(Analysis analysis){
  if (worker != null && !worker.isStopped()) {
    worker.stop();
    try {
      try {
        worker.getThread().interrupt();
      }
 catch (      SecurityException e) {
      }
      if (worker.getThread().isAlive()) {
        worker.getThread().join();
      }
    }
 catch (    InterruptedException e) {
    }
    worker=null;
  }
  worker=new AnalysisWorker(analysis);
  worker.start();
}

Fixed version (ground truth):
/** 
 * Start a new analysis. Analyses already executing will be canceled.
 * @param analysis
 */
public synchronized void start(Analysis analysis){
  stop();
  worker=new AnalysisWorker(analysis);
  worker.start();
}
Program: 108406
Project: 108406
Buggy source:
@Override protected void doReset(){
  this.table.clear();
}

Fixed version (ground truth):
@Override protected void doReset(){
  if (this.manager != null) {
    this.manager.stop();
  }
  this.table.clear();
}
Program: 108408
Project: 108408
Buggy source:
@Override protected void doReset(){
  this.table.clear();
}

Fixed version (ground truth):
@Override protected void doReset(){
  if (this.manager != null) {
    this.manager.stop();
  }
  this.table.clear();
}
Program: 108409
Project: 108409
Buggy source:
@Override public boolean isAnonymous(HashGroupifyEntry entry){
  if (entry.count > 0) {
    double dCurrent=(double)entry.count / (double)entry.pcount;
    return (dCurrent >= dMin) && (dCurrent <= dMax);
  }
 else {
    return true;
  }
}

Fixed version (ground truth):
@Override public boolean isAnonymous(HashGroupifyEntry entry){
  double delta=entry.count == 0 ? 0d : (double)entry.count / (double)entry.pcount;
  return (delta >= dMin) && (delta <= dMax);
}
Program: 108410
Project: 108410
Buggy source:
@Override public double relativeTo(InformationLoss<?> min,InformationLoss<?> max){
  if (min == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
 else   if (max == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  InformationLossRCE _min=convert(min);
  InformationLossRCE _max=convert(max);
  if (_max.perc - _min.perc == 0)   return 0d;
  return (perc - _min.perc) / (_max.perc - _min.perc);
}

Fixed version (ground truth):
@Override public double relativeTo(InformationLoss<?> min,InformationLoss<?> max){
  if (min == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
 else   if (max == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  InformationLossRCE _min=convert(min);
  InformationLossRCE _max=convert(max);
  if (_max.perc - _min.perc == 0)   return 0d;
  double result=(perc - _min.perc) / (_max.perc - _min.perc);
  return result >= 0d ? (result <= 1d ? result : 1d) : 0d;
}
Program: 108411
Project: 108411
Buggy source:
/** 
 * Triggers a tagged event at the listener
 */
private void triggerTagged(Node node){
  if (this.listener != null) {
    if (tagTrigger == null || tagTrigger.appliesTo(node)) {
      this.listener.nodeTagged(size);
    }
  }
}

Fixed version (ground truth):
/** 
 * Triggers a tagged event at the listener
 */
private void triggerTagged(Node node){
  if (this.listener != null && !node.hasProperty(Node.PROPERTY_EVENT_FIRED)) {
    if (tagTrigger == null || tagTrigger.appliesTo(node)) {
      node.setProperty(Node.PROPERTY_EVENT_FIRED);
      this.listener.nodeTagged(size);
    }
  }
}
Program: 108412
Project: 108412
Buggy source:
@Override public void moveCellPositionIntoViewport(int scrollableColumnPosition,int scrollableRowPosition){
}

Fixed version (ground truth):
@Override public void moveCellPositionIntoViewport(int scrollableColumnPosition,int scrollableRowPosition){
  if (!(context.isRowExpanded() && context.isColumnExpanded())) {
    super.moveCellPositionIntoViewport(scrollableColumnPosition,scrollableRowPosition);
  }
}
Program: 108413
Project: 108413
Buggy source:
@Override public void moveColumnPositionIntoViewport(int scrollableColumnPosition){
}

Fixed version (ground truth):
@Override public void moveColumnPositionIntoViewport(int scrollableColumnPosition){
  if (!context.isColumnExpanded()) {
    super.moveColumnPositionIntoViewport(scrollableColumnPosition);
  }
}
Program: 108414
Project: 108414
Buggy source:
@Override public void moveRowPositionIntoViewport(int scrollableRowPosition){
}

Fixed version (ground truth):
@Override public void moveRowPositionIntoViewport(int scrollableRowPosition){
  if (!context.isRowExpanded()) {
    super.moveRowPositionIntoViewport(scrollableRowPosition);
  }
}
Program: 108415
Project: 108415
Buggy source:
@Override public boolean doCommand(ILayerCommand command){
  if (!registered && context.getTable() != null) {
    registered=true;
    context.getTable().addControlListener(new ControlAdapter(){
      public void controlResized(      ControlEvent arg0){
        checkScrollBars();
      }
    }
);
  }
  if (context.isColumnExpanded() && context.isRowExpanded()) {
    return underlyingLayer.doCommand(command);
  }
 else {
    return super.doCommand(command);
  }
}

Fixed version (ground truth):
@Override public boolean doCommand(ILayerCommand command){
  if (!registered && context.getTable() != null) {
    registered=true;
    context.getTable().addControlListener(new ControlAdapter(){
      public void controlResized(      ControlEvent arg0){
        checkScrollBars();
      }
    }
);
  }
  return super.doCommand(command);
}