Skip to content

Commit

Permalink
Fix measurement class not being added to list
Browse files Browse the repository at this point in the history
  • Loading branch information
narnolddd committed Jun 28, 2022
1 parent efc682d commit 10d4bee
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions feta/actions/Measure.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package feta.actions;

import feta.FetaOptions;
import feta.actions.stoppingconditions.StoppingCondition;
import feta.network.DirectedNetwork;
import feta.network.measurements.*;
import feta.readnet.ReadNet;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;

Expand All @@ -23,7 +21,6 @@ public class Measure extends SimpleAction {
public String outputFile_ = "output/measurements.dat";
public BufferedWriter bw_ = null;
// Need to think how this will work alternating between directed and undirected networks.
private boolean measureDegDist_;
private boolean printDegVector_;
private boolean printHeader_;
private boolean directed_;
Expand Down Expand Up @@ -56,8 +53,6 @@ public void execute() {
update();
}
String measurements = time+" "+getLine();
//network_.calcMeasurements();
//System.out.println(measurements);
bw_.write(measurements);
if (printDegVector_) {
System.out.println(network_.degreeVectorToString());
Expand Down Expand Up @@ -115,7 +110,7 @@ public void parseActionOptions(JSONObject obj) {

public void parseStatistics(JSONArray statistics) {
for (Object statistic : statistics) {
Measurement measure;
Measurement measure=null;
Class<? extends Measurement> cl;
try {
cl = findStatisticClass(statistic.toString());
Expand All @@ -130,11 +125,12 @@ public void parseStatistics(JSONArray statistics) {
System.err.println("Trouble instantiating class "+statistic);
e.printStackTrace();
}
statistics_.add(measure);
}
}

public Class<?extends Measurement> findStatisticClass(String rawname) throws ClassNotFoundException {
Class <? extends Measurement> stat = null;
Class <? extends Measurement> stat;
String sname = rawname;
try {
stat=Class.forName(sname).asSubclass(Measurement.class);
Expand Down

0 comments on commit 10d4bee

Please sign in to comment.