Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed null-Pointer exception that was raised if there is no infoColle…

…ctor.

git-svn-id: https://svn.sosy-lab.org/software/ccvisu/trunk@1256 fc36ee94-785d-4715-976b-05dfc5071072
  • Loading branch information...
commit 3d12cfe7a774b326f1b92eef3af598c6a312c718 1 parent be8ac2f
stahlbauer authored
Showing with 16 additions and 10 deletions.
  1. +16 −10 src/org/sosy_lab/ccvisu/layout/MinimizerBarnesHut.java
View
26 src/org/sosy_lab/ccvisu/layout/MinimizerBarnesHut.java
@@ -227,6 +227,13 @@ public MinimizerBarnesHut(Options options) {
}
}
+ private void statusMessage(String message) {
+ InformationCollector infoCollector = options.infoCollector;
+ if (infoCollector != null) {
+ infoCollector.addMessage(message);
+ }
+ }
+
/**
* Iteratively minimizes energy using the Barnes-Hut algorithm.
* Starts from the positions in <code>pos</code>,
@@ -242,12 +249,11 @@ public void minimizeEnergy() {
int numberOfIterations = options.getOption(OptionsEnum.iter).getInt();
- InformationCollector infoCollector = options.infoCollector;
- infoCollector.addMessage("");
- infoCollector.addMessage("Note: Minimizer will run " + numberOfIterations + " iterations,");
- infoCollector.addMessage(" increase (decrease) this number with option -iter to");
- infoCollector.addMessage(" increase quality of layout (decrease runtime).");
+ statusMessage("");
+ statusMessage("Note: Minimizer will run " + numberOfIterations + " iterations,");
+ statusMessage(" increase (decrease) this number with option -iter to");
+ statusMessage(" increase quality of layout (decrease runtime).");
if ((numberOfIterations == 0)
&& (options.getOption(OptionsEnum.disableDISPGuiControls).getBool())) {
@@ -272,16 +278,16 @@ public void minimizeEnergy() {
energySum += getEnergy(i);
}
- infoCollector.addMessage("");
- infoCollector.addMessage("initial energy: " + energySum + "; repulsion: " + repuFactor);
+ statusMessage("");
+ statusMessage("initial energy: " + energySum + "; repulsion: " + repuFactor);
// Draw initial layout before minimizing
notifyAboutChangedLayout(false);
- infoCollector.addMessage("Starting minimizer.");
+ statusMessage("Starting minimizer.");
performMinimization(nodeCount, numberOfIterations, finalRepuFactor, energySum);
- infoCollector.addMessage("Minimizer finished.");
+ statusMessage("Minimizer finished.");
setProgress(1, 1, "Minimizer finished.");
// Print stats.
@@ -386,7 +392,7 @@ private void performMinimization(int nodeCount, int numberOfIterations,
} // for
if (options.verbosity.isAtLeast(Verbosity.WARNING)) {
- options.infoCollector.addMessage("iteration\t" + step + "\tenergy\t" + energySum
+ statusMessage("iteration\t" + step + "\tenergy\t" + energySum
+ "\trepulsion\t" + repuFactor);
setProgress(step, numberOfIterations, "Minimizing energy.");
}
Please sign in to comment.
Something went wrong with that request. Please try again.