Commit 611ffe2e authored by Noric Couderc's avatar Noric Couderc

Extracted inner anonymous class to named class and interface

Was necessary to enable serialization
parent f3e781c4
......@@ -332,48 +332,8 @@ public class BCBenchmarkPackage<T> implements Serializable {
// ----------------------------------------
// container-specific bits
public interface BCGen<S> {
public void clear(S ds);
public BenchmarkGenerator<S> makeGenerator(int initial_datastructure_size,
MethodSelectionType mst);
public int getSize(S ds);
/**
* Name of the short interface to be benchmarked interface (e.g., "List")
*/
public String
getInterfaceIdentifier();
}
// lists --------------------
private static BCGen<List<Object>> BCGenLIST = new BCGen<List<Object>>() {
@Override
public BenchmarkGenerator<List<Object>>
// TODO: Make the method selection strategy a parameter
makeGenerator(int ds_size, MethodSelectionType mst) {
return new ListBenchmarkGenerator(ds_size, mst);
}
@Override
public void
clear(List<Object> ds) {
ds.clear();
}
@Override
public int
getSize(List<Object> ds) {
return ds.size();
}
@Override
public String
getInterfaceIdentifier() {
return "List";
}
};
private static BCGen<List<Object>> BCGenLIST = new BCGenList();
@Deprecated
public static BCBenchmarkPackage<List<Object>>
......@@ -395,33 +355,7 @@ public class BCBenchmarkPackage<T> implements Serializable {
}
// sets --------------------
private static final BCGen<Set<Object>> BCGenSET = new BCGen<Set<Object>>() {
@Override
public BenchmarkGenerator<Set<Object>>
// TODO: Change method selection strategy
makeGenerator(int ds_size, MethodSelectionType mst
) {
return new SetBenchmarkGenerator(ds_size, mst);
}
@Override
public void
clear(Set<Object> ds) {
ds.clear();
}
@Override
public int
getSize(Set<Object> ds) {
return ds.size();
}
@Override
public String
getInterfaceIdentifier() {
return "Set";
}
};
private static final BCGen<Set<Object>> BCGenSET = new BCGenSet();
@Deprecated
public static BCBenchmarkPackage<Set<Object>>
......@@ -443,31 +377,7 @@ public class BCBenchmarkPackage<T> implements Serializable {
}
// maps --------------------
private static final BCGen<Map<Object, Object>> BCGenMAP = new BCGen<Map<Object, Object>>() {
@Override
public BenchmarkGenerator<Map<Object, Object>>
makeGenerator(int ds_size, MethodSelectionType mst) {
return new MapBenchmarkGenerator(ds_size, mst);
}
@Override
public void
clear(Map<Object, Object> ds) {
ds.clear();
}
@Override
public int
getSize(Map<Object, Object> ds) {
return ds.size();
}
@Override
public String
getInterfaceIdentifier() {
return "Map";
}
};
private static final BCGen<Map<Object, Object>> BCGenMAP = new BCGenMap();
@Deprecated
public static BCBenchmarkPackage<Map<Object, Object>>
......
package se.lth.cs.bcgen;
public interface BCGen<S> {
public void clear(S ds);
public BenchmarkGenerator<S> makeGenerator(int initial_datastructure_size,
MethodSelectionType mst);
public int getSize(S ds);
/**
* Name of the short interface to be benchmarked interface (e.g., "List")
*/
public String
getInterfaceIdentifier();
}
package se.lth.cs.bcgen;
import java.io.Serializable;
import java.util.List;
public class BCGenList implements BCGen<List<Object>>, Serializable {
@Override
public BenchmarkGenerator<List<Object>>
makeGenerator(int ds_size, MethodSelectionType mst) {
return new ListBenchmarkGenerator(ds_size, mst);
}
@Override
public void
clear(List<Object> ds) {
ds.clear();
}
@Override
public int
getSize(List<Object> ds) {
return ds.size();
}
@Override
public String
getInterfaceIdentifier() {
return "List";
}
}
package se.lth.cs.bcgen;
import java.io.Serializable;
import java.util.Map;
public class BCGenMap implements BCGen<Map<Object, Object>>, Serializable {
@Override
public BenchmarkGenerator<Map<Object, Object>>
makeGenerator(int ds_size, MethodSelectionType mst) {
return new MapBenchmarkGenerator(ds_size, mst);
}
@Override
public void
clear(Map<Object, Object> ds) {
ds.clear();
}
@Override
public int
getSize(Map<Object, Object> ds) {
return ds.size();
}
@Override
public String
getInterfaceIdentifier() {
return "Map";
}
}
package se.lth.cs.bcgen;
import java.io.Serializable;
import java.util.Set;
public class BCGenSet implements BCGen<Set<Object>>, Serializable {
@Override
public BenchmarkGenerator<Set<Object>>
// TODO: Change method selection strategy
makeGenerator(int ds_size, MethodSelectionType mst
) {
return new SetBenchmarkGenerator(ds_size, mst);
}
@Override
public void
clear(Set<Object> ds) {
ds.clear();
}
@Override
public int
getSize(Set<Object> ds) {
return ds.size();
}
@Override
public String
getInterfaceIdentifier() {
return "Set";
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment