nus-yam/ex-repair huggingface dataset:
Program: 107823
Project: 107823
Buggy source:
@Override public void update(ModelEvent event){
  super.update(event);
  if (event.part == ModelPart.SELECTED_FEATURES_OR_CLASSES || event.part == ModelPart.DATA_TYPE) {
    if (getModel() != null && (getModel().getSelectedFeatures().isEmpty() || getModel().getSelectedClasses().isEmpty())) {
      doReset();
      return;
    }
 else {
      triggerUpdate();
    }
  }
  if (event.part == ModelPart.SELECTED_ATTRIBUTE) {
    int index=0;
    for (    TableItem item : precisionRecallTable.getItems()) {
      if (item.getText(0).equals(super.getModel().getSelectedAttribute())) {
        precisionRecallTable.select(index);
        if (item.getData() != null && item.getData() instanceof PrecisionRecallMatrix) {
          precisionRecallSetChartSeries((PrecisionRecallMatrix)item.getData());
        }
        break;
      }
      index++;
    }
    final String selectedAttribute=(String)event.data;
    for (int i=0; i < rocCombo.getItemCount(); i++) {
      if (rocCombo.getItem(i).equals(selectedAttribute)) {
        rocCombo.select(i);
        rocUpdateTableAndChart(selectedAttribute);
        break;
      }
    }
  }
  if (event.part == ModelPart.SELECTED_CLASS_VALUE) {
    int index=0;
    for (    TableItem item : precisionRecallTable.getItems()) {
      if (item.getText(0).equals(super.getModel().getSelectedClassValue())) {
        precisionRecallTable.select(index);
        if (item.getData() != null) {
          rocSetChartSeries((ROCCurve[])item.getData());
        }
        return;
      }
      index++;
    }
  }
}

Fixed version (ground truth):
@Override public void update(ModelEvent event){
  super.update(event);
  if (event.part == ModelPart.SELECTED_FEATURES_OR_CLASSES || event.part == ModelPart.DATA_TYPE) {
    if (getModel() != null && (getModel().getSelectedFeatures().isEmpty() || getModel().getSelectedClasses().isEmpty())) {
      doReset();
      return;
    }
 else {
      triggerUpdate();
    }
  }
  if (event.part == ModelPart.SELECTED_ATTRIBUTE) {
    int index=0;
    for (    TableItem item : precisionRecallTable.getItems()) {
      if (item.getText(0).equals(super.getModel().getSelectedAttribute())) {
        precisionRecallTable.select(index);
        if (item.getData() != null && item.getData() instanceof PrecisionRecallMatrix) {
          precisionRecallSetChartSeries((PrecisionRecallMatrix)item.getData());
        }
        break;
      }
      index++;
    }
    final String selectedAttribute=(String)event.data;
    for (int i=0; i < rocCombo.getItemCount(); i++) {
      if (rocCombo.getItem(i).equals(selectedAttribute)) {
        rocCombo.select(i);
        rocUpdateTableAndChart(selectedAttribute);
        break;
      }
    }
  }
  if (event.part == ModelPart.SELECTED_CLASS_VALUE) {
    int index=0;
    for (    TableItem item : rocTable.getItems()) {
      if (item.getText(0).equals(super.getModel().getSelectedClassValue())) {
        rocTable.select(index);
        if (item.getData() != null) {
          rocSetChartSeries((ROCCurve[])item.getData());
        }
        return;
      }
      index++;
    }
  }
}
Program: 107824
Project: 107824
Buggy source:
@Override protected int internalGetEncodedValue(final int row,final int column,final boolean ignoreSuppression){
  return data[row][column];
}

Fixed version (ground truth):
@Override protected int internalGetEncodedValue(final int row,final int column,final boolean ignoreSuppression){
  return data.get(row,column);
}
Program: 107825
Project: 107825
Buggy source:
/** 
 * Returns a summary statistics object for the given attribute
 * @param generalization
 * @param dataType
 * @param baseDataType
 * @param hierarchy
 * @return
 */
private <U,V>StatisticsSummaryOrdinal getSummaryStatisticsOrdinal(final int generalization,final DataType<U> dataType,final DataType<V> baseDataType,final String[][] hierarchy){
  if (generalization == 0 || !(dataType instanceof ARXString)) {
    return new StatisticsSummaryOrdinal(dataType);
  }
 else   if (baseDataType instanceof ARXString) {
    return new StatisticsSummaryOrdinal(dataType);
  }
 else   if (hierarchy == null) {
    return new StatisticsSummaryOrdinal(dataType);
  }
 else {
    final Map<String,String> map=new HashMap<String,String>();
    for (int i=0; i < hierarchy.length; i++) {
      map.put(hierarchy[i][generalization],hierarchy[i][0]);
    }
    return new StatisticsSummaryOrdinal(new Comparator<String>(){
      public int compare(      String o1,      String o2){
        V _o1=null;
        try {
          _o1=baseDataType.parse(map.get(o1));
        }
 catch (        Exception e) {
        }
        V _o2=null;
        try {
          _o2=baseDataType.parse(map.get(o2));
        }
 catch (        Exception e) {
        }
        try {
          return baseDataType.compare(_o1,_o2);
        }
 catch (        Exception e) {
          return 0;
        }
      }
    }
);
  }
}

Fixed version (ground truth):
/** 
 * Returns a summary statistics object for the given attribute
 * @param generalization
 * @param dataType
 * @param baseDataType
 * @param hierarchy
 * @return
 */
private <U,V>StatisticsSummaryOrdinal<?> getSummaryStatisticsOrdinal(final int generalization,final DataType<U> dataType,final DataType<V> baseDataType,final String[][] hierarchy){
  if (generalization == 0 || !(dataType instanceof ARXString)) {
    return new StatisticsSummaryOrdinal<U>(dataType);
  }
 else   if (baseDataType instanceof ARXString) {
    return new StatisticsSummaryOrdinal<U>(dataType);
  }
 else   if (hierarchy == null) {
    return new StatisticsSummaryOrdinal<U>(dataType);
  }
 else {
    final Map<String,String> map=new HashMap<String,String>();
    for (int i=0; i < hierarchy.length; i++) {
      map.put(hierarchy[i][generalization],hierarchy[i][0]);
    }
    return new StatisticsSummaryOrdinal<V>(new Comparator<String>(){
      public int compare(      String o1,      String o2){
        V _o1=null;
        try {
          _o1=baseDataType.parse(map.get(o1));
        }
 catch (        Exception e) {
        }
        V _o2=null;
        try {
          _o2=baseDataType.parse(map.get(o2));
        }
 catch (        Exception e) {
        }
        try {
          return baseDataType.compare(_o1,_o2);
        }
 catch (        Exception e) {
          return 0;
        }
      }
    }
);
  }
}
Program: 107827
Project: 107827
Buggy source:
/** 
 * Constructor
 * @param type
 */
