From 10d4bee157dc9f70b1e36f71c3175770c5506880 Mon Sep 17 00:00:00 2001 From: narnolddd Date: Tue, 28 Jun 2022 17:55:23 +0100 Subject: [PATCH] Fix measurement class not being added to list --- feta/actions/Measure.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/feta/actions/Measure.java b/feta/actions/Measure.java index 7a1e0da..069959d 100644 --- a/feta/actions/Measure.java +++ b/feta/actions/Measure.java @@ -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; @@ -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_; @@ -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()); @@ -115,7 +110,7 @@ public void parseActionOptions(JSONObject obj) { public void parseStatistics(JSONArray statistics) { for (Object statistic : statistics) { - Measurement measure; + Measurement measure=null; Class cl; try { cl = findStatisticClass(statistic.toString()); @@ -130,11 +125,12 @@ public void parseStatistics(JSONArray statistics) { System.err.println("Trouble instantiating class "+statistic); e.printStackTrace(); } + statistics_.add(measure); } } public Class findStatisticClass(String rawname) throws ClassNotFoundException { - Class stat = null; + Class stat; String sname = rawname; try { stat=Class.forName(sname).asSubclass(Measurement.class);