diff --git a/src/eva2/gui/FunctionArea.java b/src/eva2/gui/FunctionArea.java index b0ffb45b..6700a245 100644 --- a/src/eva2/gui/FunctionArea.java +++ b/src/eva2/gui/FunctionArea.java @@ -84,6 +84,11 @@ public class FunctionArea extends DArea implements Serializable { * Indicate whether graphs should be annotated with tool tips if pointed to with the mouse. */ private boolean doShowGraphToolTips = true; + + /** + * Indicate whether graph legend entries should show their unique number. + */ + private boolean appendIndexInLegend = true; /** * @@ -1101,7 +1106,7 @@ public class FunctionArea extends DArea implements Serializable { if (!on) legendBox = null; else - legendBox = new GraphPointSetLegend(m_PointSetContainer, true); + legendBox = new GraphPointSetLegend(m_PointSetContainer, isAppendIndexInLegend()); repaint(); } @@ -1154,7 +1159,7 @@ public class FunctionArea extends DArea implements Serializable { * */ public void updateLegend() { - GraphPointSetLegend lb = new GraphPointSetLegend(m_PointSetContainer, true); + GraphPointSetLegend lb = new GraphPointSetLegend(m_PointSetContainer, isAppendIndexInLegend() ); setLegend(lb); } @@ -1176,4 +1181,12 @@ public class FunctionArea extends DArea implements Serializable { public boolean isShowGraphToolTips() { return doShowGraphToolTips; } + + public void setAppendIndexInLegend(boolean appendIndexInLegend) { + this.appendIndexInLegend = appendIndexInLegend; + } + + public boolean isAppendIndexInLegend() { + return appendIndexInLegend; + } } diff --git a/src/eva2/gui/GraphWindow.java b/src/eva2/gui/GraphWindow.java index 43acf89c..0139bb07 100644 --- a/src/eva2/gui/GraphWindow.java +++ b/src/eva2/gui/GraphWindow.java @@ -83,7 +83,7 @@ public class GraphWindow { try { if ((client==null) || client.getHostName().equals(InetAddress.getLocalHost().getHostName())) { if (TRACE) System.out.println("no RMI"); - m_Plotter = new Plot(PlotName,strx,stry); + m_Plotter = new Plot(PlotName, strx, stry, true); } else { m_Plotter = (PlotInterface) RMIProxyRemote.newInstance(new Plot(PlotName,strx,stry,false), m_MainAdapterClient); diff --git a/src/eva2/gui/Plot.java b/src/eva2/gui/Plot.java index e6299117..9b58dd79 100644 --- a/src/eva2/gui/Plot.java +++ b/src/eva2/gui/Plot.java @@ -74,14 +74,8 @@ public class Plot implements PlotInterface, Serializable { * You might want to try to assign the x-range as x and y-range as y array * parameters. */ - public Plot(String PlotName, String xname, String yname, double[] x, - double[] y) { - if (TRACE) - System.out.println("Constructor Plot " + PlotName); - m_xname = xname; - m_yname = yname; - m_PlotName = PlotName; - init(); + public Plot(String PlotName, String xname, String yname, double[] x, double[] y) { + this(PlotName, xname, yname, true); DPointSet points = new DPointSet(); for (int i = 0; i < x.length; i++) { points.addDPoint(x[i], y[i]); @@ -90,7 +84,12 @@ public class Plot implements PlotInterface, Serializable { } /** - * + * A basic constructor. + * + * @param PlotName + * @param xname + * @param yname + * @param init */ public Plot(String PlotName, String xname, String yname, boolean init) { if (TRACE) @@ -102,18 +101,6 @@ public class Plot implements PlotInterface, Serializable { init(); } - /** - * - */ - public Plot(String PlotName, String xname, String yname) { - if (TRACE) - System.out.println("Constructor Plot " + PlotName); - m_xname = xname; - m_yname = yname; - m_PlotName = PlotName; - init(); - } - protected void installButtons(JPanel buttonPan) { JButton ClearButton = new JButton("Clear"); ClearButton.addActionListener(new ActionListener() { @@ -245,6 +232,20 @@ public class Plot implements PlotInterface, Serializable { m_Frame.setVisible(true); } + /** + * Indicate whether graph legend entries should show their unique number. + */ + public void setAppendIndexInLegend(boolean appendIndexInLegend) { + this.m_PlotArea.setAppendIndexInLegend(appendIndexInLegend); + } + + /** + * Indicates whether graph legend entries show their unique number. + */ + public boolean isAppendIndexInLegend() { + return m_PlotArea.isAppendIndexInLegend(); + } + /** * Indicate whether the graphs are annotated by tool tip info strings. * @return true if the graphs are annotated by tool tip info strings diff --git a/src/eva2/gui/TopoPlot.java b/src/eva2/gui/TopoPlot.java index 012ba71b..d060abaa 100644 --- a/src/eva2/gui/TopoPlot.java +++ b/src/eva2/gui/TopoPlot.java @@ -41,7 +41,7 @@ public class TopoPlot extends Plot { * */ public TopoPlot(String PlotName,String xname,String yname) { - super(PlotName, xname, yname); + super(PlotName, xname, yname, true); //if (TRACE) System.out.println("Constructor TopoPlot "+PlotName); } public TopoPlot(String PlotName,String xname,String yname,double[] a, double[] b) { diff --git a/src/eva2/server/go/operators/archiving/ArchivingPESAII.java b/src/eva2/server/go/operators/archiving/ArchivingPESAII.java index 48943c6b..2c9f5da9 100644 --- a/src/eva2/server/go/operators/archiving/ArchivingPESAII.java +++ b/src/eva2/server/go/operators/archiving/ArchivingPESAII.java @@ -50,7 +50,7 @@ public class ArchivingPESAII extends AbstractArchiving implements java.io.Serial //////////////////////////////////////////////////////////////////////////////////// if (this.m_Debug) { - this.m_Plot = new eva2.gui.Plot("Debug SPEAII", "Y1", "Y2"); + this.m_Plot = new eva2.gui.Plot("Debug SPEAII", "Y1", "Y2", true); System.out.println("Population size: " + pop.size()); // plot the population this.m_Plot.setUnconnectedPoint(0, 0, 11); diff --git a/src/eva2/server/go/operators/archiving/ArchivingSPEAII.java b/src/eva2/server/go/operators/archiving/ArchivingSPEAII.java index 261e9abf..2486b4ca 100644 --- a/src/eva2/server/go/operators/archiving/ArchivingSPEAII.java +++ b/src/eva2/server/go/operators/archiving/ArchivingSPEAII.java @@ -51,7 +51,7 @@ public class ArchivingSPEAII extends AbstractArchiving implements java.io.Serial //////////////////////////////////////////////////////////////////////////////////// if (this.m_Debug) { - this.m_Plot = new eva2.gui.Plot("Debug SPEAII", "Y1", "Y2"); + this.m_Plot = new eva2.gui.Plot("Debug SPEAII", "Y1", "Y2", true); System.out.println("Population size: " + pop.size()); // plot the population this.m_Plot.setUnconnectedPoint(0, 0, 11); @@ -349,7 +349,7 @@ public class ArchivingSPEAII extends AbstractArchiving implements java.io.Serial } if (this.soutDebug) { for (int i = 0; i < result.length; i++) System.out.println("Result "+i+": "+result[i]); - this.m_Plot = new eva2.gui.Plot("Debug SPEAII", "Y1", "Y2"); + this.m_Plot = new eva2.gui.Plot("Debug SPEAII", "Y1", "Y2", true); this.m_Plot.setUnconnectedPoint(0, 0, 11); this.m_Plot.setUnconnectedPoint(1.2, 2.0, 11); GraphPointSet mySet = new GraphPointSet(10, this.m_Plot.getFunctionArea()); diff --git a/src/eva2/server/go/populations/Population.java b/src/eva2/server/go/populations/Population.java index 25e8bb8a..c6b75cca 100644 --- a/src/eva2/server/go/populations/Population.java +++ b/src/eva2/server/go/populations/Population.java @@ -1758,8 +1758,6 @@ public class Population extends ArrayList implements PopulationInterface, Clonea * @return */ public static double[] getCorrelations(Population pop) { - double[] cors = new double[pop.size()*(pop.size()-1)/2]; - if (pop.size()<2) { return new double[]{1.,1.,1.,1.}; } @@ -1767,6 +1765,7 @@ public class Population extends ArrayList implements PopulationInterface, Clonea // EVAERROR.errorMsgOnce("Warning: population correlations can only be calculated for double valued data!"); return new double[]{Double.NaN,Double.NaN,Double.NaN,Double.NaN}; } + double[] cors = new double[pop.size()*(pop.size()-1)/2]; int index=0; double corsSum=0, minCor = 10., maxCor=-10.; for (int i = 0; i < pop.size()-1; i++) { diff --git a/src/eva2/server/go/problems/F5Problem.java b/src/eva2/server/go/problems/F5Problem.java index 24386143..1b5042c3 100644 --- a/src/eva2/server/go/problems/F5Problem.java +++ b/src/eva2/server/go/problems/F5Problem.java @@ -39,7 +39,7 @@ public class F5Problem extends AbstractProblemDoubleOffset implements java.io.Se double[] result = new double[1]; double tmp; result[0] = m_YOffSet; - for (int i = 0; i < x.length-1; i++) { + for (int i = 0; i < x.length; i++) { tmp = 0; for (int j = 0; j <= i; j++) { tmp += x[j]-m_XOffSet;