Gitlab service upgraded. Please report any problems to dl_gitadmin@cs.lth.se

Commit f6a9157a authored by Noric Couderc's avatar Noric Couderc

Extracted method

added an initialize method to initialize the info about the base data structure.
parent 809a11c2
......@@ -35,18 +35,7 @@ public abstract class Application<T> {
this.randomGenerator = new Random(seed);
this.applicationSize = applicationSize;
this.dataStructure = structure;
this.baseStructureSize = 0;
clearDataStructure(); // TODO: This is a bit odd
// Argument becomes a new data structure of same class as
// the data structure to test
try {
argument = (T) dataStructure.getClass().newInstance();
} catch (InstantiationException | IllegalAccessException e) {
e.printStackTrace();
}
initialize(structure);
List<Method> callableMethods = getRunnableMethods();
if (callableMethods.isEmpty()) { return; }
......@@ -74,7 +63,16 @@ public abstract class Application<T> {
}
}
// TODO: Some copy-paste here
initialize(structure);
}
/**
* Initialized the data structure and potential arguments for the
* application.
* @param structure
*/
private void initialize(T structure) {
this.dataStructure = structure;
this.baseStructureSize = 0;
clearDataStructure();
......@@ -86,7 +84,6 @@ public abstract class Application<T> {
} catch (InstantiationException | IllegalAccessException e) {
e.printStackTrace();
}
}
Application(int seed, List<String> trace, T structure) {
......
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