nus-yam/ex-repair huggingface dataset:
Program: 108104
Project: 108104
Buggy source:
@Override public void update(final ModelEvent event){
  if (event.part == ModelPart.SELECTED_NODE) {
    selectedNode=(ARXNode)event.data;
    eventNodeSelected();
  }
 else   if (event.part == ModelPart.RESULT) {
    ARXResult result=(ARXResult)event.data;
    if (model != null && result != null && result.getGlobalOptimum() != null) {
      optimum=result.getGlobalOptimum();
    }
 else {
      optimum=null;
    }
    if (model != null && !isTooLarge(result,model.getNodeFilter(),model.getMaxNodesInViewer())) {
      eventResultChanged(result);
    }
  }
 else   if (event.part == ModelPart.MODEL) {
    model=(Model)event.data;
    if (model != null && model.getResult() != null && model.getResult().getGlobalOptimum() != null) {
      optimum=model.getResult().getGlobalOptimum();
    }
 else {
      optimum=null;
    }
    if (model != null && !isTooLarge(model.getResult(),model.getNodeFilter(),model.getMaxNodesInViewer())) {
      eventModelChanged();
    }
  }
 else   if (event.part == ModelPart.FILTER) {
    if (model != null && !isTooLarge(model.getResult(),(ModelNodeFilter)event.data,model.getMaxNodesInViewer())) {
      eventFilterChanged(model.getResult(),(ModelNodeFilter)event.data);
    }
  }
}

Fixed version (ground truth):
@Override public void update(final ModelEvent event){
  if (event.part == ModelPart.SELECTED_NODE) {
    selectedNode=(ARXNode)event.data;
    eventNodeSelected();
  }
 else   if (event.part == ModelPart.RESULT) {
    ARXResult result=(ARXResult)event.data;
    if (model != null && result != null && result.getGlobalOptimum() != null) {
      optimum=result.getGlobalOptimum();
    }
 else {
      optimum=null;
    }
    if (model != null && !isTooLarge(result,model.getNodeFilter(),model.getMaxNodesInViewer())) {
      eventResultChanged(result);
    }
  }
 else   if (event.part == ModelPart.MODEL) {
    model=(Model)event.data;
    if (model != null && model.getResult() != null && model.getResult().getGlobalOptimum() != null) {
      optimum=model.getResult().getGlobalOptimum();
    }
 else {
      optimum=null;
    }
    if (model != null && !isTooLarge(model.getResult(),model.getNodeFilter(),model.getMaxNodesInViewer())) {
      eventModelChanged();
    }
  }
 else   if (event.part == ModelPart.FILTER) {
    if (model != null && !isTooLarge(model.getResult(),(ModelNodeFilter)event.data,model.getMaxNodesInViewer())) {
      eventFilterChanged(model.getResult(),(ModelNodeFilter)event.data);
    }
  }
 else   if (event.part == ModelPart.EXPAND) {
    if (model != null && !isTooLarge(model.getResult(),model.getNodeFilter(),model.getMaxNodesInViewer())) {
      eventFilterChanged(model.getResult(),model.getNodeFilter());
    }
  }
}
Program: 108105
Project: 108105
Buggy source:
@Override public void widgetSelected(final SelectionEvent arg0){
  model.setSelectedNode(selectedNode);
  controller.update(new ModelEvent(ViewSolutionSpace.this,ModelPart.SELECTED_NODE,selectedNode));
  controller.actionExpand(selectedNode);
  eventFilterChanged(model.getResult(),model.getNodeFilter());
}

Fixed version (ground truth):
@Override public void widgetSelected(final SelectionEvent arg0){
  model.setSelectedNode(selectedNode);
  controller.update(new ModelEvent(ViewSolutionSpace.this,ModelPart.SELECTED_NODE,selectedNode));
  controller.actionExpand(selectedNode);
  controller.update(new ModelEvent(ViewSolutionSpace.this,ModelPart.EXPAND,selectedNode));
  eventFilterChanged(model.getResult(),model.getNodeFilter());
}
Program: 108108
Project: 108108
Buggy source:
/** 
 * Returns whether a quasi-identifier is selected.
 * @return
 */
public boolean isQuasiIdentifierSelected(){
  return (getInputDefinition().getAttributeType(getSelectedAttribute()) instanceof Hierarchy);
}

Fixed version (ground truth):
/** 
 * Returns whether a quasi-identifier is selected.
 * @return
 */
public boolean isQuasiIdentifierSelected(){
  return (getInputDefinition().getAttributeType(getSelectedAttribute()) == AttributeType.QUASI_IDENTIFYING_ATTRIBUTE);
}
Program: 108109
Project: 108109
Buggy source:
/** 
 * Updates the global hierarchy definition.
 */
private void pushHierarchy(){
  if (model == null || model.getInputConfig() == null) {
    return;
  }
  Hierarchy h=Hierarchy.create(hierarchy);
  model.getInputConfig().setHierarchy(attribute,h);
  controller.update(new ModelEvent(this,ModelPart.HIERARCHY,h));
}

Fixed version (ground truth):
/** 
 * Updates the global hierarchy definition.
 */
private void pushHierarchy(){
  if (model == null || model.getInputConfig() == null) {
    return;
  }
  Hierarchy h=null;
  if (hierarchy == null) {
    model.getInputConfig().removeHierarchy(attribute);
  }
 else {
    h=Hierarchy.create(hierarchy);
    model.getInputConfig().setHierarchy(attribute,h);
  }
  controller.update(new ModelEvent(this,ModelPart.HIERARCHY,h));
}
Program: 108110
Project: 108110
Buggy source:
/** 
 * Returns a generalization hierarchy for the attribute, if available.
 * @param context
 * @param attribute
 * @return
 */
