Skip to content

Commit

Permalink
Update data types when using local recoding
Browse files Browse the repository at this point in the history
  • Loading branch information
prasser committed Oct 8, 2015
1 parent 5197114 commit 0573c69
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
Binary file modified data/example2.deid
Binary file not shown.
3 changes: 3 additions & 0 deletions src/main/org/deidentifier/arx/ARXResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,9 @@ public int optimize(DataHandle handle, double gsFactor, ARXListener listener) th
}
}

// Update data types
output.updateDataTypes(result.optimum.getGeneralization());

// Mark as optimized
if (optimized != 0) {
output.setOptimized(true);
Expand Down
22 changes: 20 additions & 2 deletions src/main/org/deidentifier/arx/DataHandleOutput.java
Original file line number Diff line number Diff line change
Expand Up @@ -443,15 +443,15 @@ protected int[][] getInputBuffer() {
checkRegistry();
return registry.getInputHandle().getInputBuffer();
}

/**
* Returns the output buffer
* @return
*/
protected Data getOutputBufferGeneralized() {
return outputGeneralized;
}

/**
* Returns the output buffer
* @return
Expand Down Expand Up @@ -621,4 +621,22 @@ protected void internalSwap(final int row1, final int row2) {
protected void setOptimized(boolean optimized) {
this.optimized = true;
}

/**
* Used to update data types after local recoding
* @param transformation
*/
protected void updateDataTypes(int[] transformation) {

for (int i = 0; i < dataTypes.length; i++) {
DataType<?>[] type = dataTypes[i];
if (type != null) {
for (int j = 0; j < type.length; j++) {
if ((i == AttributeTypeInternal.QUASI_IDENTIFYING_GENERALIZED && transformation[j] > 0)) {
dataTypes[i][j] = DataType.STRING;
}
}
}
}
}
}

0 comments on commit 0573c69

Please sign in to comment.