Skip to content

Commit

Permalink
Cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
prasser committed Apr 6, 2023
1 parent 58837ba commit c8c26c9
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/example/org/deidentifier/arx/examples/Example.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* @author Fabian Prasser
* @author Florian Kohlmayer
*/
public class Example {
public class Example { //NOPMD

/**
* Prints a given data handle.
Expand Down
2 changes: 1 addition & 1 deletion src/example/org/deidentifier/arx/examples/Example11.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static void main(String[] args) throws IOException {
data.add("i", "Iris", "48970", "52", "France", "1");

// Define research subset
DataSelector selector = DataSelector.create(data).field("sen").equals("1");
DataSelector selector = DataSelector.create(data).field("sen").equals("1"); //NOPMD
DataSubset subset = DataSubset.create(data, selector);

// Define hierarchies
Expand Down
2 changes: 1 addition & 1 deletion src/example/org/deidentifier/arx/examples/Example12.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static void main(String[] args) throws IOException {
data.add("i", "Iris", "48970", "52", "France", "1");

// Define research subset
DataSelector selector = DataSelector.create(data)
DataSelector selector = DataSelector.create(data) //NOPMD
.begin()
.field("identifier").equals("b")
.and()
Expand Down
6 changes: 1 addition & 5 deletions src/example/org/deidentifier/arx/examples/Example26.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,15 @@ public static void main(final String[] args) {
* @return
*/
private static String[] getExampleData() {

String[] data = new String[]{
return new String[]{
"40.764725",
"40.646866",
"40.786007",
"40.812",
"40.644527",
"40.749702",
"40.764137",

};

return data;
}

/**
Expand Down
17 changes: 6 additions & 11 deletions src/example/org/deidentifier/arx/examples/Example28.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,13 @@ private static void exampleCSV() throws IOException {
}

private static String[] getExampleData() {

String[] data = new String[] {
"34",
"66",
"70",
"34",
"70",
"NULL",

return new String[] { "34",
"66",
"70",
"34",
"70",
"NULL",
};

return data;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/example/org/deidentifier/arx/examples/Example35.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* @author Florian Kohlmayer
*
*/
public class Example35 {
public class Example35 extends Example {

/**
* Entry point
Expand All @@ -57,8 +57,8 @@ public static void main(String[] args) throws IOException {
private static Data.DefaultData createData() {
Data.DefaultData data = Data.create();
data.add("first name", "age", "gender", "code", "birth", "email-address", "SSN", "Bank", "Vehicle", "URL", "IP", "phone");
data.add("Max", "34", "male", "81667", "2008-09-02", "", "123-45-6789", "GR16 0110 1250 0000 0001 2300 695", "", "http://demodomain.com", "8.8.8.8", "+49 1234566");
data.add("Max", "45", "female", "81675", "2008-09-02", "user@arx.org", "", "", "WDD 169 007-1J-236589", "", "2001:db8::1428:57ab", "");
data.add("Max", "34", "male", "81667", "2008-09-02", "", "123-45-6789", "GR16 0110 1250 0000 0001 2300 695", "", "http://demodomain.com", "8.8.8.8", "+49 1234566"); //NOPMD
data.add("Max", "45", "female", "81675", "2008-09-02", "user@arx.org", "", "", "WDD 169 007-1J-236589", "", "2001:db8::1428:57ab", ""); //NOPMD
data.add("Max", "66", "male", "89375", "2008-09-02", "demo@email.com", "", "", "", "", "", "");
data.add("Max", "70", "female", "81931", "2008-09-02", "", "", "", "", "", "", "");
data.add("Max", "34", "female", "81931", "2008-09-02", "", "", "", "", "", "", "");
Expand Down
8 changes: 4 additions & 4 deletions src/example/org/deidentifier/arx/examples/Example48.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.deidentifier.arx.examples;

import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

import org.deidentifier.arx.ARXAnonymizer;
import org.deidentifier.arx.ARXConfiguration;
Expand Down Expand Up @@ -46,16 +46,16 @@ public class Example48 extends Example {
public static void main(String[] args) throws IOException {

// Load data
DataSource source = DataSource.createCSVSource("data/test2.csv", Charset.forName("UTF-8"), ';', true);
DataSource source = DataSource.createCSVSource("data/test2.csv", StandardCharsets.UTF_8, ';', true);
source.addColumn("ZIPCode", DataType.STRING);
source.addColumn("Age", DataType.INTEGER);
source.addColumn("Salary", DataType.INTEGER); // in k
source.addColumn("Disease", DataType.STRING);
Data data = Data.create(source);

// Load hierarchies
Hierarchy zipcode = Hierarchy.create("data/test2_hierarchy_ZIPCode.csv", Charset.forName("UTF-8"), ';');
Hierarchy age = Hierarchy.create("data/test2_hierarchy_Age.csv", Charset.forName("UTF-8"), ';');
Hierarchy zipcode = Hierarchy.create("data/test2_hierarchy_ZIPCode.csv", StandardCharsets.UTF_8, ';');
Hierarchy age = Hierarchy.create("data/test2_hierarchy_Age.csv", StandardCharsets.UTF_8, ';');

// Define
data.getDefinition().setAttributeType("ZIPCode", zipcode);
Expand Down
2 changes: 1 addition & 1 deletion src/example/org/deidentifier/arx/examples/Example50.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public static void main(String[] args) throws IOException {

// We select all records with "sex=Male" to serve as the dataset which we will de-identify.
// The overall dataset serves as our population table.
DataSubset subset = DataSubset.create(data, DataSelector.create(data).field("sex").equals("Male"));
DataSubset subset = DataSubset.create(data, DataSelector.create(data).field("sex").equals("Male")); //NOPMD

// Config from PLOS|ONE paper
solve(data, ARXCostBenefitConfiguration.create()
Expand Down
2 changes: 1 addition & 1 deletion src/example/org/deidentifier/arx/examples/Example52.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public static void main(String[] args) throws IOException {

// We select all records with "sex=Male" to serve as the dataset which we will de-identify.
// The overall dataset serves as our population table.
DataSubset subset = DataSubset.create(data, DataSelector.create(data).field("sex").equals("Male"));
DataSubset subset = DataSubset.create(data, DataSelector.create(data).field("sex").equals("Male")); //NOPMD

// Config from PLOS|ONE paper
solve(data, ARXCostBenefitConfiguration.create()
Expand Down

0 comments on commit c8c26c9

Please sign in to comment.