StatisticsSummaryOrdinal(final DataType<?> type){
  this.type=type;
  this.comparator=new Comparator<String>(){
    @Override public int compare(    String o1,    String o2){
      try {
        return type.compare(o1,o2);
      }
 catch (      NumberFormatException|ParseException e) {
        throw new RuntimeException(e);
      }
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param type
 */
StatisticsSummaryOrdinal(final DataType<T> type){
  this.type=type;
  this.comparator=new Comparator<String>(){
    @Override public int compare(    String o1,    String o2){
      try {
        return type.compare(o1,o2);
      }
 catch (      NumberFormatException|ParseException e) {
        throw new RuntimeException(e);
      }
    }
  }
;
}
Program: 107828
Project: 107828
Buggy source:
/** 
 * Creates a new data handle.
 * @param data
 */
protected DataHandleInput(final Data data){
  Iterator<String[]> iterator=data.iterator();
  if (!iterator.hasNext()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.setRegistry(new DataRegistry());
  this.getRegistry().updateInput(this);
  this.definition=data.getDefinition().clone();
  String[] columns=iterator.next();
  super.header=Arrays.copyOf(columns,columns.length);
  this.dictionary=new Dictionary(header.length);
  List<int[]> vals=new ArrayList<int[]>();
  while (iterator.hasNext()) {
    String[] strings=iterator.next();
    int[] tuple=new int[header.length];
    for (int i=0; i < header.length; i++) {
      String value=(i < strings.length) ? strings[i] : DataType.NULL_VALUE;
      value=(value != null) ? value : DataType.NULL_VALUE;
      tuple[i]=dictionary.register(i,value);
    }
    vals.add(tuple);
  }
  this.data=new DataMatrix(vals.size(),header.length);
  for (int row=0; row < vals.size(); row++) {
    this.data.setRow(row,vals.get(row));
  }
  this.dictionary.finalizeAll();
  this.columnToDataType=getColumnToDataType();
}

Fixed version (ground truth):
/** 
 * Creates a new data handle.
 * @param data
 */
protected DataHandleInput(final Data data){
  Iterator<String[]> iterator=data.iterator();
  if (!iterator.hasNext()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.setRegistry(new DataRegistry());
  this.getRegistry().updateInput(this);
  this.definition=data.getDefinition().clone();
  String[] columns=iterator.next();
  super.setHeader(Arrays.copyOf(columns,columns.length));
  this.dictionary=new Dictionary(header.length);
  List<int[]> vals=new ArrayList<int[]>();
  while (iterator.hasNext()) {
    String[] strings=iterator.next();
    int[] tuple=new int[header.length];
    for (int i=0; i < header.length; i++) {
      String value=(i < strings.length) ? strings[i] : DataType.NULL_VALUE;
      value=(value != null) ? value : DataType.NULL_VALUE;
      tuple[i]=dictionary.register(i,value);
    }
    vals.add(tuple);
  }
  this.data=new DataMatrix(vals.size(),header.length);
  for (int row=0; row < vals.size(); row++) {
    this.data.setRow(row,vals.get(row));
  }
  this.dictionary.finalizeAll();
  this.columnToDataType=getColumnToDataType();
}
Program: 107829
Project: 107829
Buggy source:
/** 
 * Materializes all functional hierarchies.
 * @param handle
 */
protected void materializeHierarchies(DataHandle handle){
  Set<String> attributes=new HashSet<>(this.getQuasiIdentifiersWithGeneralization());
  attributes.addAll(this.getQuasiIdentifiersWithClusteringAndMicroaggregation());
  for (  String attribute : attributes) {
    String[] data=handle.getDistinctValues(handle.getColumnIndexOf(attribute));
    if (isHierarchyBuilderAvailable(attribute)) {
      try {
        this.hierarchies.put(attribute,this.getHierarchyBuilder(attribute).build(data));
      }
 catch (      Exception e) {
        throw new IllegalStateException("String_Node_Str" + attribute + "String_Node_Str",e);
      }
    }
 else {
      String[][] hierarchy=new String[data.length][];
      for (int i=0; i < data.length; i++) {
        hierarchy[i]=new String[]{data[i]};
      }
      this.hierarchies.put(attribute,Hierarchy.create(hierarchy));
    }
  }
}

Fixed version (ground truth):
/** 
 * Materializes all functional hierarchies.
 * @param handle
 */
protected void materializeHierarchies(DataHandle handle){
  Set<String> attributes=new HashSet<>(this.getQuasiIdentifiersWithGeneralization());
  attributes.addAll(this.getQuasiIdentifiersWithClusteringAndMicroaggregation());
  for (  String attribute : attributes) {
    String[] data=handle.getDistinctValues(handle.getColumnIndexOf(attribute));
    if (isHierarchyBuilderAvailable(attribute)) {
      try {
        this.hierarchies.put(attribute,this.getHierarchyBuilder(attribute).build(data));
      }
 catch (      Exception e) {
        throw new IllegalStateException("String_Node_Str" + attribute + "String_Node_Str",e);
      }
    }
 else     if (!isHierarchyAvailable(attribute)) {
      String[][] hierarchy=new String[data.length][];
      for (int i=0; i < data.length; i++) {
        hierarchy[i]=new String[]{data[i]};
      }
      this.hierarchies.put(attribute,Hierarchy.create(hierarchy));
    }
  }
}
Program: 107830
Project: 107830
Buggy source:
/** 
 * Returns an array of indices for the given subset of strings. The first set will be encoded first. The second must be a subset of the first.
 * @param header
 * @param first
 * @param second
 * @return
 */
private int[] getColumns(String[] header,Set<String> first,Set<String> second){
  int[] result=new int[first.size()];
  int index=0;
  for (int i=0; i < header.length; i++) {
    if (first.contains(header[i]) && !second.contains(header)) {
      result[index++]=i;
    }
  }
  for (int i=0; i < header.length; i++) {
    if (first.contains(header[i]) && second.contains(header)) {
      result[index++]=i;
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Returns an array of indices for the given subset of strings. The first set will be encoded first. The second must be a subset of the first.
 * @param header
 * @param first
 * @param second
 * @return
 */
private int[] getColumns(String[] header,Set<String> first,Set<String> second){
  int[] result=new int[first.size()];
  int index=0;
  for (int i=0; i < header.length; i++) {
    String attribute=header[i];
    if (first.contains(attribute) && !second.contains(attribute)) {
      result[index++]=i;
    }
  }
  for (int i=0; i < header.length; i++) {
    String attribute=header[i];
    if (first.contains(attribute) && second.contains(attribute)) {
      result[index++]=i;
    }
  }
  return result;
}
Program: 107831
Project: 107831
Buggy source:
/** 
 * Updates the definition with further data to swap.
 * @param matrixGH
 * @param matrixDI
 * @param matrixIS
 */
protected void update(DataMatrix matrixGH,DataMatrix matrixDI,DataMatrix matrixIS){
  this.dataGH=matrixGH;
  this.dataDI=matrixDI;
  this.dataIS=matrixIS;
}

Fixed version (ground truth):
/** 
 * Updates the definition with further data to swap.
 * @param dataGeneralized
 * @param dataAnalyzed
 * @param matrixIS
 */
protected void update(DataMatrix dataGeneralized,DataMatrix dataAnalyzed){
  this.dataGeneralized=dataGeneralized;
  this.dataAnalyzed=dataAnalyzed;
}
Program: 107832
Project: 107832
Buggy source:
/** 
 * Swaps the rows.
 * @param row1
 * @param row2
 */
protected void internalSwap(final int row1,final int row2){
  checkRow(row1,data.getNumRows());
  checkRow(row2,data.getNumRows());
  swap(row1,row2,data);
  if (dataGH != null)   swap(row1,row2,dataGH);
  if (dataDI != null)   swap(row1,row2,dataDI);
  if (dataIS != null)   swap(row1,row2,dataIS);
}

Fixed version (ground truth):
/** 
 * Swaps the rows.
 * @param row1
 * @param row2
 */
protected void internalSwap(final int row1,final int row2){
  checkRow(row1,data.getNumRows());
  checkRow(row2,data.getNumRows());
  data.swap(row1,row2);
  if (dataGeneralized != null)   dataGeneralized.swap(row1,row2);
  if (dataAnalyzed != null)   dataAnalyzed.swap(row1,row2);
}
Program: 107833
Project: 107833
Buggy source:
/** 
 * Releases all resources.
 */
protected void doRelease(){
  this.setLocked(false);
  dataGH=null;
  dataDI=null;
  dataIS=null;
}

Fixed version (ground truth):
/** 
 * Releases all resources.
 */
protected void doRelease(){
  this.setLocked(false);
  dataGeneralized=null;
  dataAnalyzed=null;
}
Program: 107834
Project: 107834
Buggy source:
/** 
 * Returns the input buffer
 * @return
 */
protected DataMatrix getInputBuffer(){
  checkRegistry();
  return this.dataGH;
}

Fixed version (ground truth):
/** 
 * Returns the input buffer
 * @return
 */
protected DataMatrix getInputBuffer(){
  checkRegistry();
  return this.dataGeneralized;
}
Program: 107835
Project: 107835
Buggy source:
/** 
 * Releases all resources.
 */
protected void doRelease(){
  result.releaseBuffer(this);
  node=null;
  dataStatic=null;
  dataGeneralized=null;
  dataAggregated=null;
  registry=null;
  subset=null;
  columnToDataType=null;
  columnToIndex=null;
  columnToData=null;
  definition=null;
  header=null;
  headerMap=null;
  node=null;
}

Fixed version (ground truth):
/** 
 * Releases all resources.
 */
protected void doRelease(){
  result.releaseBuffer(this);
  node=null;
  dataInput=null;
  dataGeneralized=null;
  dataAggregated=null;
  registry=null;
  subset=null;
  columnToDataType=null;
  columnToIndex=null;
  columnToData=null;
  definition=null;
  header=null;
  headerMap=null;
  node=null;
}
Program: 107836
Project: 107836
Buggy source:
/** 
 * Initialization method
 * @param result
 * @param registry
 * @param manager
 * @param outputGeneralized
 * @param outputMicroaggregated
 * @param node
 * @param definition
 * @param config
 */
private void initialize(final ARXResult result,final DataRegistry registry,final DataManager manager,final Data outputGeneralized,final Data outputMicroaggregated,final ARXNode node,final DataDefinition definition,final ARXConfiguration config){
  registry.updateOutput(node,this);
  this.setRegistry(registry);
  this.dataGeneralized=outputGeneralized;
  this.dataAggregated=outputMicroaggregated;
  this.dataStatic=manager.getDataStatic();
  this.setHeader(manager.getHeader());
  this.columnToData=new Data[header.length];
  this.columnToIndex=new int[header.length];
  for (  Data data : new Data[]{dataStatic,dataGeneralized,dataAggregated}) {
    for (int i=0; i < data.getHeader().length; i++) {
      int column=data.getColumns()[i];
      this.columnToIndex[column]=i;
      this.columnToData[column]=data;
    }
  }
  this.columnToSuppressionStatus=getColumnToSuppressionStatus(config,definition);
  this.result=result;
  this.definition=definition;
  this.anonymous=node.getAnonymity() == Anonymity.ANONYMOUS;
  this.node=node;
  this.getRegistry().createOutputSubset(node,config);
}

Fixed version (ground truth):
/** 
 * Initialization method
 * @param result
 * @param registry
 * @param manager
 * @param outputGeneralized
 * @param outputMicroaggregated
 * @param node
 * @param definition
 * @param config
 */
private void initialize(final ARXResult result,final DataRegistry registry,final DataManager manager,final Data outputGeneralized,final Data outputMicroaggregated,final ARXNode node,final DataDefinition definition,final ARXConfiguration config){
  registry.updateOutput(node,this);
  this.setRegistry(registry);
  this.dataGeneralized=outputGeneralized;
  this.dataAggregated=outputMicroaggregated;
  this.dataInput=manager.getDataInput();
  this.setHeader(manager.getHeader());
  this.columnToData=new Data[header.length];
  this.columnToIndex=new int[header.length];
  for (  Data data : new Data[]{dataGeneralized,dataAggregated}) {
    for (int i=0; i < data.getHeader().length; i++) {
      int column=data.getColumns()[i];
      this.columnToIndex[column]=i;
      this.columnToData[column]=data;
    }
  }
  for (int column=0; column < header.length; column++) {
    String attribute=header[column];
    if (definition.getSensitiveAttributes().contains(attribute) || definition.getInsensitiveAttributes().contains(attribute)) {
      this.columnToIndex[column]=column;
      this.columnToData[column]=dataInput;
    }
  }
  this.columnToSuppressionStatus=getColumnToSuppressionStatus(config,definition);
  this.result=result;
  this.definition=definition;
  this.anonymous=node.getAnonymity() == Anonymity.ANONYMOUS;
  this.node=node;
  this.getRegistry().createOutputSubset(node,config);
}
Program: 107837
Project: 107837
Buggy source:
/** 
 * Returns an instance of this data manager, that is projected onto the given rowset
 * @param rowset
 * @return
 */
public DataManager getSubsetInstance(RowSet rowset){
  return new DataManagerSubset(this,dataAnalyzed.getSubsetInstance(rowset),dataGeneralized.getSubsetInstance(rowset),dataStatic.getSubsetInstance(rowset),definition,shares,header,hierarchiesGeneralized,hierarchiesAnalyzed,generalizationLevelsMinimum,generalizationLevelsMaximum,microaggregationData.getSubsetInstance());
}

Fixed version (ground truth):
/** 
 * Returns an instance of this data manager, that is projected onto the given rowset
 * @param rowset
 * @return
 */
public DataManager getSubsetInstance(RowSet rowset){
  return new DataManagerSubset(this,dataAnalyzed.getSubsetInstance(rowset),dataGeneralized.getSubsetInstance(rowset),dataInput.getSubsetInstance(rowset),definition,shares,header,hierarchiesGeneralized,hierarchiesAnalyzed,generalizationLevelsMinimum,generalizationLevelsMaximum,microaggregationData.getSubsetInstance());
}
Program: 107838
Project: 107838
Buggy source:
/** 
 * For creating a projected instance
 * @param dataAnalyzed
 * @param dataGeneralized
 * @param dataStatic
 * @param definition
 * @param shares
 * @param header
 * @param hierarchiesGeneralized
 * @param hierarchiesAnalyzed
 * @param generalizationLevelsMinimum
 * @param generalizationLevelsMaximum
 * @param microaggregationFunctions
 * @param microaggregationDomainSizes
 * @param microaggregationHeader
 * @param microaggregationStartIndex
 */
protected DataManager(Data dataAnalyzed,Data dataGeneralized,Data dataStatic,DataDefinition definition,DomainShare[] shares,String[] header,GeneralizationHierarchy[] hierarchiesGeneralized,GeneralizationHierarchy[] hierarchiesAnalyzed,int[] generalizationLevelsMinimum,int[] generalizationLevelsMaximum,DataMicroAggregation microaggregationData){
  this.dataAnalyzed=dataAnalyzed;
  this.dataGeneralized=dataGeneralized;
  this.dataStatic=dataStatic;
  this.definition=definition;
  this.shares=shares;
  this.header=header;
  this.hierarchiesGeneralized=hierarchiesGeneralized;
  this.hierarchiesAnalyzed=hierarchiesAnalyzed;
  this.generalizationLevelsMinimum=generalizationLevelsMinimum;
  this.generalizationLevelsMaximum=generalizationLevelsMaximum;
  this.microaggregationData=microaggregationData;
  this.subset=null;
  this.subsetSize=0;
}

Fixed version (ground truth):
/** 
 * For creating a projected instance
 * @param dataAnalyzed
 * @param dataGeneralized
 * @param dataInput
 * @param definition
 * @param shares
 * @param header
 * @param hierarchiesGeneralized
 * @param hierarchiesAnalyzed
 * @param generalizationLevelsMinimum
 * @param generalizationLevelsMaximum
 * @param microaggregationFunctions
 * @param microaggregationDomainSizes
 * @param microaggregationHeader
 * @param microaggregationStartIndex
 */
protected DataManager(Data dataAnalyzed,Data dataGeneralized,Data dataInput,DataDefinition definition,DomainShare[] shares,String[] header,GeneralizationHierarchy[] hierarchiesGeneralized,GeneralizationHierarchy[] hierarchiesAnalyzed,int[] generalizationLevelsMinimum,int[] generalizationLevelsMaximum,DataMicroAggregation microaggregationData){
  this.dataAnalyzed=dataAnalyzed;
  this.dataGeneralized=dataGeneralized;
  this.dataInput=dataInput;
  this.definition=definition;
  this.shares=shares;
  this.header=header;
  this.hierarchiesGeneralized=hierarchiesGeneralized;
  this.hierarchiesAnalyzed=hierarchiesAnalyzed;
  this.generalizationLevelsMinimum=generalizationLevelsMinimum;
  this.generalizationLevelsMaximum=generalizationLevelsMaximum;
  this.microaggregationData=microaggregationData;
  this.subset=null;
  this.subsetSize=0;
}
Program: 107839
Project: 107839
Buggy source:
/** 
 * Constructor
 * @param source
 * @param dataAnalyzed
 * @param dataGeneralized
 * @param dataStatic
 * @param definition
 * @param shares
 * @param header
 * @param hierarchiesGeneralized
 * @param hierarchiesAnalyzed
 * @param generalizationLevelsMinimum
 * @param generalizationLevelsMaximum
 * @param microaggregationData
 */
protected DataManagerSubset(DataManager source,Data dataAnalyzed,Data dataGeneralized,Data dataStatic,DataDefinition definition,DomainShare[] shares,String[] header,GeneralizationHierarchy[] hierarchiesGeneralized,GeneralizationHierarchy[] hierarchiesAnalyzed,int[] generalizationLevelsMinimum,int[] generalizationLevelsMaximum,DataMicroAggregation microaggregationData){
  super(dataAnalyzed,dataGeneralized,dataStatic,source.getDataDefinition(),shares,header,hierarchiesGeneralized,hierarchiesAnalyzed,generalizationLevelsMinimum,generalizationLevelsMaximum,microaggregationData);
  this.source=source;
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param source
 * @param dataAnalyzed
 * @param dataGeneralized
 * @param dataInput
 * @param definition
 * @param shares
 * @param header
 * @param hierarchiesGeneralized
 * @param hierarchiesAnalyzed
 * @param generalizationLevelsMinimum
 * @param generalizationLevelsMaximum
 * @param microaggregationData
 */
protected DataManagerSubset(DataManager source,Data dataAnalyzed,Data dataGeneralized,Data dataInput,DataDefinition definition,DomainShare[] shares,String[] header,GeneralizationHierarchy[] hierarchiesGeneralized,GeneralizationHierarchy[] hierarchiesAnalyzed,int[] generalizationLevelsMinimum,int[] generalizationLevelsMaximum,DataMicroAggregation microaggregationData){
  super(dataAnalyzed,dataGeneralized,dataInput,source.getDataDefinition(),shares,header,hierarchiesGeneralized,hierarchiesAnalyzed,generalizationLevelsMinimum,generalizationLevelsMaximum,microaggregationData);
  this.source=source;
}
Program: 107840
Project: 107840
Buggy source:
@Override public String[] next(){
  initParser();
  String[] result=next;
  next=parser.parseNext();
  if (result.length != next.length) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (cleansing) {
    if (result.length != datatypes.length) {
      throw new IllegalArgumentException("String_Node_Str");
    }
    for (int i=0; i < result.length; i++) {
      if (!datatypes[i].isValid(result[i])) {
        result[i]=DataType.NULL_VALUE;
      }
    }
  }
  return result;
}

Fixed version (ground truth):
@Override public String[] next(){
  initParser();
  String[] result=next;
  next=parser.parseNext();
  if (next != null && result != null && result.length != next.length) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (cleansing) {
    if (result.length != datatypes.length) {
      throw new IllegalArgumentException("String_Node_Str");
    }
    for (int i=0; i < result.length; i++) {
      if (!datatypes[i].isValid(result[i])) {
        result[i]=DataType.NULL_VALUE;
      }
    }
  }
  return result;
}
Program: 107841
Project: 107841
Buggy source:
/** 
 * Returns an iterator. <b>You must iterate trough all elements to prevent resource leaks!</b>
 * @return the iterator
 */
public Iterator<String[]> iterator(){
  return new Iterator<String[]>(){
    boolean initialized=false;
    CsvParser parser=null;
    String[] next=null;
    @Override public boolean hasNext(){
      initParser();
      boolean result=next != null;
      if (!result && parser != null) {
        parser.stopParsing();
        parser=null;
      }
      return result;
    }
    @Override public String[] next(){
      initParser();
      String[] result=next;
      next=parser.parseNext();
      if (result.length != next.length) {
        throw new IllegalStateException("String_Node_Str");
      }
      if (cleansing) {
        if (result.length != datatypes.length) {
          throw new IllegalArgumentException("String_Node_Str");
        }
        for (int i=0; i < result.length; i++) {
          if (!datatypes[i].isValid(result[i])) {
            result[i]=DataType.NULL_VALUE;
          }
        }
      }
      return result;
    }
    @Override public void remove(){
      throw new UnsupportedOperationException("String_Node_Str");
    }
    /** 
 * Initializes the parser 
 */
    private void initParser(){
      if (!initialized) {
        parser=new CsvParser(settings);
        parser.beginParsing(reader);
        next=parser.parseNext();
        initialized=true;
      }
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Returns an iterator. <b>You must iterate trough all elements to prevent resource leaks!</b>
 * @return the iterator
 */
public Iterator<String[]> iterator(){
  return new Iterator<String[]>(){
    boolean initialized=false;
    CsvParser parser=null;
    String[] next=null;
    @Override public boolean hasNext(){
      initParser();
      boolean result=next != null;
      if (!result && parser != null) {
        parser.stopParsing();
        parser=null;
      }
      return result;
    }
    @Override public String[] next(){
      initParser();
      String[] result=next;
      next=parser.parseNext();
      if (next != null && result != null && result.length != next.length) {
        throw new IllegalStateException("String_Node_Str");
      }
      if (cleansing) {
        if (result.length != datatypes.length) {
          throw new IllegalArgumentException("String_Node_Str");
        }
        for (int i=0; i < result.length; i++) {
          if (!datatypes[i].isValid(result[i])) {
            result[i]=DataType.NULL_VALUE;
          }
        }
      }
      return result;
    }
    @Override public void remove(){
      throw new UnsupportedOperationException("String_Node_Str");
    }
    /** 
 * Initializes the parser 
 */
    private void initParser(){
      if (!initialized) {
        parser=new CsvParser(settings);
        parser.beginParsing(reader);
        next=parser.parseNext();
        initialized=true;
      }
    }
  }
;
}
Program: 107842
Project: 107842
Buggy source:
/** 
 * Creates an object which projects the given data onto the given set of columns
 * @param data
 * @param header
 * @param columns
 * @param dictionary
 * @return
 */
public static Data createProjection(final DataMatrix data,final String[] header,final int[] columns,final Dictionary dictionary){
  if (columns.length == 0) {
    return new Data(null,new String[0],new int[0],new Dictionary(0));
  }
  DataMatrix matrix=new DataMatrix(data.getNumRows(),columns.length);
  for (int row=0; row < data.getNumRows(); row++) {
    matrix.setRow(row);
    data.setRow(row);
    for (    int column : columns) {
      matrix.setValueAtColumn(column,data.getValueAtColumn(column));
    }
  }
  String[] newHeader=new String[columns.length];
  int index=0;
  for (  int column : columns) {
    newHeader[index++]=header[column];
  }
  return new Data(matrix,newHeader,columns,new Dictionary(dictionary,columns));
}

Fixed version (ground truth):
/** 
 * Creates an object which projects the given data onto the given set of columns
 * @param data
 * @param header
 * @param columns
 * @param dictionary
 * @return
 */
public static Data createProjection(final DataMatrix data,final String[] header,final int[] columns,final Dictionary dictionary){
  if (columns.length == 0) {
    return new Data(null,new String[0],new int[0],new Dictionary(0));
  }
  DataMatrix matrix=new DataMatrix(data.getNumRows(),columns.length);
  for (int row=0; row < data.getNumRows(); row++) {
    matrix.setRow(row);
    data.setRow(row);
    for (int index=0; index < columns.length; index++) {
      matrix.setValueAtColumn(index,data.getValueAtColumn(columns[index]));
    }
  }
  String[] newHeader=new String[columns.length];
  int index=0;
  for (  int column : columns) {
    newHeader[index++]=header[column];
  }
  return new Data(matrix,newHeader,columns,new Dictionary(dictionary,columns));
}
Program: 107845
Project: 107845
Buggy source:
/** 
 * Builds a generalization function mapping input values to the given level of the hierarchy
 * @param hierarchies
 * @param index
 * @return
 */
@SuppressWarnings("String_Node_Str") private Map<String,String>[] getGeneralizationFunctions(String[][][] hierarchies,int index){
  Map<String,String>[] result=new HashMap[hierarchies.length];
  for (int level=0; level < hierarchies[index][0].length; level++) {
    Map<String,String> map=new HashMap<String,String>();
    for (int row=0; row < hierarchies[index].length; row++) {
      map.put(hierarchies[index][row][0],hierarchies[index][row][level]);
    }
    result[level]=map;
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Builds a generalization function mapping input values to the given level of the hierarchy
 * @param hierarchies
 * @param index
 * @return
 */
@SuppressWarnings("String_Node_Str") private Map<String,String>[] getGeneralizationFunctions(String[][][] hierarchies,int index){
  Map<String,String>[] result=new HashMap[hierarchies[index][0].length];
  for (int level=0; level < hierarchies[index][0].length; level++) {
    Map<String,String> map=new HashMap<String,String>();
    for (int row=0; row < hierarchies[index].length; row++) {
      map.put(hierarchies[index][row][0],hierarchies[index][row][level]);
    }
    result[level]=map;
  }
  return result;
}
Program: 107846
Project: 107846
Buggy source:
@Override public QualityMeasureColumnOriented evaluate(){
  int[] indices=getIndices();
  DataHandle output=getOutput();
  QualityDomainShare[] shares=getDomainShares();
  double[] result=new double[indices.length];
  double[] min=new double[indices.length];
  double[] max=new double[indices.length];
  for (int i=0; i < result.length; i++) {
    int column=indices[i];
    for (int row=0; row < output.getNumRows(); row++) {
      try {
        double share=1d;
        if (!isSuppressed(output,indices,row)) {
          share=shares[i].getShare(output.getValue(row,column),0);
        }
        result[i]+=share;
      }
 catch (      Exception e) {
        result[i]=Double.NaN;
        break;
      }
      checkInterrupt();
    }
  }
  for (int i=0; i < result.length; i++) {
    result[i]/=(double)output.getNumRows();
    min[i]=shares[i].getDomainSize() == 0d ? 0d : 1d / shares[i].getDomainSize();
    max[i]=1d;
  }
  return new QualityMeasureColumnOriented(output,indices,min,result,max);
}

Fixed version (ground truth):
@Override public QualityMeasureColumnOriented evaluate(){
  int[] indices=getIndices();
  DataHandle output=getOutput();
  QualityDomainShare[] shares=getDomainShares();
  double[] result=new double[indices.length];
  double[] min=new double[indices.length];
  double[] max=new double[indices.length];
  for (int i=0; i < result.length; i++) {
    int column=indices[i];
    for (int row=0; row < output.getNumRows(); row++) {
      try {
        double share=1d;
        if (!isSuppressed(output,indices,row)) {
          share=shares[i].getShare(output.getValue(row,column),0);
        }
        result[i]+=share;
      }
 catch (      Exception e) {
        result[i]=Double.NaN;
      }
      checkInterrupt();
    }
  }
  for (int i=0; i < result.length; i++) {
    result[i]/=(double)output.getNumRows();
    min[i]=shares[i].getDomainSize() == 0d ? 0d : 1d / shares[i].getDomainSize();
    max[i]=1d;
  }
  return new QualityMeasureColumnOriented(output,indices,min,result,max);
}
Program: 107848
Project: 107848
Buggy source:
@Override public QualityMeasureColumnOriented evaluate(){
  int[] indices=getIndices();
  DataHandle output=getOutput();
  String[][][] hierarchies=getHierarchies();
  Map<String,Double>[] precisions=getPrecisions(hierarchies);
  double[] result=new double[indices.length];
  double[] min=new double[indices.length];
  double[] max=new double[indices.length];
  for (int i=0; i < result.length; i++) {
    int column=indices[i];
    for (int row=0; row < output.getNumRows(); row++) {
      try {
        double precision=1d;
        if (!isSuppressed(output,indices,row)) {
          Double temp=precisions[i].get(output.getValue(row,column));
          precision=temp != null ? temp : 1d;
        }
        result[i]+=precision;
      }
 catch (      Exception e) {
        result[i]=Double.NaN;
        break;
      }
      checkInterrupt();
    }
  }
  for (int i=0; i < result.length; i++) {
    result[i]/=(double)output.getNumRows();
    min[i]=0d;
    max[i]=1d;
  }
  return new QualityMeasureColumnOriented(output,indices,min,result,max);
}

Fixed version (ground truth):
@Override public QualityMeasureColumnOriented evaluate(){
  int[] indices=getIndices();
  DataHandle output=getOutput();
  String[][][] hierarchies=getHierarchies();
  Map<String,Double>[] precisions=getPrecisions(hierarchies);
  double[] result=new double[indices.length];
  double[] min=new double[indices.length];
  double[] max=new double[indices.length];
  for (int i=0; i < result.length; i++) {
    int column=indices[i];
    for (int row=0; row < output.getNumRows(); row++) {
      try {
        double precision=1d;
        if (!isSuppressed(output,indices,row)) {
          Double temp=precisions[i].get(output.getValue(row,column));
          precision=temp != null ? temp : 1d;
        }
        result[i]+=precision;
      }
 catch (      Exception e) {
        result[i]=Double.NaN;
      }
      checkInterrupt();
    }
  }
  for (int i=0; i < result.length; i++) {
    result[i]/=(double)output.getNumRows();
    min[i]=0d;
    max[i]=1d;
  }
  return new QualityMeasureColumnOriented(output,indices,min,result,max);
}
Program: 107849
Project: 107849
Buggy source:
/** 
 * Returns minimum, maximum for the input column
 * @param inputColumnAsNumbers
 * @return
 */
private double[] getMinMax(double[] inputColumnAsNumbers){
  double min=Double.MAX_VALUE;
  double max=-Double.MAX_VALUE;
  for (int i=0; i < inputColumnAsNumbers.length; i+=2) {
    double value=inputColumnAsNumbers[i];
    min=Math.min(min,value);
    max=Math.max(max,value);
  }
  return new double[]{min,max};
}

Fixed version (ground truth):
/** 
 * Returns minimum, maximum for the input column
 * @param inputColumnAsNumbers
 * @return
 */
private double[] getMinMax(double[] inputColumnAsNumbers){
  double min=Double.MAX_VALUE;
  double max=-Double.MAX_VALUE;
  for (int i=0; i < inputColumnAsNumbers.length; i++) {
    double value=inputColumnAsNumbers[i];
    min=Math.min(min,value);
    max=Math.max(max,value);
  }
  return new double[]{min,max};
}
Program: 107855
Project: 107855
Buggy source:
@Override protected int getValueIdentifier(int column,String value){
  int key=column * 2;
  int type=inverseMap[key];
  String[] values=inverseDictionaries[type].getMapping()[column];
  for (int index=0; index < values.length; index++) {
    if (values[index].equals(value)) {
      return index;
    }
  }
  return -1;
}

Fixed version (ground truth):
@Override protected int getValueIdentifier(int column,String value){
  final int key=column * 2;
  final int type=inverseMap[key];
switch (type) {
case AttributeTypeInternal.IDENTIFYING:
    return -1;
default :
  String[] values=inverseDictionaries[type].getMapping()[inverseMap[key + 1]];
for (int index=0; index < values.length; index++) {
  if (values[index].equals(value)) {
    return index;
  }
}
return -1;
}
}
Program: 107857
Project: 107857
Buggy source:
/** 
 * Creates a new instance
 * @param model
 * @param handle
 * @param definition
 */
private State(DataHandle handle,DataDefinition definition){
  for (int col=0; col < handle.getNumColumns(); col++) {
    String attribute=handle.getAttributeName(col);
    attributes.add(attribute);
    types.add(definition.getAttributeType(attribute));
    dtypes.add(definition.getDataType(attribute));
  }
  features.addAll(model.getSelectedFeatures());
  classes.addAll(model.getSelectedClasses());
}

Fixed version (ground truth):
/** 
 * Creates a new instance
 * @param handle
 * @param definition
 * @param featureScaling 
 */
private State(DataHandle handle,DataDefinition definition,ARXFeatureScaling featureScaling){
  for (int col=0; col < handle.getNumColumns(); col++) {
    String attribute=handle.getAttributeName(col);
    attributes.add(attribute);
    types.add(definition.getAttributeType(attribute));
    dtypes.add(definition.getDataType(attribute));
    scaling.add(featureScaling.getScalingFunction(attribute));
  }
  features.addAll(model.getSelectedFeatures());
  classes.addAll(model.getSelectedClasses());
}
Program: 107858
Project: 107858
Buggy source:
@Override public int hashCode(){
  final int prime=31;
  int result=1;
  result=prime * result + ((attributes == null) ? 0 : attributes.hashCode());
  result=prime * result + ((classes == null) ? 0 : classes.hashCode());
  result=prime * result + ((features == null) ? 0 : features.hashCode());
  result=prime * result + ((types == null) ? 0 : types.hashCode());
  result=prime * result + ((dtypes == null) ? 0 : dtypes.hashCode());
  return result;
}

Fixed version (ground truth):
@Override public int hashCode(){
  final int prime=31;
  int result=1;
  result=prime * result + ((attributes == null) ? 0 : attributes.hashCode());
  result=prime * result + ((classes == null) ? 0 : classes.hashCode());
  result=prime * result + ((features == null) ? 0 : features.hashCode());
  result=prime * result + ((types == null) ? 0 : types.hashCode());
  result=prime * result + ((dtypes == null) ? 0 : dtypes.hashCode());
  result=prime * result + ((scaling == null) ? 0 : scaling.hashCode());
  return result;
}
Program: 107859
Project: 107859
Buggy source:
@Override public boolean equals(Object obj){
  if (this == obj)   return true;
  if (obj == null)   return false;
  if (getClass() != obj.getClass())   return false;
  State other=(State)obj;
  if (attributes == null) {
    if (other.attributes != null)     return false;
  }
 else   if (!attributes.equals(other.attributes))   return false;
  if (classes == null) {
    if (other.classes != null)     return false;
  }
 else   if (!classes.equals(other.classes))   return false;
  if (features == null) {
    if (other.features != null)     return false;
  }
 else   if (!features.equals(other.features))   return false;
  if (types == null) {
    if (other.types != null)     return false;
  }
 else   if (!types.equals(other.types))   return false;
  if (dtypes == null) {
    if (other.dtypes != null)     return false;
  }
 else   if (!dtypes.equals(other.dtypes))   return false;
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (this == obj)   return true;
  if (obj == null)   return false;
  if (getClass() != obj.getClass())   return false;
  State other=(State)obj;
  if (attributes == null) {
    if (other.attributes != null)     return false;
  }
 else   if (!attributes.equals(other.attributes))   return false;
  if (classes == null) {
    if (other.classes != null)     return false;
  }
 else   if (!classes.equals(other.classes))   return false;
  if (features == null) {
    if (other.features != null)     return false;
  }
 else   if (!features.equals(other.features))   return false;
  if (types == null) {
    if (other.types != null)     return false;
  }
 else   if (!types.equals(other.types))   return false;
  if (dtypes == null) {
    if (other.dtypes != null)     return false;
  }
 else   if (!dtypes.equals(other.dtypes))   return false;
  if (scaling == null) {
    if (other.scaling != null)     return false;
  }
 else   if (!scaling.equals(other.scaling))   return false;
  return true;
}
Program: 107863
Project: 107863
Buggy source:
/** 
 * Creates a new instance.
 * @param parent
 * @param controller
 * @param part
 */
public ViewStatisticsLogisticRegression(final Composite parent,final Controller controller,final ModelPart part){
  super(parent,controller,part,null,false);
  this.manager=new AnalysisManager(parent.getDisplay());
  controller.addListener(ModelPart.SELECTED_FEATURES_OR_CLASSES,this);
  controller.addListener(ModelPart.DATA_TYPE,this);
  controller.addListener(ModelPart.SELECTED_ATTRIBUTE,this);
}

Fixed version (ground truth):
/** 
 * Creates a new instance.
 * @param parent
 * @param controller
 * @param part
 */
public ViewStatisticsLogisticRegression(final Composite parent,final Controller controller,final ModelPart part){
  super(parent,controller,part,null,false);
  this.manager=new AnalysisManager(parent.getDisplay());
  controller.addListener(ModelPart.SELECTED_FEATURES_OR_CLASSES,this);
  controller.addListener(ModelPart.DATA_TYPE,this);
  controller.addListener(ModelPart.SELECTED_ATTRIBUTE,this);
  precision=Resources.getMessage("String_Node_Str");
  recall=Resources.getMessage("String_Node_Str");
  fscore=Resources.getMessage("String_Node_Str");
}
Program: 107867
Project: 107867
Buggy source:
/** 
 * Creates a new instance.
 * @param parent
 * @param controller
 * @param part
 */
public ViewStatisticsLogisticRegression(final Composite parent,final Controller controller,final ModelPart part){
  super(parent,controller,part,null,false);
  this.manager=new AnalysisManager(parent.getDisplay());
  controller.addListener(ModelPart.SELECTED_FEATURES_OR_CLASSES,this);
  controller.addListener(ModelPart.DATA_TYPE,this);
  controller.addListener(ModelPart.SELECTED_ATTRIBUTE,this);
}

Fixed version (ground truth):
/** 
 * Creates a new instance.
 * @param parent
 * @param controller
 * @param part
 */
public ViewStatisticsLogisticRegression(final Composite parent,final Controller controller,final ModelPart part){
  super(parent,controller,part,null,false);
  this.manager=new AnalysisManager(parent.getDisplay());
  controller.addListener(ModelPart.SELECTED_FEATURES_OR_CLASSES,this);
  controller.addListener(ModelPart.DATA_TYPE,this);
  controller.addListener(ModelPart.SELECTED_ATTRIBUTE,this);
  precision=Resources.getMessage("String_Node_Str");
  recall=Resources.getMessage("String_Node_Str");
  fscore=Resources.getMessage("String_Node_Str");
}
Program: 107870
Project: 107870
Buggy source:
@Override public void reset(){
  for (  TableItem item : features.getItems()) {
    item.dispose();
  }
  for (  TableItem item : classes.getItems()) {
    item.dispose();
  }
  state=null;
  SWTUtil.disable(root);
}

Fixed version (ground truth):
@Override public void reset(){
  for (  TableEditor editor : editors) {
    editor.getEditor().dispose();
    editor.dispose();
  }
  editors.clear();
  for (  TableItem item : features.getItems()) {
    item.dispose();
  }
  for (  TableItem item : classes.getItems()) {
    item.dispose();
  }
  features.removeAll();
  classes.removeAll();
  SWTUtil.disable(root);
  state=null;
}
Program: 107871
Project: 107871
Buggy source:
/** 
 * This method optimizes the given data output with local recoding to improve its utility
 * @param handle
 * @param gsFactor A factor [0,1] weighting generalization and suppression.The default value is 0.5, which means that generalization and suppression will be treated equally. A factor of 0 will favor suppression, and a factor of 1 will favor generalization. The values in between can be used for balancing both methods.
 * @param listener 
 * @return The number of optimized records
 */
public int optimize(DataHandle handle,double gsFactor,ARXListener listener) throws RollbackRequiredException {
  return optimizeFast(handle,gsFactor,Double.NaN,listener);
}

Fixed version (ground truth):
/** 
 * This method optimizes the given data output with local recoding to improve its utility
 * @param handle
 * @param gsFactor A factor [0,1] weighting generalization and suppression.The default value is 0.5, which means that generalization and suppression will be treated equally. A factor of 0 will favor suppression, and a factor of 1 will favor generalization. The values in between can be used for balancing both methods.
 * @param listener 
 * @return The number of optimized records
 */
public int optimize(DataHandle handle,double gsFactor,ARXListener listener) throws RollbackRequiredException {
  return optimizeFast(handle,Double.NaN,gsFactor,listener);
}
Program: 107872
Project: 107872
Buggy source:
/** 
 * Returns the ROC curve for this class value calculated using a one-vs-all approach.
 * @param clazz
 * @return
 */
public ROCCurve getOriginalROCCurve(String clazz){
  return this.originalRocCurves.get(clazz);
}

Fixed version (ground truth):
/** 
 * Returns the ROC curve for this class value calculated using the one-vs-all approach.
 * @param clazz
 * @return
 */
public ROCCurve getOriginalROCCurve(String clazz){
  return this.originalROC.get(clazz);
}
Program: 107873
Project: 107873
Buggy source:
/** 
 * Returns the set of class attributes
 * @return
 */
public Set<String> getClassValues(){
  return this.rocCurves.keySet();
}

Fixed version (ground truth):
/** 
 * Returns the set of class attributes
 * @return
 */
public Set<String> getClassValues(){
  return this.ROC.keySet();
}
Program: 107874
Project: 107874
Buggy source:
/** 
 * @return the falsePositive
 */
public double[] getFalsePositiveRate(){
  return falsePositive;
}

Fixed version (ground truth):
/** 
 * Returns false-positive rates for all cut-off points
 * @return the falsePositive
 */
public double[] getFalsePositiveRate(){
  return falsePositive;
}
Program: 107875
Project: 107875
Buggy source:
/** 
 * Returns the ROC curve for this class value calculated using a one-vs-all approach.
 * @param clazz
 * @return
 */
public ROCCurve getROCCurve(String clazz){
  return this.rocCurves.get(clazz);
}

Fixed version (ground truth):
/** 
 * Returns the ROC curve for this class value calculated using the one-vs-all approach.
 * @param clazz
 * @return
 */
public ROCCurve getROCCurve(String clazz){
  return this.ROC.get(clazz);
}