public Hierarchy getHierarchy(AnalysisData context,String attribute){
  if (context.config == null || context.config == model.getInputConfig() || model.getOutputDefinition() == null) {
    return null;
  }
  AttributeType type=model.getOutputDefinition().getAttributeType(attribute);
  if (type instanceof Hierarchy) {
    return (Hierarchy)type;
  }
  for (  HierarchicalDistanceTCloseness t : context.config.getCriteria(HierarchicalDistanceTCloseness.class)) {
    if (t.getAttribute().equals(attribute)) {
      return t.getHierarchy();
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns a generalization hierarchy for the attribute, if available.
 * @param context
 * @param attribute
 * @return
 */
public Hierarchy getHierarchy(AnalysisData context,String attribute){
  if (context.config == null || context.config == model.getInputConfig() || model.getOutputDefinition() == null) {
    return null;
  }
  Hierarchy hierarchy=model.getOutputDefinition().getHierarchyObject(attribute);
  if (hierarchy != null) {
    return hierarchy;
  }
  for (  HierarchicalDistanceTCloseness t : context.config.getCriteria(HierarchicalDistanceTCloseness.class)) {
    if (t.getAttribute().equals(attribute)) {
      return t.getHierarchy();
    }
  }
  return null;
}
Program: 108111
Project: 108111
Buggy source:
/** 
 * Update the attribute type.
 */
private void updateAttributeType(){
  AttributeType type=model.getInputDefinition().getAttributeType(attribute);
  if (type instanceof Hierarchy) {
    type=null;
  }
  for (int i=0; i < COMBO1_TYPES.length; i++) {
    if (type == COMBO1_TYPES[i]) {
      cmbType.select(i);
      break;
    }
  }
}

Fixed version (ground truth):
/** 
 * Update the attribute type.
 */
private void updateAttributeType(){
  AttributeType type=model.getInputDefinition().getAttributeType(attribute);
  for (int i=0; i < COMBO1_TYPES.length; i++) {
    if (type == COMBO1_TYPES[i]) {
      cmbType.select(i);
      break;
    }
  }
}
Program: 108112
Project: 108112
Buggy source:
/** 
 * Update the column icon.
 */
private void updateIcon(){
  AttributeType type=model.getInputDefinition().getAttributeType(attribute);
  if (type instanceof Hierarchy) {
    tabItem.setImage(IMAGE_QUASI_IDENTIFYING);
  }
 else   if (type == AttributeType.INSENSITIVE_ATTRIBUTE) {
    tabItem.setImage(IMAGE_INSENSITIVE);
  }
 else   if (type == AttributeType.SENSITIVE_ATTRIBUTE) {
    tabItem.setImage(IMAGE_SENSITIVE);
  }
 else   if (type == AttributeType.IDENTIFYING_ATTRIBUTE) {
    tabItem.setImage(IMAGE_IDENTIFYING);
  }
}

Fixed version (ground truth):
/** 
 * Update the column icon.
 */
private void updateIcon(){
  AttributeType type=model.getInputDefinition().getAttributeType(attribute);
  if (type == AttributeType.QUASI_IDENTIFYING_ATTRIBUTE) {
    tabItem.setImage(IMAGE_QUASI_IDENTIFYING);
  }
 else   if (type == AttributeType.INSENSITIVE_ATTRIBUTE) {
    tabItem.setImage(IMAGE_INSENSITIVE);
  }
 else   if (type == AttributeType.SENSITIVE_ATTRIBUTE) {
    tabItem.setImage(IMAGE_SENSITIVE);
  }
 else   if (type == AttributeType.IDENTIFYING_ATTRIBUTE) {
    tabItem.setImage(IMAGE_IDENTIFYING);
  }
}
Program: 108115
Project: 108115
Buggy source:
/** 
 * Returns the according hierarchy.
 * @param attribute
 * @return
 */
public String[][] getHierarchy(final String attribute){
  Hierarchy hierarchy=hierarchies.get(attribute);
  return hierarchy == null ? null : hierarchy.getHierarchy();
}

Fixed version (ground truth):
/** 
 * Returns the according hierarchy as String array.
 * @param attribute
 * @return
 */
public String[][] getHierarchy(final String attribute){
  Hierarchy hierarchy=hierarchies.get(attribute);
  return hierarchy == null ? null : hierarchy.getHierarchy();
}
Program: 108116
Project: 108116
Buggy source:
@Override public void traverse(){
  timeStart=System.currentTimeMillis();
  MinMaxPriorityQueue<Long> queue=new MinMaxPriorityQueue<Long>(MAX_QUEUE_SIZE,new Comparator<Long>(){
    @Override public int compare(    Long arg0,    Long arg1){
      return solutionSpace.getUtility(arg0).compareTo(solutionSpace.getUtility(arg1));
    }
  }
);
  Transformation bottom=solutionSpace.getBottom();
  assureChecked(bottom);
  queue.add(bottom.getIdentifier());
  Transformation next;
  int step=0;
  while ((next=solutionSpace.getTransformation(queue.poll())) != null) {
    if (!prune(next)) {
      step++;
      if (step % stepping == 0) {
        dfs(queue,next);
      }
 else {
        expand(queue,next);
      }
      if (getTime() > timeLimit) {
        return;
      }
    }
  }
}

Fixed version (ground truth):
@Override public void traverse(){
  timeStart=System.currentTimeMillis();
  MinMaxPriorityQueue<Long> queue=new MinMaxPriorityQueue<Long>(MAX_QUEUE_SIZE,new Comparator<Long>(){
    @Override public int compare(    Long arg0,    Long arg1){
      return solutionSpace.getUtility(arg0).compareTo(solutionSpace.getUtility(arg1));
    }
  }
);
  Transformation bottom=solutionSpace.getBottom();
  assureChecked(bottom);
  queue.add(bottom.getIdentifier());
  Transformation next;
  int step=0;
  Long nextId;
  while ((nextId=queue.poll()) != null) {
    next=solutionSpace.getTransformation(nextId);
    if (!prune(next)) {
      step++;
      if (step % stepping == 0) {
        dfs(queue,next);
      }
 else {
        expand(queue,next);
      }
      if (getTime() > timeLimit) {
        return;
      }
    }
  }
}
Program: 108118
Project: 108118
Buggy source:
/** 
 * Creates a microaggregation function using generalization.
 * @param ignoreMissingData Should the function ignore missing data. Default is true.
 * @return
 */
public static MicroAggregationFunction createGeneralization(boolean ignoreMissingData){
  return new MicroAggregationFunction(new DistributionAggregateFunctionGeneralization(ignoreMissingData),false,DataScale.NOMINAL,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Creates a microaggregation function using generalization.
 * @param ignoreMissingData Should the function ignore missing data. Default is true.
 * @return
 */
public static MicroAggregationFunction createGeneralization(boolean ignoreMissingData){
  return new MicroAggregationFunction(new DistributionAggregateFunctionGeneralization(ignoreMissingData),DataScale.NOMINAL,"String_Node_Str");
}
Program: 108119
Project: 108119
Buggy source:
/** 
 * Creates a microaggregation function returning the median.
 * @param ignoreMissingData Should the function ignore missing data. Default is true.
 * @return
 */
public static MicroAggregationFunction createMedian(boolean ignoreMissingData){
  return new MicroAggregationFunction(new DistributionAggregateFunctionMedian(ignoreMissingData),true,DataScale.ORDINAL,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Creates a microaggregation function returning the median.
 * @param ignoreMissingData Should the function ignore missing data. Default is true.
 * @return
 */
public static MicroAggregationFunction createMedian(boolean ignoreMissingData){
  return new MicroAggregationFunction(new DistributionAggregateFunctionMedian(ignoreMissingData),DataScale.ORDINAL,"String_Node_Str");
}
Program: 108120
Project: 108120
Buggy source:
/** 
 * Creates a microaggregation function returning the mode.
 * @param ignoreMissingData Should the function ignore missing data. Default is true.
 * @return
 */
public static MicroAggregationFunction createMode(boolean ignoreMissingData){
  return new MicroAggregationFunction(new DistributionAggregateFunctionMode(ignoreMissingData),true,DataScale.ORDINAL,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Creates a microaggregation function returning the mode.
 * @param ignoreMissingData Should the function ignore missing data. Default is true.
 * @return
 */
public static MicroAggregationFunction createMode(boolean ignoreMissingData){
  return new MicroAggregationFunction(new DistributionAggregateFunctionMode(ignoreMissingData),DataScale.ORDINAL,"String_Node_Str");
}
Program: 108121
Project: 108121
Buggy source:
/** 
 * Instantiates a new hierarchy.
 * @param function
 * @param typePreserving
 * @param requiredScale
 * @param label 
 */
private MicroAggregationFunction(DistributionAggregateFunction function,boolean typePreserving,DataScale requiredScale,String label){
  super(ATTR_TYPE_QI);
  this.function=function;
  this.requiredScale=requiredScale;
  this.label=label;
  this.typePreserving=typePreserving;
}

Fixed version (ground truth):
/** 
 * Instantiates a new hierarchy.
 * @param function
 * @param requiredScale
 * @param label 
 */
private MicroAggregationFunction(DistributionAggregateFunction function,DataScale requiredScale,String label){
  super(ATTR_TYPE_QI);
  this.function=function;
  this.requiredScale=requiredScale;
  this.label=label;
}
Program: 108122
Project: 108122
Buggy source:
/** 
 * Creates a microaggregation function returning the arithmetic mean.
 * @param ignoreMissingData Should the function ignore missing data. Default is true.
 * @return
 */
public static MicroAggregationFunction createArithmeticMean(boolean ignoreMissingData){
  return new MicroAggregationFunction(new DistributionAggregateFunctionArithmeticMean(ignoreMissingData),true,DataScale.INTERVAL,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Creates a microaggregation function returning the arithmetic mean.
 * @param ignoreMissingData Should the function ignore missing data. Default is true.
 * @return
 */
public static MicroAggregationFunction createArithmeticMean(boolean ignoreMissingData){
  return new MicroAggregationFunction(new DistributionAggregateFunctionArithmeticMean(ignoreMissingData),DataScale.INTERVAL,"String_Node_Str");
}
Program: 108123
Project: 108123
Buggy source:
/** 
 * Creates a microaggregation function returning the geometric mean.
 * @param ignoreMissingData Should the function ignore missing data. Default is true.
 * @return
 */
public static MicroAggregationFunction createGeometricMean(boolean ignoreMissingData){
  return new MicroAggregationFunction(new DistributionAggregateFunctionGeometricMean(ignoreMissingData),true,DataScale.INTERVAL,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Creates a microaggregation function returning the geometric mean.
 * @param ignoreMissingData Should the function ignore missing data. Default is true.
 * @return
 */
public static MicroAggregationFunction createGeometricMean(boolean ignoreMissingData){
  return new MicroAggregationFunction(new DistributionAggregateFunctionGeometricMean(ignoreMissingData),DataScale.INTERVAL,"String_Node_Str");
}
Program: 108124
Project: 108124
Buggy source:
/** 
 * Returns whether this is a type-preserving function
 * @return
 */
public boolean isTypePreserving(){
  return typePreserving;
}

Fixed version (ground truth):
/** 
 * Returns whether this is a type-preserving function
 * @return
 */
public boolean isTypePreserving(){
  return function.isTypePreserving();
}
Program: 108125
Project: 108125
Buggy source:
/** 
 * Creates the data type array.
 * @return
 */
@Override protected DataType<?>[][] getDataTypeArray(){
  DataType<?>[][] dataTypes=new DataType[5][];
  dataTypes[AttributeTypeInternal.INSENSITIVE]=new DataType[dataIS.getHeader().length];
  dataTypes[AttributeTypeInternal.SENSITIVE]=new DataType[dataDI.getHeader().length];
  dataTypes[AttributeTypeInternal.QUASI_IDENTIFYING_GENERALIZED]=new DataType[dataGH.getHeader().length];
  dataTypes[AttributeTypeInternal.QUASI_IDENTIFYING_MICROAGGREGATED]=new DataType[dataOT.getHeader().length];
  dataTypes[AttributeTypeInternal.IDENTIFYING]=null;
  for (int i=0; i < dataTypes.length; i++) {
    final DataType<?>[] type=dataTypes[i];
    String[] header=null;
switch (i) {
case AttributeTypeInternal.INSENSITIVE:
      header=dataIS.getHeader();
    break;
case AttributeTypeInternal.QUASI_IDENTIFYING_GENERALIZED:
  header=dataGH.getHeader();
break;
case AttributeTypeInternal.SENSITIVE:
header=dataDI.getHeader();
break;
case AttributeTypeInternal.QUASI_IDENTIFYING_MICROAGGREGATED:
header=dataOT.getHeader();
break;
}
if (type != null) {
for (int j=0; j < type.length; j++) {
dataTypes[i][j]=definition.getDataType(header[j]);
if ((i == AttributeTypeInternal.QUASI_IDENTIFYING_GENERALIZED) && (node.getTransformation()[j] > 0)) {
dataTypes[i][j]=DataType.STRING;
}
}
}
}
return dataTypes;
}

Fixed version (ground truth):
/** 
 * Creates the data type array.
 * @return
 */
@Override protected DataType<?>[][] getDataTypeArray(){
  DataType<?>[][] dataTypes=new DataType[5][];
  dataTypes[AttributeTypeInternal.INSENSITIVE]=new DataType[dataIS.getHeader().length];
  dataTypes[AttributeTypeInternal.SENSITIVE]=new DataType[dataDI.getHeader().length];
  dataTypes[AttributeTypeInternal.QUASI_IDENTIFYING_GENERALIZED]=new DataType[dataGH.getHeader().length];
  dataTypes[AttributeTypeInternal.QUASI_IDENTIFYING_MICROAGGREGATED]=new DataType[dataOT.getHeader().length];
  dataTypes[AttributeTypeInternal.IDENTIFYING]=null;
  for (int i=0; i < dataTypes.length; i++) {
    final DataType<?>[] type=dataTypes[i];
    String[] header=null;
switch (i) {
case AttributeTypeInternal.INSENSITIVE:
      header=dataIS.getHeader();
    break;
case AttributeTypeInternal.QUASI_IDENTIFYING_GENERALIZED:
  header=dataGH.getHeader();
break;
case AttributeTypeInternal.SENSITIVE:
header=dataDI.getHeader();
break;
case AttributeTypeInternal.QUASI_IDENTIFYING_MICROAGGREGATED:
header=dataOT.getHeader();
break;
}
if (type != null) {
for (int j=0; j < type.length; j++) {
dataTypes[i][j]=definition.getDataType(header[j]);
if ((i == AttributeTypeInternal.QUASI_IDENTIFYING_GENERALIZED && node.getTransformation()[j] > 0) || (i == AttributeTypeInternal.QUASI_IDENTIFYING_MICROAGGREGATED && !definition.getMicroAggregationFunction(header[j]).isTypePreserving())) {
dataTypes[i][j]=DataType.STRING;
}
}
}
}
return dataTypes;
}
Program: 108126
Project: 108126
Buggy source:
/** 
 * Gets the num rows.
 * @return the num rows
 */
@Override public int getNumRows(){
  checkRegistry();
  return dataGH.getDataLength();
}

Fixed version (ground truth):
/** 
 * Gets the num rows.
 * @return the num rows
 */
@Override public int getNumRows(){
  checkRegistry();
  return outputGeneralized.getDataLength();
}
Program: 108127
Project: 108127
Buggy source:
@Override public boolean hasNext(){
  return row < dataGH.getArray().length;
}

Fixed version (ground truth):
@Override public boolean hasNext(){
  return row < outputGeneralized.getArray().length;
}
Program: 108129
Project: 108129
Buggy source:
/** 
 * Releases all resources.
 */
protected void doRelease(){
  result.releaseBuffer(this);
  node=null;
  dataIS=null;
  dataGH=null;
  dataDI=null;
  dataOT=null;
  inverseData=null;
  inverseDictionaries=null;
  inverseMap=null;
  registry=null;
  subset=null;
  dataTypes=null;
  definition=null;
  header=null;
  statistics=null;
  node=null;
}

Fixed version (ground truth):
/** 
 * Releases all resources.
 */
protected void doRelease(){
  result.releaseBuffer(this);
  node=null;
  inputStatic=null;
  outputGeneralized=null;
  inputAnalyzed=null;
  outputMicroaggregated=null;
  inverseData=null;
  inverseDictionaries=null;
  inverseMap=null;
  registry=null;
  subset=null;
  dataTypes=null;
  definition=null;
  header=null;
  statistics=null;
  node=null;
}
Program: 108130
Project: 108130
Buggy source:
/** 
 * Swap internal.
 * @param row1 the row1
 * @param row2 the row2
 */
protected void internalSwap(final int row1,final int row2){
  int[] temp=dataGH.getArray()[row1];
  dataGH.getArray()[row1]=dataGH.getArray()[row2];
  dataGH.getArray()[row2]=temp;
  temp=dataOT.getArray()[row1];
  dataOT.getArray()[row1]=dataOT.getArray()[row2];
  dataOT.getArray()[row2]=temp;
}

Fixed version (ground truth):
/** 
 * Swap internal.
 * @param row1 the row1
 * @param row2 the row2
 */
protected void internalSwap(final int row1,final int row2){
  int[] temp=outputGeneralized.getArray()[row1];
  outputGeneralized.getArray()[row1]=outputGeneralized.getArray()[row2];
  outputGeneralized.getArray()[row2]=temp;
  if (outputMicroaggregated.getArray().length != 0) {
    temp=outputMicroaggregated.getArray()[row1];
    outputMicroaggregated.getArray()[row1]=outputMicroaggregated.getArray()[row2];
    outputMicroaggregated.getArray()[row2]=temp;
  }
}
Program: 108131
Project: 108131
Buggy source:
/** 
 * Creates the data type array.
 * @return
 */
@Override protected DataType<?>[][] getDataTypeArray(){
  DataType<?>[][] dataTypes=new DataType[5][];
  dataTypes[AttributeTypeInternal.INSENSITIVE]=new DataType[dataIS.getHeader().length];
  dataTypes[AttributeTypeInternal.SENSITIVE]=new DataType[dataDI.getHeader().length];
  dataTypes[AttributeTypeInternal.QUASI_IDENTIFYING_GENERALIZED]=new DataType[dataGH.getHeader().length];
  dataTypes[AttributeTypeInternal.QUASI_IDENTIFYING_MICROAGGREGATED]=new DataType[dataOT.getHeader().length];
  dataTypes[AttributeTypeInternal.IDENTIFYING]=null;
  for (int i=0; i < dataTypes.length; i++) {
    final DataType<?>[] type=dataTypes[i];
    String[] header=null;
switch (i) {
case AttributeTypeInternal.INSENSITIVE:
      header=dataIS.getHeader();
    break;
case AttributeTypeInternal.QUASI_IDENTIFYING_GENERALIZED:
  header=dataGH.getHeader();
break;
case AttributeTypeInternal.SENSITIVE:
header=dataDI.getHeader();
break;
case AttributeTypeInternal.QUASI_IDENTIFYING_MICROAGGREGATED:
header=dataOT.getHeader();
break;
}
if (type != null) {
for (int j=0; j < type.length; j++) {
dataTypes[i][j]=definition.getDataType(header[j]);
if ((i == AttributeTypeInternal.QUASI_IDENTIFYING_GENERALIZED && node.getTransformation()[j] > 0) || (i == AttributeTypeInternal.QUASI_IDENTIFYING_MICROAGGREGATED && !definition.getMicroAggregationFunction(header[j]).isTypePreserving())) {
dataTypes[i][j]=DataType.STRING;
}
}
}
}
return dataTypes;
}

Fixed version (ground truth):
/** 
 * Creates the data type array.
 * @return
 */
@Override protected DataType<?>[][] getDataTypeArray(){
  DataType<?>[][] dataTypes=new DataType[5][];
  dataTypes[AttributeTypeInternal.INSENSITIVE]=new DataType[inputStatic.getHeader().length];
  dataTypes[AttributeTypeInternal.SENSITIVE]=new DataType[inputAnalyzed.getHeader().length];
  dataTypes[AttributeTypeInternal.QUASI_IDENTIFYING_GENERALIZED]=new DataType[outputGeneralized.getHeader().length];
  dataTypes[AttributeTypeInternal.QUASI_IDENTIFYING_MICROAGGREGATED]=new DataType[outputMicroaggregated.getHeader().length];
  dataTypes[AttributeTypeInternal.IDENTIFYING]=null;
  for (int i=0; i < dataTypes.length; i++) {
    final DataType<?>[] type=dataTypes[i];
    String[] header=null;
switch (i) {
case AttributeTypeInternal.INSENSITIVE:
      header=inputStatic.getHeader();
    break;
case AttributeTypeInternal.QUASI_IDENTIFYING_GENERALIZED:
  header=outputGeneralized.getHeader();
break;
case AttributeTypeInternal.SENSITIVE:
header=inputAnalyzed.getHeader();
break;
case AttributeTypeInternal.QUASI_IDENTIFYING_MICROAGGREGATED:
header=outputMicroaggregated.getHeader();
break;
}
if (type != null) {
for (int j=0; j < type.length; j++) {
dataTypes[i][j]=definition.getDataType(header[j]);
if ((i == AttributeTypeInternal.QUASI_IDENTIFYING_GENERALIZED && node.getTransformation()[j] > 0) || (i == AttributeTypeInternal.QUASI_IDENTIFYING_MICROAGGREGATED && !definition.getMicroAggregationFunction(header[j]).isTypePreserving())) {
dataTypes[i][j]=DataType.STRING;
}
}
}
}
return dataTypes;
}
Program: 108132
Project: 108132
Buggy source:
/** 
 * Gets the value.
 * @param row the row
 * @param col the col
 * @return the value
 */
@Override public String getValue(final int row,final int col){
  checkRegistry();
  checkColumn(col);
  checkRow(row,dataGH.getDataLength());
  return internalGetValue(row,col);
}

Fixed version (ground truth):
/** 
 * Gets the value.
 * @param row the row
 * @param col the col
 * @return the value
 */
@Override public String getValue(final int row,final int col){
  checkRegistry();
  checkColumn(col);
  checkRow(row,outputGeneralized.getDataLength());
  return internalGetValue(row,col);
}
Program: 108133
Project: 108133
Buggy source:
/** 
 * Returns whether the given row is an outlier.
 * @param row
 * @return
 */
protected boolean internalIsOutlier(final int row){
  return ((dataGH.getArray()[row][0] & Data.OUTLIER_MASK) != 0);
}

Fixed version (ground truth):
/** 
 * Returns whether the given row is an outlier.
 * @param row
 * @return
 */
protected boolean internalIsOutlier(final int row){
  return ((outputGeneralized.getArray()[row][0] & Data.OUTLIER_MASK) != 0);
}
Program: 108134
Project: 108134
Buggy source:
/** 
 * Gets the value internal.
 * @param row the row
 * @param col the col
 * @return the value internal
 */
@Override protected String internalGetValue(final int row,final int col){
  final int key=col * 2;
  final int type=inverseMap[key];
switch (type) {
case AttributeTypeInternal.IDENTIFYING:
    return suppressionString;
default :
  final int index=inverseMap[key + 1];
final int[][] data=inverseData[type];
if ((suppressedAttributeTypes & (1 << type)) != 0 && ((dataGH.getArray()[row][0] & Data.OUTLIER_MASK) != 0)) {
return suppressionString;
}
final int value=data[row][index] & Data.REMOVE_OUTLIER_MASK;
final String[][] dictionary=inverseDictionaries[type].getMapping();
return dictionary[index][value];
}
}

Fixed version (ground truth):
/** 
 * Gets the value internal.
 * @param row the row
 * @param col the col
 * @return the value internal
 */
@Override protected String internalGetValue(final int row,final int col){
  final int key=col * 2;
  final int type=inverseMap[key];
switch (type) {
case AttributeTypeInternal.IDENTIFYING:
    return suppressionString;
default :
  final int index=inverseMap[key + 1];
final int[][] data=inverseData[type];
if ((suppressedAttributeTypes & (1 << type)) != 0 && ((outputGeneralized.getArray()[row][0] & Data.OUTLIER_MASK) != 0)) {
return suppressionString;
}
final int value=data[row][index] & Data.REMOVE_OUTLIER_MASK;
final String[][] dictionary=inverseDictionaries[type].getMapping();
return dictionary[index][value];
}
}
Program: 108136
Project: 108136
Buggy source:
/** 
 * Returns the node backing the last returned snapshot.
 * @return
 */
public int[] getTransformation(){
  return resultMetadata.transformation;
}

Fixed version (ground truth):
/** 
 * Returns the node backing the last returned snapshot.
 * @return
 */
public int[] getTransformation(){
  if (resultMetadata == null) {
    return null;
  }
 else {
    return resultMetadata.transformation;
  }
}
Program: 108138
Project: 108138
Buggy source:
/** 
 * Returns the value at
 * @param values
 * @param frequencies
 * @param index
 * @return
 */
private <T>T getValueAt(List<T> values,List<Integer> frequencies,int index){
  int pointer=0;
  while (frequencies.get(index) < index) {
    pointer++;
  }
  return values.get(pointer);
}

Fixed version (ground truth):
/** 
 * Returns the value at
 * @param values
 * @param frequencies
 * @param index
 * @return
 */
private <T>T getValueAt(List<T> values,List<Integer> frequencies,int index){
  int pointer=0;
  while (frequencies.get(pointer) < index) {
    pointer++;
  }
  return values.get(pointer);
}
Program: 108142
Project: 108142
Buggy source:
/** 
 * Semantics of method name: monotonicity of criteria + monotonicity of metric.
 * @param solutionSpace
 * @param checker
 * @param strategy
 * @return
 */
private static AbstractAlgorithm createNoneNone(final SolutionSpace solutionSpace,NodeChecker checker,FLASHStrategy strategy){
  PredictiveProperty anonymityProperty=solutionSpace.getPropertyAnonymous();
  NodeAction triggerSkip=new NodeAction(){
    @Override public boolean appliesTo(    Transformation node){
      return node.hasProperty(solutionSpace.getPropertyAnonymous()) || node.hasProperty(solutionSpace.getPropertyNotAnonymous());
    }
  }
;
  NodeAction triggerEvaluate=new NodeActionConstant(false);
  NodeAction triggerCheck=new NodeActionInverse(triggerSkip);
  NodeAction triggerTag=new NodeActionConstant(false);
  NodeAction triggerFireEvent=new NodeActionOR(triggerSkip){
    @Override protected boolean additionalConditionAppliesTo(    Transformation node){
      return node.hasProperty(solutionSpace.getPropertySuccessorsPruned());
    }
  }
;
  FLASHConfiguration config=FLASHConfiguration.createLinearPhaseConfiguration(new FLASHPhaseConfiguration(anonymityProperty,triggerTag,triggerCheck,triggerEvaluate,triggerSkip),triggerFireEvent,StorageStrategy.ALL,true,false);
  return new FLASHAlgorithmImpl(solutionSpace,checker,strategy,config);
}

Fixed version (ground truth):
/** 
 * Semantics of method name: monotonicity of criteria + monotonicity of metric.
 * @param solutionSpace
 * @param checker
 * @param strategy
 * @return
 */
private static AbstractAlgorithm createNoneNone(final SolutionSpace solutionSpace,NodeChecker checker,FLASHStrategy strategy){
  PhaseAnonymityProperty anonymityProperty=PhaseAnonymityProperty.ANONYMITY;
  NodeAction triggerSkip=new NodeAction(){
    @Override public boolean appliesTo(    Transformation node){
      return node.hasProperty(solutionSpace.getPropertyAnonymous()) || node.hasProperty(solutionSpace.getPropertyNotAnonymous());
    }
  }
;
  NodeAction triggerEvaluate=new NodeActionConstant(false);
  NodeAction triggerCheck=new NodeActionInverse(triggerSkip);
  NodeAction triggerTag=new NodeActionConstant(false);
  NodeAction triggerFireEvent=new NodeActionOR(triggerSkip){
    @Override protected boolean additionalConditionAppliesTo(    Transformation node){
      return node.hasProperty(solutionSpace.getPropertySuccessorsPruned());
    }
  }
;
  FLASHConfiguration config=FLASHConfiguration.createLinearPhaseConfiguration(new FLASHPhaseConfiguration(anonymityProperty,triggerTag,triggerCheck,triggerEvaluate,triggerSkip),triggerFireEvent,StorageStrategy.ALL,true,false);
  return new FLASHAlgorithmImpl(solutionSpace,checker,strategy,config);
}
Program: 108145
Project: 108145
Buggy source:
/** 
 * Checks a path binary.
 * @param path The path
 * @param triggerSkip
 * @param queue
 * @return
 */
private int checkPath(List<Integer> path,NodeAction triggerSkip,PriorityQueue<Integer> queue){
  PredictiveProperty anonymityProperty=config.getBinaryPhaseConfiguration().getAnonymityProperty();
  int low=0;
  int high=path.size() - 1;
  int lastAnonymousIdentifier=-1;
  while (low <= high) {
    final int mid=(low + high) / 2;
    final int identifier=path.get(mid);
    Transformation transformation=solutionSpace.getTransformation(identifier);
    if (!skip(triggerSkip,transformation)) {
      checkAndTag(transformation,config.getBinaryPhaseConfiguration());
      if (!transformation.hasProperty(anonymityProperty)) {
        for (        final int up : getSortedSuccessors(identifier)) {
          if (!skip(triggerSkip,solutionSpace.getTransformation(up))) {
            queue.add(up);
          }
        }
      }
      if (transformation.hasProperty(anonymityProperty)) {
        lastAnonymousIdentifier=identifier;
        high=mid - 1;
      }
 else {
        low=mid + 1;
      }
    }
 else {
      high=mid - 1;
    }
  }
  return lastAnonymousIdentifier;
}

Fixed version (ground truth):
/** 
 * Checks a path binary.
 * @param path The path
 * @param triggerSkip
 * @param queue
 * @return
 */
private int checkPath(List<Integer> path,NodeAction triggerSkip,PriorityQueue<Integer> queue){
  PredictiveProperty anonymityProperty=config.getBinaryPhaseConfiguration().getAnonymityProperty() == PhaseAnonymityProperty.ANONYMITY ? solutionSpace.getPropertyAnonymous() : solutionSpace.getPropertyKAnonymous();
  int low=0;
  int high=path.size() - 1;
  int lastAnonymousIdentifier=-1;
  while (low <= high) {
    final int mid=(low + high) / 2;
    final int identifier=path.get(mid);
    Transformation transformation=solutionSpace.getTransformation(identifier);
    if (!skip(triggerSkip,transformation)) {
      checkAndTag(transformation,config.getBinaryPhaseConfiguration());
      if (!transformation.hasProperty(anonymityProperty)) {
        for (        final int up : getSortedSuccessors(identifier)) {
          if (!skip(triggerSkip,solutionSpace.getTransformation(up))) {
            queue.add(up);
          }
        }
      }
      if (transformation.hasProperty(anonymityProperty)) {
        lastAnonymousIdentifier=identifier;
        high=mid - 1;
      }
 else {
        low=mid + 1;
      }
    }
 else {
      high=mid - 1;
    }
  }
  return lastAnonymousIdentifier;
}
Program: 108146
Project: 108146
Buggy source:
/** 
 * Creates a configuration for an active phase.
 * @param anonymityProperty
 * @param triggerTag
 * @param triggerCheck
 * @param triggerEvaluate
 * @param triggerSkip
 */
public FLASHPhaseConfiguration(PredictiveProperty anonymityProperty,NodeAction triggerTag,NodeAction triggerCheck,NodeAction triggerEvaluate,NodeAction triggerSkip){
  this.anonymityProperty=anonymityProperty;
  this.triggerTag=triggerTag;
  this.triggerCheck=triggerCheck;
  this.triggerEvaluate=triggerEvaluate;
  this.triggerSkip=triggerSkip;
}

Fixed version (ground truth):
/** 
 * Creates a configuration for an active phase.
 * @param anonymityProperty
 * @param triggerTag
 * @param triggerCheck
 * @param triggerEvaluate
 * @param triggerSkip
 */
public FLASHPhaseConfiguration(PhaseAnonymityProperty anonymityProperty,NodeAction triggerTag,NodeAction triggerCheck,NodeAction triggerEvaluate,NodeAction triggerSkip){
  this.anonymityProperty=anonymityProperty;
  this.triggerTag=triggerTag;
  this.triggerCheck=triggerCheck;
  this.triggerEvaluate=triggerEvaluate;
  this.triggerSkip=triggerSkip;
}
Program: 108147
Project: 108147
Buggy source:
/** 
 * Getter: The main anonymity property.
 * @return
 */
public PredictiveProperty getAnonymityProperty(){
  return anonymityProperty;
}

Fixed version (ground truth):
/** 
 * Getter: The main anonymity property.
 * @return
 */
public PhaseAnonymityProperty getAnonymityProperty(){
  return anonymityProperty;
}
Program: 108148
Project: 108148
Buggy source:
/** 
 * Implements the FLASH algorithm (without outer loop).
 * @param start
 * @param queue
 */
private void binarySearch(int start,PriorityQueue<Integer> queue){
  NodeAction triggerSkip=config.getBinaryPhaseConfiguration().getTriggerSkip();
  queue.add(start);
  while (!queue.isEmpty()) {
    Integer head=queue.poll();
    if (!skip(triggerSkip,solutionSpace.getTransformation(head))) {
      List<Integer> path=findPath(head,triggerSkip);
      head=checkPath(path,triggerSkip,queue);
      if (config.isLinearPhaseRequired() && (head != null)) {
        linearSearch(head);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Implements the FLASH algorithm (without outer loop).
 * @param start
 * @param queue
 */
private void binarySearch(int start,PriorityQueue<Integer> queue){
  NodeAction triggerSkip=config.getBinaryPhaseConfiguration().getTriggerSkip();
  queue.add(start);
  while (!queue.isEmpty()) {
    Integer head=queue.poll();
    if (!skip(triggerSkip,solutionSpace.getTransformation(head))) {
      List<Integer> path=findPath(head,triggerSkip);
      head=checkPath(path,triggerSkip,queue);
      if (config.isLinearPhaseRequired() && (head != -1)) {
        linearSearch(head);
      }
    }
  }
}
Program: 108149
Project: 108149
Buggy source:
/** 
 * Sets the property to all neighbors
 * @param property
 */
public void setPropertyToNeighbours(PredictiveProperty property){
  Iterator<int[]> neighbors;
  if (property.getDirection() == Direction.UP) {
    neighbors=lattice.nodes().listSuccessors(transformationJHPL);
  }
 else   if (property.getDirection() == Direction.DOWN) {
    neighbors=lattice.nodes().listPredecessors(transformationJHPL);
  }
 else {
    return;
  }
  for (; neighbors.hasNext(); ) {
    lattice.putProperty(neighbors.next(),property);
  }
}

Fixed version (ground truth):
/** 
 * Sets the property to all neighbors
 * @param property
 */
public void setPropertyToNeighbours(PredictiveProperty property){
  Iterator<Long> neighbors;
  if (property.getDirection() == Direction.UP) {
    neighbors=lattice.space().indexIteratorToIdIterator(lattice.nodes().listSuccessors(transformationJHPL));
  }
 else   if (property.getDirection() == Direction.DOWN) {
    neighbors=lattice.space().indexIteratorToIdIterator(lattice.nodes().listPredecessors(transformationJHPL));
  }
 else {
    return;
  }
  LongArrayList list=new LongArrayList();
  for (; neighbors.hasNext(); ) {
    list.add(neighbors.next());
  }
  for (  long id : list.toArray()) {
    lattice.putProperty(lattice.space().toIndex(id),property);
  }
}
Program: 108150
Project: 108150
Buggy source:
@Override protected double getAggregate(){
  double[] values=getValues();
  double[] weights=getWeights();
  double result=1.0d;
  for (int i=0; i < values.length; i++) {
    result*=Math.pow((values[i] + 1d) * weights[i],1.0d / (double)values.length);
  }
  return result - 1d;
}

Fixed version (ground truth):
@Override protected double getAggregate(){
  double[] values=getValues();
  double[] weights=getWeights();
  double result=1.0d;
  for (int i=0; i < values.length; i++) {
    result*=Math.pow((values[i] * weights[i] + 1d),1.0d / (double)values.length);
  }
  return result - 1d;
}
Program: 108152
Project: 108152
Buggy source:
/** 
 * Returns the attributes for which generlaization is specified.
 * @return
 */
public Set<String> getGeneralizationAttributes(){
  final Set<String> result=new HashSet<String>();
  for (  final Entry<String,AttributeType> entry : attributeTypes.entrySet()) {
    if (entry.getValue().getType() == AttributeType.ATTR_TYPE_QI && entry.getValue() instanceof Hierarchy) {
      result.add(entry.getKey());
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Returns the attributes for which generlaization is specified.
 * @return
 */
public Set<String> getGeneralizationAttributes(){
  final Set<String> result=new HashSet<String>();
  for (  final Entry<String,AttributeType> entry : attributeTypes.entrySet()) {
    if (entry.getValue().getType() == AttributeType.ATTR_TYPE_QI && !(entry.getValue() instanceof Microaggregation)) {
      result.add(entry.getKey());
    }
  }
  return result;
}
Program: 108153
Project: 108153
Buggy source:
@Override public void microaggregate(final int[][] data,final Data bufferOT,final int startMA,final int numMA,final MicroaggregateFunction[] functions){
  Map<Distribution,Integer> cache=new HashMap<Distribution,Integer>();
  for (int row=0; row < data.length; row++) {
    if (subset == null || subset.contains(row)) {
      final int[] key=data[row];
      final int hash=HashTableUtil.hashcode(key);
      final int index=hash & (buckets.length - 1);
      HashGroupifyEntry m=buckets[index];
      while ((m != null) && ((m.hashcode != hash) || !equalsIgnoringOutliers(key,m.key))) {
        m=m.next;
      }
      if (m == null) {
        throw new RuntimeException("String_Node_Str");
      }
      Distribution[] dis=m.distributions;
      int cnt=0;
      for (int i=startMA; i < numMA; i++) {
        if (!cache.containsKey(dis[i])) {
          String result=functions[cnt].aggregate(dis[i]);
          int code=bufferOT.getDictionary().register(cnt,result);
          cache.put(dis[i],code);
        }
        bufferOT.getArray()[row][cnt]=cache.get(dis[i]);
        cnt++;
      }
    }
  }
  bufferOT.getDictionary().finalizeAll();
}

Fixed version (ground truth):
@Override public void microaggregate(final int[][] data,final Data bufferOT,final int startMA,final int numMA,final MicroaggregateFunction[] functions){
  Map<Distribution,Integer> cache=new HashMap<Distribution,Integer>();
  for (int row=0; row < data.length; row++) {
    if (subset == null || subset.contains(row)) {
      final int[] key=data[row];
      final int hash=HashTableUtil.hashcode(key);
      final int index=hash & (buckets.length - 1);
      HashGroupifyEntry m=buckets[index];
      while ((m != null) && ((m.hashcode != hash) || !equalsIgnoringOutliers(key,m.key))) {
        m=m.next;
      }
      if (m == null) {
        throw new RuntimeException("String_Node_Str");
      }
      Distribution[] dis=m.distributions;
      int cnt=0;
      for (int i=startMA; i < startMA + numMA; i++) {
        if (!cache.containsKey(dis[i])) {
          String result=functions[cnt].aggregate(dis[i]);
          int code=bufferOT.getDictionary().register(cnt,result);
          cache.put(dis[i],code);
        }
        bufferOT.getArray()[row][cnt]=cache.get(dis[i]);
        cnt++;
      }
    }
  }
  bufferOT.getDictionary().finalizeAll();
}
Program: 108154
Project: 108154
Buggy source:
/** 
 * Creates the data type array.
 * @return
 */
@Override protected DataType<?>[][] getDataTypeArray(){
  DataType<?>[][] dataTypes=new DataType[5][];
  dataTypes[AttributeTypeInternal.INSENSITIVE]=new DataType[dataIS.getHeader().length];
  dataTypes[AttributeTypeInternal.SENSITIVE]=new DataType[dataDI.getHeader().length];
  dataTypes[AttributeTypeInternal.GENERALIZATION]=new DataType[dataGH.getHeader().length];
  dataTypes[AttributeTypeInternal.MICROAGGREGATION]=new DataType[dataOT.getHeader().length];
  dataTypes[AttributeTypeInternal.IDENTIFIER]=null;
  for (int i=0; i < dataTypes.length; i++) {
    final DataType<?>[] type=dataTypes[i];
    String[] header=null;
switch (i) {
case AttributeTypeInternal.INSENSITIVE:
      header=dataIS.getHeader();
    break;
case AttributeTypeInternal.GENERALIZATION:
  header=dataGH.getHeader();
break;
case AttributeTypeInternal.SENSITIVE:
header=dataDI.getHeader();
break;
case AttributeTypeInternal.MICROAGGREGATION:
header=dataOT.getHeader();
break;
}
if (type != null) {
for (int j=0; j < type.length; j++) {
if (dataTypes[i][j] != null) {
dataTypes[i][j]=definition.getDataType(header[j]);
if ((i == AttributeTypeInternal.GENERALIZATION) && (node.getTransformation()[j] > 0)) {
dataTypes[i][j]=DataType.STRING;
}
}
}
}
}
return dataTypes;
}

Fixed version (ground truth):
/** 
 * Creates the data type array.
 * @return
 */
@Override protected DataType<?>[][] getDataTypeArray(){
  DataType<?>[][] dataTypes=new DataType[5][];
  dataTypes[AttributeTypeInternal.INSENSITIVE]=new DataType[dataIS.getHeader().length];
  dataTypes[AttributeTypeInternal.SENSITIVE]=new DataType[dataDI.getHeader().length];
  dataTypes[AttributeTypeInternal.GENERALIZATION]=new DataType[dataGH.getHeader().length];
  dataTypes[AttributeTypeInternal.MICROAGGREGATION]=new DataType[dataOT.getHeader().length];
  dataTypes[AttributeTypeInternal.IDENTIFIER]=null;
  for (int i=0; i < dataTypes.length; i++) {
    final DataType<?>[] type=dataTypes[i];
    String[] header=null;
switch (i) {
case AttributeTypeInternal.INSENSITIVE:
      header=dataIS.getHeader();
    break;
case AttributeTypeInternal.GENERALIZATION:
  header=dataGH.getHeader();
break;
case AttributeTypeInternal.SENSITIVE:
header=dataDI.getHeader();
break;
case AttributeTypeInternal.MICROAGGREGATION:
header=dataOT.getHeader();
break;
}
if (type != null) {
for (int j=0; j < type.length; j++) {
dataTypes[i][j]=definition.getDataType(header[j]);
if ((i == AttributeTypeInternal.GENERALIZATION) && (node.getTransformation()[j] > 0)) {
dataTypes[i][j]=DataType.STRING;
}
}
}
}
return dataTypes;
}
Program: 108155
Project: 108155
Buggy source:
/** 
 * Updates the valid functions based on the datatype.
 */
private void updateValidFunctions(){
  List<MicroaggregationFunctionDescription> functions=MicroaggregateFunction.list();
  List<String> items=new ArrayList<String>();
  List<MicroaggregationFunctionDescription> validFunctions=new ArrayList<MicroaggregationFunctionDescription>();
  for (int i=0; i < functions.size(); i++) {
    MicroaggregationFunctionDescription function=functions.get(i);
    if (function.getRequiredScaleOfMeasure().compareTo(model.getInputDefinition().getDataType(attribute).getScaleOfMeasure()) <= 0) {
      items.add(function.getLabel());
      validFunctions.add(function);
    }
  }
  this.validFunctions=validFunctions.toArray(new MicroaggregationFunctionDescription[validFunctions.size()]);
  if (items.size() > 0) {
    functionCombo.setItems(items.toArray(new String[items.size()]));
    functionCombo.setEnabled(true);
    selectfunction(0);
    microaggregationButton.setEnabled(true);
  }
 else {
    functionCombo.setItems(new String[]{"String_Node_Str"});
    functionCombo.setEnabled(false);
    functionCombo.select(0);
    microaggregationButton.setEnabled(false);
  }
}

Fixed version (ground truth):
/** 
 * Updates the valid functions based on the datatype.
 */
private void updateValidFunctions(){
  List<MicroaggregationFunctionDescription> functions=MicroaggregateFunction.list();
  List<String> items=new ArrayList<String>();
  List<MicroaggregationFunctionDescription> validFunctions=new ArrayList<MicroaggregationFunctionDescription>();
  for (int i=0; i < functions.size(); i++) {
    MicroaggregationFunctionDescription function=functions.get(i);
    if (function.getRequiredScaleOfMeasure().compareTo(model.getInputDefinition().getDataType(attribute).getScaleOfMeasure()) <= 0) {
      items.add(function.getLabel());
      validFunctions.add(function);
    }
  }
  this.validFunctions=validFunctions.toArray(new MicroaggregationFunctionDescription[validFunctions.size()]);
  if (items.size() > 0) {
    functionCombo.setItems(items.toArray(new String[items.size()]));
    functionCombo.setEnabled(true);
    restoreStoredFunction();
    microaggregationButton.setEnabled(true);
  }
 else {
    functionCombo.setItems(new String[]{"String_Node_Str"});
    functionCombo.setEnabled(false);
    functionCombo.select(0);
    microaggregationButton.setEnabled(false);
  }
}
Program: 108156
Project: 108156
Buggy source:
@Override public void update(ModelEvent event){
  if (event.part == ModelPart.ATTRIBUTE_TYPE) {
    final String attr=(String)event.data;
    if (attr.equals(attribute)) {
      updateValidFunctions();
      if (model != null && model.getInputConfig() != null) {
        MicroaggregationFunctionDescription restoredFunction=model.getInputConfig().getMicroaggregationFunctionDescription(attribute);
        for (int i=0; i < validFunctions.length; i++) {
          MicroaggregationFunctionDescription function=validFunctions[i];
          if (function.equals(restoredFunction)) {
            selectfunction(i);
            break;
          }
        }
      }
    }
  }
 else   if (event.part == ModelPart.DATA_TYPE) {
    updateValidFunctions();
  }
}

Fixed version (ground truth):
@Override public void update(ModelEvent event){
  if (event.part == ModelPart.ATTRIBUTE_TYPE) {
    final String attr=(String)event.data;
    if (attr.equals(attribute)) {
      updateValidFunctions();
      restoreStoredFunction();
    }
  }
 else   if (event.part == ModelPart.DATA_TYPE) {
    updateValidFunctions();
  }
}
Program: 108157
Project: 108157
Buggy source:
/** 
 * Returns a table. Implements hacks for fixing OSX bugs.
 * @param parent
 * @param style
 * @return
 */
public static Table createTable(Composite parent,int style){
  return new Table(parent,getTableStyle(style));
}

Fixed version (ground truth):
/** 
 * Returns a table. Implements hacks for fixing OSX bugs.
 * @param parent
 * @param style
 * @return
 */
public static Table createTable(Composite parent,int style){
  Table table=new Table(parent,style);
  fixOSXTableBug(table);
  return table;
}
Program: 108158
Project: 108158
Buggy source:
@Override public void widgetSelected(SelectionEvent arg0){
  controller.actionShowHelpDialog(id);
}

Fixed version (ground truth):
@Override public void widgetSelected(SelectionEvent arg0){
  table.redraw();
}