refs #23
Renamed StatsParameter to StatisticsParameter. Refactored code. Added comments.
This commit is contained in:
parent
8582b79590
commit
00b6af14ff
@ -246,7 +246,7 @@ public class OptimizerRunnable implements Runnable {
|
|||||||
* @param outp
|
* @param outp
|
||||||
*/
|
*/
|
||||||
public void setOutputTo(int outp) {
|
public void setOutputTo(int outp) {
|
||||||
((StatsParameter)proc.getStatistics().getStatisticsParameter()).setOutputTo(outp);
|
((StatisticsParameter)proc.getStatistics().getStatisticsParameter()).setOutputTo(outp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,18 +1,16 @@
|
|||||||
package eva2.gui;
|
package eva2.gui;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Title: EvA2
|
* Title: EvA2 Description: Copyright: Copyright (c) 2003 Company: University of
|
||||||
* Description:
|
* Tuebingen, Computer Architecture @author Holger Ulmer, Felix Streichert,
|
||||||
* Copyright: Copyright (c) 2003
|
* Hannes Planatscher @version: $Revision: 306 $ $Date: 2007-12-04 14:22:52
|
||||||
* Company: University of Tuebingen, Computer Architecture
|
* +0100 (Tue, 04 Dec 2007) $ $Author: mkron $
|
||||||
* @author Holger Ulmer, Felix Streichert, Hannes Planatscher
|
|
||||||
* @version: $Revision: 306 $
|
|
||||||
* $Date: 2007-12-04 14:22:52 +0100 (Tue, 04 Dec 2007) $
|
|
||||||
* $Author: mkron $
|
|
||||||
*/
|
*/
|
||||||
/*==========================================================================*
|
/*
|
||||||
|
* ==========================================================================*
|
||||||
* IMPORTS
|
* IMPORTS
|
||||||
*==========================================================================*/
|
*==========================================================================
|
||||||
|
*/
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
@ -49,44 +47,45 @@ import eva2.tools.chart2d.DPoint;
|
|||||||
import eva2.tools.chart2d.DPointIcon;
|
import eva2.tools.chart2d.DPointIcon;
|
||||||
import eva2.tools.chart2d.DPointSet;
|
import eva2.tools.chart2d.DPointSet;
|
||||||
import eva2.tools.chart2d.ScaledBorder;
|
import eva2.tools.chart2d.ScaledBorder;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/*==========================================================================*
|
/*
|
||||||
|
* ==========================================================================*
|
||||||
* CLASS DECLARATION
|
* CLASS DECLARATION
|
||||||
*==========================================================================*/
|
*==========================================================================
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class FunctionArea extends DArea implements Serializable {
|
public class FunctionArea extends DArea implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated serial version identifier.
|
* Generated serial version identifier.
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 1238444548498667204L;
|
private static final long serialVersionUID = 1238444548498667204L;
|
||||||
|
private static final Logger LOGGER = Logger.getLogger(FunctionArea.class.getName());
|
||||||
private GraphPointSetLegend legendBox = null;
|
private GraphPointSetLegend legendBox = null;
|
||||||
private ScaledBorder m_Border;
|
private ScaledBorder scaledBorder;
|
||||||
private DPointIcon m_CurrentPointIcon;
|
private DPointIcon currentPointIcon;
|
||||||
private JFileChooser m_FileChooser;
|
private JFileChooser fileChooser;
|
||||||
private boolean m_legend = true;
|
private boolean legend = true;
|
||||||
private boolean m_log = false;
|
private boolean log = false;
|
||||||
private ArrayList<GraphPointSet> m_PointSetContainer;
|
private ArrayList<GraphPointSet> pointSetContainer;
|
||||||
private InterfaceRefPointListener m_RefPointListener;
|
private InterfaceRefPointListener refPointListener;
|
||||||
private int m_x;
|
private int xPos;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private int m_y;
|
private int yPos;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private boolean notifyNegLog = true;
|
private boolean notifyNegLog = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicate whether graphs should be annotated with tool tips if pointed to
|
* Indicate whether graphs should be annotated with tool tips if pointed to
|
||||||
* with the mouse.
|
* with the mouse.
|
||||||
*/
|
*/
|
||||||
private boolean doShowGraphToolTips = true;
|
private boolean doShowGraphToolTips = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicate whether graph legend entries should show their unique number.
|
* Indicate whether graph legend entries should show their unique number.
|
||||||
*/
|
*/
|
||||||
@ -111,13 +110,13 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
setMinRectangle(0, 0, 1, 1);
|
setMinRectangle(0, 0, 1, 1);
|
||||||
setBackground(new Color(253, 253, 253)); // not quite white
|
setBackground(new Color(253, 253, 253)); // not quite white
|
||||||
// setAutoFocus(true);
|
// setAutoFocus(true);
|
||||||
m_Border = new ScaledBorder();
|
scaledBorder = new ScaledBorder();
|
||||||
m_Border.x_label = xname; // "App. " + Name + " func. calls";
|
scaledBorder.x_label = xname; // "App. " + Name + " func. calls";
|
||||||
m_Border.y_label = yname; // "fitness";
|
scaledBorder.y_label = yname; // "fitness";
|
||||||
setBorder(m_Border);
|
setBorder(scaledBorder);
|
||||||
setAutoGrid(true);
|
setAutoGrid(true);
|
||||||
setGridVisible(true);
|
setGridVisible(true);
|
||||||
m_PointSetContainer = new ArrayList<GraphPointSet>(20);
|
pointSetContainer = new ArrayList<GraphPointSet>(20);
|
||||||
// new DMouseZoom( this );
|
// new DMouseZoom( this );
|
||||||
addPopup();
|
addPopup();
|
||||||
repaint();
|
repaint();
|
||||||
@ -139,11 +138,13 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
sb.append(": ");
|
sb.append(": ");
|
||||||
sb.append(getGraphInfo(gIndex));
|
sb.append(getGraphInfo(gIndex));
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
} else
|
} else {
|
||||||
return null;
|
return null;
|
||||||
} else
|
}
|
||||||
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
@ -155,19 +156,20 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
if (isShowGraphToolTips()) {
|
if (isShowGraphToolTips()) {
|
||||||
int gIndex = getNearestGraphIndex(event.getX(), event.getY());
|
int gIndex = getNearestGraphIndex(event.getX(), event.getY());
|
||||||
if (gIndex >= 0) {
|
if (gIndex >= 0) {
|
||||||
DPoint pt = ((GraphPointSet) (m_PointSetContainer.get(gIndex)))
|
DPoint pt = ((GraphPointSet) (pointSetContainer.get(gIndex))).getMedPoint();
|
||||||
.getMedPoint();
|
|
||||||
Point pt2 = getDMeasures().getPoint(pt.x, pt.y);
|
Point pt2 = getDMeasures().getPoint(pt.x, pt.y);
|
||||||
pt2.x += (5 * (gIndex % 7)); // slight shift depending on index
|
pt2.x += (5 * (gIndex % 7)); // slight shift depending on index
|
||||||
// - easier distinction of very
|
// - easier distinction of very
|
||||||
// close graphs
|
// close graphs
|
||||||
pt2.y -= (10 + (gIndex % 3) * 5);
|
pt2.y -= (10 + (gIndex % 3) * 5);
|
||||||
return pt2;
|
return pt2;
|
||||||
} else
|
} else {
|
||||||
return null;
|
return null;
|
||||||
} else
|
}
|
||||||
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -179,7 +181,7 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addGraphPointSet(GraphPointSet d) {
|
public void addGraphPointSet(GraphPointSet d) {
|
||||||
this.m_PointSetContainer.add(d);
|
this.pointSetContainer.add(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -193,13 +195,13 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
// do nothing
|
// do nothing
|
||||||
} else {
|
} else {
|
||||||
JPopupMenu graphPopupMenu = new JPopupMenu();
|
JPopupMenu graphPopupMenu = new JPopupMenu();
|
||||||
m_x = e.getX();
|
xPos = e.getX();
|
||||||
m_y = e.getY();
|
yPos = e.getY();
|
||||||
|
|
||||||
addMenuItem(graphPopupMenu, "Rename graph", new ActionListener() {
|
addMenuItem(graphPopupMenu, "Rename graph", new ActionListener() {
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent ee) {
|
public void actionPerformed(ActionEvent ee) {
|
||||||
renameGraph(getNearestGraphIndex(FunctionArea.this.m_x, FunctionArea.this.m_y));
|
renameGraph(getNearestGraphIndex(FunctionArea.this.xPos, FunctionArea.this.yPos));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// General entries
|
// General entries
|
||||||
@ -230,7 +232,7 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (FunctionArea.this.m_PointSetContainer.size() > 0) {
|
if (FunctionArea.this.pointSetContainer.size() > 0) {
|
||||||
addMenuItem(graphPopupMenu, "Recolor all graphs",
|
addMenuItem(graphPopupMenu, "Recolor all graphs",
|
||||||
new ActionListener() {
|
new ActionListener() {
|
||||||
|
|
||||||
@ -240,19 +242,19 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_RefPointListener != null) {
|
if (refPointListener != null) {
|
||||||
DPoint temp = getDMeasures().getDPoint(m_x, m_y);
|
DPoint temp = getDMeasures().getDPoint(xPos, yPos);
|
||||||
addMenuItem(graphPopupMenu, "Select Reference Point:("
|
addMenuItem(graphPopupMenu, "Select Reference Point:("
|
||||||
+ temp.x + "/" + temp.y + ")",
|
+ temp.x + "/" + temp.y + ")",
|
||||||
new ActionListener() {
|
new ActionListener() {
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent ee) {
|
public void actionPerformed(ActionEvent ee) {
|
||||||
DPoint temp = getDMeasures().getDPoint(
|
DPoint temp = getDMeasures().getDPoint(
|
||||||
m_x, m_y);
|
xPos, yPos);
|
||||||
double[] point = new double[2];
|
double[] point = new double[2];
|
||||||
point[0] = temp.x;
|
point[0] = temp.x;
|
||||||
point[1] = temp.y;
|
point[1] = temp.y;
|
||||||
m_RefPointListener.refPointGiven(point);
|
refPointListener.refPointGiven(point);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -273,15 +275,15 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
new ActionListener() {
|
new ActionListener() {
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent ee) {
|
public void actionPerformed(ActionEvent ee) {
|
||||||
removePoint(FunctionArea.this.m_x,
|
removePoint(FunctionArea.this.xPos,
|
||||||
FunctionArea.this.m_y);
|
FunctionArea.this.yPos);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (point.getIcon() instanceof InterfaceSelectablePointIcon) {
|
if (point.getIcon() instanceof InterfaceSelectablePointIcon) {
|
||||||
m_CurrentPointIcon = point.getIcon();
|
currentPointIcon = point.getIcon();
|
||||||
if (((InterfaceSelectablePointIcon) m_CurrentPointIcon).getSelectionListener() != null) {
|
if (((InterfaceSelectablePointIcon) currentPointIcon).getSelectionListener() != null) {
|
||||||
AbstractEAIndividual indy = ((InterfaceSelectablePointIcon) m_CurrentPointIcon).getEAIndividual();
|
AbstractEAIndividual indy = ((InterfaceSelectablePointIcon) currentPointIcon).getEAIndividual();
|
||||||
String selectTitle = indy.isMarked() ? " Deselect individual"
|
String selectTitle = indy.isMarked() ? " Deselect individual"
|
||||||
: " Select individual";
|
: " Select individual";
|
||||||
addMenuItem(graphPopupMenu, selectTitle,
|
addMenuItem(graphPopupMenu, selectTitle,
|
||||||
@ -289,27 +291,27 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
|
|
||||||
public void actionPerformed(
|
public void actionPerformed(
|
||||||
ActionEvent ee) {
|
ActionEvent ee) {
|
||||||
((InterfaceSelectablePointIcon) m_CurrentPointIcon).getSelectionListener().individualSelected(
|
((InterfaceSelectablePointIcon) currentPointIcon).getSelectionListener().individualSelected(
|
||||||
((InterfaceSelectablePointIcon) m_CurrentPointIcon).getEAIndividual());
|
((InterfaceSelectablePointIcon) currentPointIcon).getEAIndividual());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (point.getIcon() instanceof InterfaceDPointWithContent) {
|
if (point.getIcon() instanceof InterfaceDPointWithContent) {
|
||||||
m_CurrentPointIcon = point.getIcon();
|
currentPointIcon = point.getIcon();
|
||||||
addMenuItem(graphPopupMenu, " Show individual",
|
addMenuItem(graphPopupMenu, " Show individual",
|
||||||
new ActionListener() {
|
new ActionListener() {
|
||||||
|
|
||||||
public void actionPerformed(
|
public void actionPerformed(
|
||||||
ActionEvent ee) {
|
ActionEvent ee) {
|
||||||
((InterfaceDPointWithContent) m_CurrentPointIcon).showIndividual();
|
((InterfaceDPointWithContent) currentPointIcon).showIndividual();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (FunctionArea.this.m_PointSetContainer.size() > 0) { // there
|
if (FunctionArea.this.pointSetContainer.size() > 0) { // there
|
||||||
// is
|
// is
|
||||||
// at
|
// at
|
||||||
// least
|
// least
|
||||||
@ -324,8 +326,8 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
|
|
||||||
public void actionPerformed(ActionEvent ee) {
|
public void actionPerformed(ActionEvent ee) {
|
||||||
DPoint temp = FunctionArea.this.getDMeasures().getDPoint(
|
DPoint temp = FunctionArea.this.getDMeasures().getDPoint(
|
||||||
FunctionArea.this.m_x,
|
FunctionArea.this.xPos,
|
||||||
FunctionArea.this.m_y);
|
FunctionArea.this.yPos);
|
||||||
DPointIcon icon1 = new DPointIcon() {
|
DPointIcon icon1 = new DPointIcon() {
|
||||||
|
|
||||||
public DBorder getDBorder() {
|
public DBorder getDBorder() {
|
||||||
@ -346,8 +348,8 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
new ActionListener() {
|
new ActionListener() {
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent ee) {
|
public void actionPerformed(ActionEvent ee) {
|
||||||
clearGraph(FunctionArea.this.m_x,
|
clearGraph(FunctionArea.this.xPos,
|
||||||
FunctionArea.this.m_y);
|
FunctionArea.this.yPos);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -355,8 +357,8 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
new ActionListener() {
|
new ActionListener() {
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent ee) {
|
public void actionPerformed(ActionEvent ee) {
|
||||||
changeColorGraph(FunctionArea.this.m_x,
|
changeColorGraph(FunctionArea.this.xPos,
|
||||||
FunctionArea.this.m_y);
|
FunctionArea.this.yPos);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -404,11 +406,10 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
* This method allows to add a selection listener to the PointIcon it should
|
* This method allows to add a selection listener to the PointIcon it should
|
||||||
* need more than one listener to this abstruse event
|
* need more than one listener to this abstruse event
|
||||||
*
|
*
|
||||||
* @param a
|
* @param a The selection listener
|
||||||
* The selection listener
|
|
||||||
*/
|
*/
|
||||||
public void addRefPointSelectionListener(InterfaceRefPointListener a) {
|
public void addRefPointSelectionListener(InterfaceRefPointListener a) {
|
||||||
this.m_RefPointListener = a;
|
this.refPointListener = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -428,10 +429,10 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
*/
|
*/
|
||||||
public void changeColorGraph(int x, int y) {
|
public void changeColorGraph(int x, int y) {
|
||||||
int index = getNearestGraphIndex(x, y);
|
int index = getNearestGraphIndex(x, y);
|
||||||
if (index == -1)
|
if (index == -1) {
|
||||||
return;
|
return;
|
||||||
int GraphLabel = ((GraphPointSet) (this.m_PointSetContainer.get(index)))
|
}
|
||||||
.getGraphLabel();
|
int GraphLabel = ((GraphPointSet) (this.pointSetContainer.get(index))).getGraphLabel();
|
||||||
changeColorGraph(GraphLabel);
|
changeColorGraph(GraphLabel);
|
||||||
updateLegend();
|
updateLegend();
|
||||||
}
|
}
|
||||||
@ -442,9 +443,8 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
*/
|
*/
|
||||||
public void recolorAllGraphsByIndex() {
|
public void recolorAllGraphsByIndex() {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (int i = 0; i < m_PointSetContainer.size(); i++) {
|
for (int i = 0; i < pointSetContainer.size(); i++) {
|
||||||
GraphPointSet gps = ((GraphPointSet) (this.m_PointSetContainer
|
GraphPointSet gps = ((GraphPointSet) (this.pointSetContainer.get(i)));
|
||||||
.get(i)));
|
|
||||||
if (gps.getPointCount() > 0) {
|
if (gps.getPointCount() > 0) {
|
||||||
gps.setColorByIndex(index);
|
gps.setColorByIndex(index);
|
||||||
index++;
|
index++;
|
||||||
@ -459,31 +459,33 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
*/
|
*/
|
||||||
public boolean checkLoggable() {
|
public boolean checkLoggable() {
|
||||||
double minY = Double.MAX_VALUE;
|
double minY = Double.MAX_VALUE;
|
||||||
for (int i = 0; i < m_PointSetContainer.size(); i++) {
|
for (int i = 0; i < pointSetContainer.size(); i++) {
|
||||||
DPointSet pSet = (m_PointSetContainer.get(i).getConnectedPointSet());
|
DPointSet pSet = (pointSetContainer.get(i).getConnectedPointSet());
|
||||||
if (pSet.getSize() > 0)
|
if (pSet.getSize() > 0) {
|
||||||
minY = Math.min(minY, pSet.getMinYVal());
|
minY = Math.min(minY, pSet.getMinYVal());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// if (TRACE) System.out.println("min is " + minY);
|
// if (TRACE) System.out.println("min is " + minY);
|
||||||
return (minY > 0);
|
return (minY > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected double getMinimalPositiveYValue() {
|
protected double getMinimalPositiveYValue() {
|
||||||
double minY = Double.MAX_VALUE;
|
double minY = Double.MAX_VALUE;
|
||||||
for (int i = 0; i < m_PointSetContainer.size(); i++) {
|
for (int i = 0; i < pointSetContainer.size(); i++) {
|
||||||
DPointSet pSet = (m_PointSetContainer.get(i).getConnectedPointSet());
|
DPointSet pSet = (pointSetContainer.get(i).getConnectedPointSet());
|
||||||
if (pSet.getSize() > 0) {
|
if (pSet.getSize() > 0) {
|
||||||
double tmpMinY = Math.min(minY, pSet.getMinPositiveYValue());
|
double tmpMinY = Math.min(minY, pSet.getMinPositiveYValue());
|
||||||
if (tmpMinY > 0)
|
if (tmpMinY > 0) {
|
||||||
minY = tmpMinY;
|
minY = tmpMinY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return minY;
|
return minY;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean checkLogValidYValue(double x, double y, int graphLabel) {
|
protected boolean checkLogValidYValue(double x, double y, int graphLabel) {
|
||||||
if (y <= 0.0) {
|
if (y <= 0.0) {
|
||||||
if (m_log && notifyNegLog) {
|
if (log && notifyNegLog) {
|
||||||
System.err.println("Warning: trying to plot value (" + x + "/"
|
System.err.println("Warning: trying to plot value (" + x + "/"
|
||||||
+ y + ") with y <= 0 in logarithmic mode!");
|
+ y + ") with y <= 0 in logarithmic mode!");
|
||||||
notifyNegLog = false;
|
notifyNegLog = false;
|
||||||
@ -502,11 +504,13 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
*/
|
*/
|
||||||
public void clearAll() {
|
public void clearAll() {
|
||||||
this.removeAllDElements();
|
this.removeAllDElements();
|
||||||
for (int i = 0; i < m_PointSetContainer.size(); i++)
|
for (int i = 0; i < pointSetContainer.size(); i++) {
|
||||||
((GraphPointSet) (m_PointSetContainer.get(i))).removeAllPoints();
|
((GraphPointSet) (pointSetContainer.get(i))).removeAllPoints();
|
||||||
m_PointSetContainer.clear();
|
}
|
||||||
if (getYScale() instanceof Exp)
|
pointSetContainer.clear();
|
||||||
|
if (getYScale() instanceof Exp) {
|
||||||
setYScale(new Exp()); // to remove smallest seen value
|
setYScale(new Exp()); // to remove smallest seen value
|
||||||
|
}
|
||||||
notifyNegLog = true;
|
notifyNegLog = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -515,7 +519,7 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
*/
|
*/
|
||||||
public void clearGraph(int graphLabel) {
|
public void clearGraph(int graphLabel) {
|
||||||
getGraphPointSet(graphLabel).removeAllPoints();
|
getGraphPointSet(graphLabel).removeAllPoints();
|
||||||
m_PointSetContainer.remove(getGraphPointSet(graphLabel));
|
pointSetContainer.remove(getGraphPointSet(graphLabel));
|
||||||
if (getYScale() instanceof Exp) {
|
if (getYScale() instanceof Exp) {
|
||||||
((Exp) getYScale()).setMinValue(getMinimalPositiveYValue());
|
((Exp) getYScale()).setMinValue(getMinimalPositiveYValue());
|
||||||
}
|
}
|
||||||
@ -528,10 +532,10 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
*/
|
*/
|
||||||
public void clearGraph(int x, int y) {
|
public void clearGraph(int x, int y) {
|
||||||
int index = getNearestGraphIndex(x, y);
|
int index = getNearestGraphIndex(x, y);
|
||||||
if (index == -1)
|
if (index == -1) {
|
||||||
return;
|
return;
|
||||||
int GraphLabel = ((GraphPointSet) (this.m_PointSetContainer.get(index)))
|
}
|
||||||
.getGraphLabel();
|
int GraphLabel = ((GraphPointSet) (this.pointSetContainer.get(index))).getGraphLabel();
|
||||||
clearGraph(GraphLabel);
|
clearGraph(GraphLabel);
|
||||||
updateLegend();
|
updateLegend();
|
||||||
}
|
}
|
||||||
@ -547,8 +551,8 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected void createFileChooser() {
|
protected void createFileChooser() {
|
||||||
m_FileChooser = new JFileChooser(new File("/resources"));
|
fileChooser = new JFileChooser(new File("/resources"));
|
||||||
m_FileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
|
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -612,8 +616,7 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
popRep.addDPoint(new DPoint(position[0], position[1]));
|
popRep.addDPoint(new DPoint(position[0], position[1]));
|
||||||
DPointIcon icon = new Chart2DDPointIconText(label);
|
DPointIcon icon = new Chart2DDPointIconText(label);
|
||||||
((Chart2DDPointIconText) icon).setIcon(theIcon);
|
((Chart2DDPointIconText) icon).setIcon(theIcon);
|
||||||
((Chart2DDPointIconText) icon).setColor(getGraphPointSet(graphID)
|
((Chart2DDPointIconText) icon).setColor(getGraphPointSet(graphID).getColor());
|
||||||
.getColor());
|
|
||||||
popRep.setIcon(icon);
|
popRep.setIcon(icon);
|
||||||
addDElement(popRep);
|
addDElement(popRep);
|
||||||
}
|
}
|
||||||
@ -631,7 +634,6 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
// getGraphPointSet(GraphLabel).addDPoint(x, y);
|
// getGraphPointSet(GraphLabel).addDPoint(x, y);
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plot an icon to the function area which is annotated with a char and a
|
* Plot an icon to the function area which is annotated with a char and a
|
||||||
* double value. The color corresponds to the color of the graph with given
|
* double value. The color corresponds to the color of the graph with given
|
||||||
@ -685,52 +687,56 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
* Export contained data to a file or to standard out if null is given. The
|
* Export contained data to a file or to standard out if null is given. The
|
||||||
* given File will be overwritten!
|
* given File will be overwritten!
|
||||||
*
|
*
|
||||||
* @param file
|
* @param file a File instance or null to export to standard out
|
||||||
* a File instance or null to export to standard out
|
|
||||||
* @return true if the export succeeded, else false
|
* @return true if the export succeeded, else false
|
||||||
*/
|
*/
|
||||||
public boolean exportToAscii(File file) {
|
public boolean exportToAscii(File file) {
|
||||||
String[] s = null;
|
String[] s = null;
|
||||||
int maxSize = 0;
|
int maxSize = 0;
|
||||||
for (int i = 0; i < m_PointSetContainer.size(); i++) {
|
for (int i = 0; i < pointSetContainer.size(); i++) {
|
||||||
// find maximum length of all point sets
|
// find maximum length of all point sets
|
||||||
if (m_PointSetContainer.get(i).getConnectedPointSet().getSize() > maxSize) {
|
if (pointSetContainer.get(i).getConnectedPointSet().getSize() > maxSize) {
|
||||||
maxSize = m_PointSetContainer.get(i).getConnectedPointSet().getSize();
|
maxSize = pointSetContainer.get(i).getConnectedPointSet().getSize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (maxSize > 0) { // if there is any data, init string array and set x
|
if (maxSize > 0) { // if there is any data, init string array and set x
|
||||||
// value column
|
// value column
|
||||||
s = new String[maxSize + 1];
|
s = new String[maxSize + 1];
|
||||||
for (int j = 0; j <= maxSize; j++) s[j] = "";
|
for (int j = 0; j <= maxSize; j++) {
|
||||||
|
s[j] = "";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
System.err.println("Error: no data to export");
|
System.err.println("Error: no data to export");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < m_PointSetContainer.size(); i++) {
|
for (int i = 0; i < pointSetContainer.size(); i++) {
|
||||||
if (m_PointSetContainer.get(i) instanceof GraphPointSet) {
|
if (pointSetContainer.get(i) instanceof GraphPointSet) {
|
||||||
GraphPointSet set = (GraphPointSet) m_PointSetContainer.get(i);
|
GraphPointSet set = (GraphPointSet) pointSetContainer.get(i);
|
||||||
DPointSet pset = set.getConnectedPointSet();
|
DPointSet pset = set.getConnectedPointSet();
|
||||||
// add column names
|
// add column names
|
||||||
s[0] = s[0] + " t " + cleanBlanks(set.getInfoString(), '_');
|
s[0] = s[0] + " t " + cleanBlanks(set.getInfoString(), '_');
|
||||||
for (int j = 1; j < s.length; j++) { // add column data of place
|
for (int j = 1; j < s.length; j++) { // add column data of place
|
||||||
if ((j - 1) < pset.getSize())
|
if ((j - 1) < pset.getSize()) {
|
||||||
s[j] = s[j] + " " + pset.getDPoint(j - 1).x + " " + pset.getDPoint(j - 1).y;
|
s[j] = s[j] + " " + pset.getDPoint(j - 1).x + " " + pset.getDPoint(j - 1).y;
|
||||||
else
|
} else {
|
||||||
s[j] += " ? ?"; // placeholder if no value in this set
|
s[j] += " ? ?"; // placeholder if no value in this set
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
|
} else {
|
||||||
System.err.println("error in FunctionArea::exportToAscii");
|
System.err.println("error in FunctionArea::exportToAscii");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
for (int j = 0; j < s.length; j++) {
|
for (int j = 0; j < s.length; j++) {
|
||||||
System.out.println(s[j]);
|
System.out.println(s[j]);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else {
|
||||||
try {
|
try {
|
||||||
PrintWriter out = new PrintWriter(new FileOutputStream(file));
|
PrintWriter out = new PrintWriter(new FileOutputStream(file));
|
||||||
for (int j = 0; j < s.length; j++)
|
for (int j = 0; j < s.length; j++) {
|
||||||
out.println(s[j]);
|
out.println(s[j]);
|
||||||
|
}
|
||||||
out.flush();
|
out.flush();
|
||||||
out.close();
|
out.close();
|
||||||
return true;
|
return true;
|
||||||
@ -739,12 +745,12 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Export contained data to a file with a given String as prefix
|
* Export contained data to a file with a given String as prefix
|
||||||
*
|
*
|
||||||
* @param prefix
|
* @param prefix file name prefix
|
||||||
* file name prefix
|
|
||||||
* @return true if the export succeeded, else false
|
* @return true if the export succeeded, else false
|
||||||
*/
|
*/
|
||||||
public boolean exportToAscii(String prefix) {
|
public boolean exportToAscii(String prefix) {
|
||||||
@ -769,7 +775,7 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public int getContainerSize() {
|
public int getContainerSize() {
|
||||||
return m_PointSetContainer.size();
|
return pointSetContainer.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -780,34 +786,37 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
*/
|
*/
|
||||||
public String getGraphInfo(int x, int y) {
|
public String getGraphInfo(int x, int y) {
|
||||||
String ret = "";
|
String ret = "";
|
||||||
if ((m_PointSetContainer == null) || (m_PointSetContainer.size() == 0))
|
if ((pointSetContainer == null) || (pointSetContainer.size() == 0)) {
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
int minindex = getNearestGraphIndex(x, y);
|
int minindex = getNearestGraphIndex(x, y);
|
||||||
if (minindex >= 0)
|
if (minindex >= 0) {
|
||||||
return ((GraphPointSet) (m_PointSetContainer.get(minindex)))
|
return ((GraphPointSet) (pointSetContainer.get(minindex))).getInfoString();
|
||||||
.getInfoString();
|
} else {
|
||||||
else
|
|
||||||
return "none";
|
return "none";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getGraphInfo(int graphIndex) {
|
public String getGraphInfo(int graphIndex) {
|
||||||
String ret = "";
|
String ret = "";
|
||||||
if ((m_PointSetContainer == null) || (m_PointSetContainer.size() == 0))
|
if ((pointSetContainer == null) || (pointSetContainer.size() == 0)) {
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
if (graphIndex >= 0 && (graphIndex < m_PointSetContainer.size()))
|
if (graphIndex >= 0 && (graphIndex < pointSetContainer.size())) {
|
||||||
return ((GraphPointSet) (m_PointSetContainer.get(graphIndex)))
|
return ((GraphPointSet) (pointSetContainer.get(graphIndex))).getInfoString();
|
||||||
.getInfoString();
|
} else {
|
||||||
else
|
|
||||||
return "none";
|
return "none";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Color getGraphColor(int graphIndex) {
|
public Color getGraphColor(int graphIndex) {
|
||||||
if (graphIndex >= 0)
|
if (graphIndex >= 0) {
|
||||||
return m_PointSetContainer.get(graphIndex).getColor();
|
return pointSetContainer.get(graphIndex).getColor();
|
||||||
else
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -817,9 +826,9 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
private GraphPointSet getGraphPointSet(int GraphLabel) {
|
private GraphPointSet getGraphPointSet(int GraphLabel) {
|
||||||
// System.out.println("looping through " + m_PointSetContainer.size() +
|
// System.out.println("looping through " + m_PointSetContainer.size() +
|
||||||
// " point sets...");
|
// " point sets...");
|
||||||
for (int i = 0; i < m_PointSetContainer.size(); i++) {
|
for (int i = 0; i < pointSetContainer.size(); i++) {
|
||||||
if (m_PointSetContainer.get(i) instanceof GraphPointSet) {
|
if (pointSetContainer.get(i) instanceof GraphPointSet) {
|
||||||
GraphPointSet xx = (GraphPointSet) (m_PointSetContainer.get(i));
|
GraphPointSet xx = (GraphPointSet) (pointSetContainer.get(i));
|
||||||
// System.out.println("looking at "+xx.getGraphLabel());
|
// System.out.println("looking at "+xx.getGraphLabel());
|
||||||
if (xx.getGraphLabel() == GraphLabel) {
|
if (xx.getGraphLabel() == GraphLabel) {
|
||||||
// System.out.println("match!");
|
// System.out.println("match!");
|
||||||
@ -845,13 +854,13 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
DPoint point1 = getDMeasures().getDPoint(x, y);
|
DPoint point1 = getDMeasures().getDPoint(x, y);
|
||||||
DPoint point2 = null;
|
DPoint point2 = null;
|
||||||
double dist = 0;
|
double dist = 0;
|
||||||
for (int i = 0; i < m_PointSetContainer.size(); i++) {
|
for (int i = 0; i < pointSetContainer.size(); i++) {
|
||||||
if (m_PointSetContainer.get(i) instanceof GraphPointSet) {
|
if (pointSetContainer.get(i) instanceof GraphPointSet) {
|
||||||
GraphPointSet pointset = (GraphPointSet) (m_PointSetContainer
|
GraphPointSet pointset = (GraphPointSet) (pointSetContainer.get(i));
|
||||||
.get(i));
|
|
||||||
point2 = pointset.getNearestDPoint(point1);
|
point2 = pointset.getNearestDPoint(point1);
|
||||||
if (point2 == null)
|
if (point2 == null) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
dist = (point1.x - point2.x) * (point1.x - point2.x)
|
dist = (point1.x - point2.x) * (point1.x - point2.x)
|
||||||
+ (point1.y - point2.y) * (point1.y - point2.y);
|
+ (point1.y - point2.y) * (point1.y - point2.y);
|
||||||
// System.out.println("dist="+dist+"i="+i);
|
// System.out.println("dist="+dist+"i="+i);
|
||||||
@ -883,13 +892,15 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
DPoint point1 = getDMeasures().getDPoint(x, y);
|
DPoint point1 = getDMeasures().getDPoint(x, y);
|
||||||
DPoint point2 = null;
|
DPoint point2 = null;
|
||||||
double dist = 0;
|
double dist = 0;
|
||||||
for (int i = 0; i < m_PointSetContainer.size(); i++) {
|
for (int i = 0; i < pointSetContainer.size(); i++) {
|
||||||
GraphPointSet pointset = m_PointSetContainer.get(i);
|
GraphPointSet pointset = pointSetContainer.get(i);
|
||||||
point2 = pointset.getNearestDPoint(point1);
|
point2 = pointset.getNearestDPoint(point1);
|
||||||
if (point2 == null)
|
if (point2 == null) {
|
||||||
continue;
|
continue;
|
||||||
if (point1 == null)
|
}
|
||||||
|
if (point1 == null) {
|
||||||
System.err.println("point1 == null");
|
System.err.println("point1 == null");
|
||||||
|
}
|
||||||
|
|
||||||
dist = (point1.x - point2.x) * (point1.x - point2.x)
|
dist = (point1.x - point2.x) * (point1.x - point2.x)
|
||||||
+ (point1.y - point2.y) * (point1.y - point2.y);
|
+ (point1.y - point2.y) * (point1.y - point2.y);
|
||||||
@ -918,7 +929,7 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
* @return InterfaceSelectionListener
|
* @return InterfaceSelectionListener
|
||||||
*/
|
*/
|
||||||
public InterfaceRefPointListener getRefPointSelectionListener() {
|
public InterfaceRefPointListener getRefPointSelectionListener() {
|
||||||
return this.m_RefPointListener;
|
return this.refPointListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -926,11 +937,11 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
*/
|
*/
|
||||||
public boolean isStatisticsGraph(int x, int y) {
|
public boolean isStatisticsGraph(int x, int y) {
|
||||||
boolean ret = false;
|
boolean ret = false;
|
||||||
if ((m_PointSetContainer == null) || (m_PointSetContainer.size() == 0))
|
if ((pointSetContainer == null) || (pointSetContainer.size() == 0)) {
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
int minindex = getNearestGraphIndex(x, y);
|
int minindex = getNearestGraphIndex(x, y);
|
||||||
ret = ((GraphPointSet) (m_PointSetContainer.get(minindex)))
|
ret = ((GraphPointSet) (pointSetContainer.get(minindex))).isStatisticsGraph();
|
||||||
.isStatisticsGraph();
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -939,15 +950,17 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
* position.
|
* position.
|
||||||
*/
|
*/
|
||||||
public void jump() {
|
public void jump() {
|
||||||
for (int i = 0; i < m_PointSetContainer.size(); i++)
|
for (int i = 0; i < pointSetContainer.size(); i++) {
|
||||||
((GraphPointSet) (m_PointSetContainer.get(i))).jump();
|
((GraphPointSet) (pointSetContainer.get(i))).jump();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g) {
|
public void paint(Graphics g) {
|
||||||
super.paint(g);
|
super.paint(g);
|
||||||
if (legendBox != null && m_legend)
|
if (legendBox != null && legend) {
|
||||||
legendBox.paintIn(g, m_Border.getInnerRect(this));
|
legendBox.paintIn(g, scaledBorder.getInnerRect(this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -955,12 +968,12 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public DPointSet[] printPoints() {
|
public DPointSet[] printPoints() {
|
||||||
DPointSet[] ret = new DPointSet[m_PointSetContainer.size()];
|
DPointSet[] ret = new DPointSet[pointSetContainer.size()];
|
||||||
for (int i = 0; i < m_PointSetContainer.size(); i++) {
|
for (int i = 0; i < pointSetContainer.size(); i++) {
|
||||||
System.out.println("");
|
System.out.println("");
|
||||||
System.out.println("GraphPointSet No " + i);
|
System.out.println("GraphPointSet No " + i);
|
||||||
|
|
||||||
ret[i] = ((GraphPointSet) m_PointSetContainer.get(i)).printPoints();
|
ret[i] = ((GraphPointSet) pointSetContainer.get(i)).printPoints();
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
@ -976,7 +989,7 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
System.out.println("");
|
System.out.println("");
|
||||||
System.out.println("GraphPointSet No " + i);
|
System.out.println("GraphPointSet No " + i);
|
||||||
|
|
||||||
return ((GraphPointSet) m_PointSetContainer.get(i)).printPoints();
|
return ((GraphPointSet) pointSetContainer.get(i)).printPoints();
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -988,10 +1001,10 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
public void removePoint(int x, int y) {
|
public void removePoint(int x, int y) {
|
||||||
DPoint point = getNearestDPoint(x, y);
|
DPoint point = getNearestDPoint(x, y);
|
||||||
int index = getNearestGraphIndex(x, y);
|
int index = getNearestGraphIndex(x, y);
|
||||||
if (index == -1 || point == null)
|
if (index == -1 || point == null) {
|
||||||
return;
|
return;
|
||||||
GraphPointSet pointset = (GraphPointSet) (this.m_PointSetContainer
|
}
|
||||||
.get(index));
|
GraphPointSet pointset = (GraphPointSet) (this.pointSetContainer.get(index));
|
||||||
pointset.removePoint(point);
|
pointset.removePoint(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -999,13 +1012,14 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
* This method allows to remove the selection listener to the PointIcon
|
* This method allows to remove the selection listener to the PointIcon
|
||||||
*/
|
*/
|
||||||
public void removeRefPointSelectionListeners() {
|
public void removeRefPointSelectionListeners() {
|
||||||
this.m_RefPointListener = null;
|
this.refPointListener = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setConnectedPoint(double x, double y, int graphLabel) {
|
public void setConnectedPoint(double x, double y, int graphLabel) {
|
||||||
DFunction scF = getYScale();
|
DFunction scF = getYScale();
|
||||||
if (scF instanceof Exp)
|
if (scF instanceof Exp) {
|
||||||
((Exp) scF).updateMinValue(y);
|
((Exp) scF).updateMinValue(y);
|
||||||
|
}
|
||||||
if (!checkLogValidYValue(x, y, graphLabel)) {
|
if (!checkLogValidYValue(x, y, graphLabel)) {
|
||||||
// if (m_log) toggleLog();
|
// if (m_log) toggleLog();
|
||||||
}
|
}
|
||||||
@ -1064,7 +1078,6 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
// }
|
// }
|
||||||
// return null;
|
// return null;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// *
|
// *
|
||||||
// */
|
// */
|
||||||
@ -1094,7 +1107,6 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param GraphLabel
|
* @param GraphLabel
|
||||||
@ -1122,9 +1134,10 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
*/
|
*/
|
||||||
protected void setLegend(GraphPointSetLegend lBox) {
|
protected void setLegend(GraphPointSetLegend lBox) {
|
||||||
legendBox = lBox;
|
legendBox = lBox;
|
||||||
if (lBox != null && m_legend)
|
if (lBox != null && legend) {
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -1134,8 +1147,9 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
*/
|
*/
|
||||||
public void setUnconnectedPoint(double x, double y, int GraphLabel) {
|
public void setUnconnectedPoint(double x, double y, int GraphLabel) {
|
||||||
DFunction scF = getYScale();
|
DFunction scF = getYScale();
|
||||||
if (scF instanceof Exp)
|
if (scF instanceof Exp) {
|
||||||
((Exp) scF).updateMinValue(y);
|
((Exp) scF).updateMinValue(y);
|
||||||
|
}
|
||||||
if (!checkLogValidYValue(x, y, GraphLabel)) {
|
if (!checkLogValidYValue(x, y, GraphLabel)) {
|
||||||
// if (m_log) toggleLog();
|
// if (m_log) toggleLog();
|
||||||
}
|
}
|
||||||
@ -1157,12 +1171,12 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private void toggleLegend() {
|
private void toggleLegend() {
|
||||||
m_legend = !m_legend;
|
legend = !legend;
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isShowLegend() {
|
public boolean isShowLegend() {
|
||||||
return m_legend;
|
return legend;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1171,21 +1185,21 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
* @param on
|
* @param on
|
||||||
*/
|
*/
|
||||||
public void setShowLegend(boolean on) {
|
public void setShowLegend(boolean on) {
|
||||||
m_legend = on;
|
legend = on;
|
||||||
if (!on) {
|
if (!on) {
|
||||||
legendBox = null;
|
legendBox = null;
|
||||||
} else {
|
} else {
|
||||||
legendBox = new GraphPointSetLegend(m_PointSetContainer,
|
legendBox = new GraphPointSetLegend(pointSetContainer,
|
||||||
isAppendIndexInLegend());
|
isAppendIndexInLegend());
|
||||||
}
|
}
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean renameGraph(int graphIndex) {
|
private boolean renameGraph(int graphIndex) {
|
||||||
if ((m_PointSetContainer == null) || (m_PointSetContainer.size() == 0)) {
|
if ((pointSetContainer == null) || (pointSetContainer.size() == 0)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (graphIndex >= 0 && (graphIndex <m_PointSetContainer.size())) {
|
if (graphIndex >= 0 && (graphIndex < pointSetContainer.size())) {
|
||||||
String oldName = getGraphInfo(graphIndex);
|
String oldName = getGraphInfo(graphIndex);
|
||||||
String newName = ToolBoxGui.getInputPaneInitialVal(this, "Rename a graph", "Enter new name for graph " + graphIndex + ":", oldName);
|
String newName = ToolBoxGui.getInputPaneInitialVal(this, "Rename a graph", "Enter new name for graph " + graphIndex + ":", oldName);
|
||||||
if (newName != null) {
|
if (newName != null) {
|
||||||
@ -1198,11 +1212,12 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean renameGraph(int graphIndex, String newName) {
|
private boolean renameGraph(int graphIndex, String newName) {
|
||||||
if ((m_PointSetContainer == null) || (m_PointSetContainer.size() == 0))
|
if ((pointSetContainer == null) || (pointSetContainer.size() == 0)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (graphIndex >= 0 && (graphIndex <m_PointSetContainer.size())) {
|
if (graphIndex >= 0 && (graphIndex < pointSetContainer.size())) {
|
||||||
GraphPointSet gps = ((GraphPointSet) (m_PointSetContainer.get(graphIndex)));
|
GraphPointSet gps = ((GraphPointSet) (pointSetContainer.get(graphIndex)));
|
||||||
gps.setInfoString(newName);
|
gps.setInfoString(newName);
|
||||||
updateLegend();
|
updateLegend();
|
||||||
return true;
|
return true;
|
||||||
@ -1217,32 +1232,31 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
public void toggleLog() {
|
public void toggleLog() {
|
||||||
// System.out.println("ToggleLog log was: "+m_log);
|
// System.out.println("ToggleLog log was: "+m_log);
|
||||||
boolean setMinPos = false;
|
boolean setMinPos = false;
|
||||||
if (!m_log && !checkLoggable()) {
|
if (!log && !checkLoggable()) {
|
||||||
System.err
|
System.err.println("Warning: toggling logarithmics scale with values <= 0! Some points will not be displayed.");
|
||||||
.println("Warning: toggling logarithmics scale with values <= 0! Some points will not be displayed.");
|
|
||||||
setMinPos = true;
|
setMinPos = true;
|
||||||
}
|
}
|
||||||
if (m_log == false) {
|
if (log == false) {
|
||||||
setMinRectangle(0.001, 0.001, 1, 1);
|
setMinRectangle(0.001, 0.001, 1, 1);
|
||||||
// setVisibleRectangle( 0.001, 0.001, 100000, 1000 );
|
// setVisibleRectangle( 0.001, 0.001, 100000, 1000 );
|
||||||
Exp exp = new Exp();
|
Exp exp = new Exp();
|
||||||
if (setMinPos)
|
if (setMinPos) {
|
||||||
exp.setMinValue(getMinimalPositiveYValue());
|
exp.setMinValue(getMinimalPositiveYValue());
|
||||||
|
}
|
||||||
setYScale(exp);
|
setYScale(exp);
|
||||||
m_Border.setSrcdY(Math.log(10));
|
scaledBorder.setSrcdY(Math.log(10));
|
||||||
m_Border.setScientificPattern(false); // scientific on y axis
|
scaledBorder.setScientificPattern(false); // scientific on y axis
|
||||||
// m_Border.applyPattern(false, "0.###E0"); // replaced by the former line
|
log = true;
|
||||||
m_log = true;
|
|
||||||
} else {
|
} else {
|
||||||
m_log = false;
|
log = false;
|
||||||
setYScale(null);
|
setYScale(null);
|
||||||
ScaledBorder buffer = m_Border;
|
ScaledBorder buffer = scaledBorder;
|
||||||
m_Border = new ScaledBorder();
|
scaledBorder = new ScaledBorder();
|
||||||
m_Border.x_label = buffer.x_label; // "App. " + Name +
|
scaledBorder.x_label = buffer.x_label; // "App. " + Name +
|
||||||
// " func. calls";
|
// " func. calls";
|
||||||
m_Border.y_label = buffer.y_label; // "fitness";
|
scaledBorder.y_label = buffer.y_label; // "fitness";
|
||||||
m_Border.setStandardPattern(false); // default decimal pattern on y axis
|
scaledBorder.setStandardPattern(false); // default decimal pattern on y axis
|
||||||
setBorder(m_Border);
|
setBorder(scaledBorder);
|
||||||
}
|
}
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
@ -1253,28 +1267,30 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
* @param immediateRepaint if true, a repaint event is scheduled immediately
|
* @param immediateRepaint if true, a repaint event is scheduled immediately
|
||||||
*/
|
*/
|
||||||
public void toggleScientificY(boolean immediateRepaint) {
|
public void toggleScientificY(boolean immediateRepaint) {
|
||||||
m_Border.toggleDecPattern(false);
|
scaledBorder.toggleDecPattern(false);
|
||||||
if (immediateRepaint) repaint();
|
if (immediateRepaint) {
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows setting whether or not to paint the y-axis in logarithmic scale.
|
* Allows setting whether or not to paint the y-axis in logarithmic scale.
|
||||||
*
|
*
|
||||||
* @param log
|
* @param log if true logarithmic scale is used, linear scale in case of
|
||||||
* if true logarithmic scale is used, linear scale in case of
|
|
||||||
* false.
|
* false.
|
||||||
*/
|
*/
|
||||||
public void toggleLog(boolean log) {
|
public void toggleLog(boolean log) {
|
||||||
if (log != m_log)
|
if (log != log) {
|
||||||
toggleLog();
|
toggleLog();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recreate the legend object with the current point sets.
|
* Recreate the legend object with the current point sets.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void updateLegend() {
|
public void updateLegend() {
|
||||||
GraphPointSetLegend lb = new GraphPointSetLegend(m_PointSetContainer,
|
GraphPointSetLegend lb = new GraphPointSetLegend(pointSetContainer,
|
||||||
isAppendIndexInLegend());
|
isAppendIndexInLegend());
|
||||||
setLegend(lb);
|
setLegend(lb);
|
||||||
}
|
}
|
||||||
@ -1282,8 +1298,7 @@ public class FunctionArea extends DArea implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* Gives the info string for a graph label.
|
* Gives the info string for a graph label.
|
||||||
*
|
*
|
||||||
* @param j
|
* @param j The graph label identifier.
|
||||||
* The graph label identifier.
|
|
||||||
* @return The associated info string.
|
* @return The associated info string.
|
||||||
*/
|
*/
|
||||||
public String getInfoString(int j) {
|
public String getInfoString(int j) {
|
||||||
|
@ -121,8 +121,8 @@ public class Plot implements PlotInterface, Serializable {
|
|||||||
m_PlotArea.toggleLog();
|
m_PlotArea.toggleLog();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
JButton ExportButton = new JButton("Export...");
|
JButton ExportButton = new JButton("Export to TSV");
|
||||||
ExportButton.setToolTipText("Exports the graph data to a simple ascii file.");
|
ExportButton.setToolTipText("Exports the graph data to a simple TSV file.");
|
||||||
ExportButton.addActionListener(new ActionListener() {
|
ExportButton.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
@ -33,7 +33,7 @@ import eva2.server.go.strategies.HillClimbing;
|
|||||||
import eva2.server.go.strategies.NelderMeadSimplex;
|
import eva2.server.go.strategies.NelderMeadSimplex;
|
||||||
import eva2.server.modules.GOParameters;
|
import eva2.server.modules.GOParameters;
|
||||||
import eva2.server.stat.InterfaceTextListener;
|
import eva2.server.stat.InterfaceTextListener;
|
||||||
import eva2.server.stat.StatsParameter;
|
import eva2.server.stat.StatisticsParameter;
|
||||||
import eva2.tools.Pair;
|
import eva2.tools.Pair;
|
||||||
import eva2.tools.math.Mathematics;
|
import eva2.tools.math.Mathematics;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -805,7 +805,7 @@ public class PostProcess {
|
|||||||
*/
|
*/
|
||||||
private static void runPP(OptimizerRunnable rnbl) {
|
private static void runPP(OptimizerRunnable rnbl) {
|
||||||
rnbl.getGOParams().setDoPostProcessing(false);
|
rnbl.getGOParams().setDoPostProcessing(false);
|
||||||
rnbl.setVerbosityLevel(StatsParameter.VERBOSITY_NONE);
|
rnbl.setVerbosityLevel(StatisticsParameter.VERBOSITY_NONE);
|
||||||
ppRunnables.add(rnbl);
|
ppRunnables.add(rnbl);
|
||||||
// System.err.println("Starting runbl " + rnbl);
|
// System.err.println("Starting runbl " + rnbl);
|
||||||
rnbl.run();
|
rnbl.run();
|
||||||
|
@ -188,7 +188,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
|||||||
String startDate = getDateString();
|
String startDate = getDateString();
|
||||||
// open the result file:
|
// open the result file:
|
||||||
if (doFileOutput() // not "text-window only"
|
if (doFileOutput() // not "text-window only"
|
||||||
&& (m_StatsParams.getOutputVerbosity().getSelectedTagID() > StatsParameter.VERBOSITY_NONE)) { // verbosity accordingly high
|
&& (m_StatsParams.getOutputVerbosity().getSelectedTagID() > StatisticsParameter.VERBOSITY_NONE)) { // verbosity accordingly high
|
||||||
//!resFName.equalsIgnoreCase("none") && !resFName.equals("")) {
|
//!resFName.equalsIgnoreCase("none") && !resFName.equals("")) {
|
||||||
String fnameBase = makeOutputFileName(m_StatsParams.getResultFilePrefix(), infoString, startDate);
|
String fnameBase = makeOutputFileName(m_StatsParams.getResultFilePrefix(), infoString, startDate);
|
||||||
int cnt=0;
|
int cnt=0;
|
||||||
@ -1136,22 +1136,22 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private boolean printLineByVerbosity(int iteration) {
|
private boolean printLineByVerbosity(int iteration) {
|
||||||
return (m_StatsParams.getOutputVerbosity().getSelectedTagID() > StatsParameter.VERBOSITY_KTH_IT)
|
return (m_StatsParams.getOutputVerbosity().getSelectedTagID() > StatisticsParameter.VERBOSITY_KTH_IT)
|
||||||
|| ((m_StatsParams.getOutputVerbosity().getSelectedTagID() == StatsParameter.VERBOSITY_KTH_IT)
|
|| ((m_StatsParams.getOutputVerbosity().getSelectedTagID() == StatisticsParameter.VERBOSITY_KTH_IT)
|
||||||
&& (isKthRun(iteration, m_StatsParams.getOutputVerbosityK())));
|
&& (isKthRun(iteration, m_StatsParams.getOutputVerbosityK())));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean printRunIntroVerbosity() {
|
private boolean printRunIntroVerbosity() {
|
||||||
return (m_StatsParams.getOutputVerbosity().getSelectedTagID() >= StatsParameter.VERBOSITY_KTH_IT)
|
return (m_StatsParams.getOutputVerbosity().getSelectedTagID() >= StatisticsParameter.VERBOSITY_KTH_IT)
|
||||||
|| (optRunsPerformed==0 && (m_StatsParams.getOutputVerbosity().getSelectedTagID() >= StatsParameter.VERBOSITY_FINAL));
|
|| (optRunsPerformed==0 && (m_StatsParams.getOutputVerbosity().getSelectedTagID() >= StatisticsParameter.VERBOSITY_FINAL));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean printRunStoppedVerbosity() {
|
private boolean printRunStoppedVerbosity() {
|
||||||
return (m_StatsParams.getOutputVerbosity().getSelectedTagID() >= StatsParameter.VERBOSITY_KTH_IT);
|
return (m_StatsParams.getOutputVerbosity().getSelectedTagID() >= StatisticsParameter.VERBOSITY_KTH_IT);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean printFinalVerbosity() {
|
private boolean printFinalVerbosity() {
|
||||||
return (m_StatsParams.getOutputVerbosity().getSelectedTagID() > StatsParameter.VERBOSITY_NONE);
|
return (m_StatsParams.getOutputVerbosity().getSelectedTagID() > StatisticsParameter.VERBOSITY_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isKthRun(int i, int k) {
|
private boolean isKthRun(int i, int k) {
|
||||||
@ -1166,7 +1166,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean printHeaderByVerbosity() {
|
private boolean printHeaderByVerbosity() {
|
||||||
return (m_StatsParams.getOutputVerbosity().getSelectedTagID() >= StatsParameter.VERBOSITY_KTH_IT);
|
return (m_StatsParams.getOutputVerbosity().getSelectedTagID() >= StatisticsParameter.VERBOSITY_KTH_IT);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void divideMean(Double[] mean, double d) {
|
private static void divideMean(Double[] mean, double d) {
|
||||||
|
@ -12,52 +12,57 @@ package eva2.server.stat;
|
|||||||
/*==========================================================================*
|
/*==========================================================================*
|
||||||
* IMPORTS
|
* IMPORTS
|
||||||
*==========================================================================*/
|
*==========================================================================*/
|
||||||
import java.io.Serializable;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
|
|
||||||
import eva2.gui.DataViewer;
|
import eva2.gui.DataViewer;
|
||||||
import eva2.gui.DataViewerInterface;
|
import eva2.gui.DataViewerInterface;
|
||||||
import eva2.gui.Graph;
|
import eva2.gui.Graph;
|
||||||
import eva2.tools.jproxy.MainAdapterClient;
|
import eva2.tools.jproxy.MainAdapterClient;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class GenericStatistics implements Serializable {
|
public class GenericStatistics implements Serializable {
|
||||||
public static boolean TRACE = false;
|
|
||||||
|
private static final Logger LOGGER = Logger.getLogger(GenericStatistics.class.getName());
|
||||||
//private Object m_target;
|
//private Object m_target;
|
||||||
private int m_Test;
|
private int test;
|
||||||
private String[] m_PropertyNames;
|
private String[] propertyNames;
|
||||||
private boolean[] m_State;
|
private boolean[] states;
|
||||||
private transient Field[] m_fields;
|
private transient Field[] fields;
|
||||||
private DataViewerInterface m_Viewer;
|
private DataViewerInterface viewer;
|
||||||
private Graph m_Graph;
|
private Graph graph;
|
||||||
private static MainAdapterClient m_MainAdapterClient;
|
private static MainAdapterClient mainAdapterClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static void setMainAdapterClient (MainAdapterClient x) {
|
public static void setMainAdapterClient(MainAdapterClient adapter) {
|
||||||
m_MainAdapterClient = x;
|
mainAdapterClient = adapter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public GenericStatistics getClone() {
|
public GenericStatistics getClone() {
|
||||||
return new GenericStatistics(this);
|
return new GenericStatistics(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private GenericStatistics(GenericStatistics Source) {
|
private GenericStatistics(GenericStatistics Source) {
|
||||||
//m_target = Source.m_target;
|
//m_target = Source.m_target;
|
||||||
m_Test = Source.m_Test;
|
test = Source.test;
|
||||||
m_PropertyNames = Source.m_PropertyNames;
|
propertyNames = Source.propertyNames;
|
||||||
m_State = Source.m_State;
|
states = Source.states;
|
||||||
m_fields = Source.m_fields;
|
fields = Source.fields;
|
||||||
m_Viewer = Source.m_Viewer;
|
viewer = Source.viewer;
|
||||||
m_Graph = Source.m_Graph;
|
graph = Source.graph;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -65,64 +70,71 @@ public class GenericStatistics implements Serializable{
|
|||||||
//m_target = target;
|
//m_target = target;
|
||||||
//System.out.println("GenericStatistics-->");
|
//System.out.println("GenericStatistics-->");
|
||||||
try {
|
try {
|
||||||
m_fields = getDeclaredFields(target);
|
fields = getDeclaredFields(target);
|
||||||
//if (TRACE) System.out.println("fields-->"+m_fields.length);
|
//if (TRACE) System.out.println("fields-->"+m_fields.length);
|
||||||
m_PropertyNames = new String [m_fields.length];
|
propertyNames = new String[fields.length];
|
||||||
m_State = new boolean [m_fields.length];
|
states = new boolean[fields.length];
|
||||||
for (int i=0;i<m_fields.length;i++) {
|
for (int i = 0; i < fields.length; i++) {
|
||||||
String desc = m_fields[i].toString(); //System.out.println("desc "+desc);
|
String desc = fields[i].toString(); //System.out.println("desc "+desc);
|
||||||
int istransient = desc.indexOf("transient");
|
int istransient = desc.indexOf("transient");
|
||||||
//if (TRACE) System.out.println("Field :"+m_fields[i].getName() );
|
//if (TRACE) System.out.println("Field :"+m_fields[i].getName() );
|
||||||
Object FieldValue = null;
|
Object FieldValue = null;
|
||||||
if (istransient==-1 || m_fields[i].getName().equals("elementData")) { // the elementdatahack
|
if (istransient == -1 || fields[i].getName().equals("elementData")) { // the elementdatahack
|
||||||
m_fields[i].setAccessible(true);
|
fields[i].setAccessible(true);
|
||||||
FieldValue = m_fields[i].get(target);
|
FieldValue = fields[i].get(target);
|
||||||
}
|
}
|
||||||
m_PropertyNames[i] = m_fields[i].getName();
|
propertyNames[i] = fields[i].getName();
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
System.out.println("ERROR in GenericStatistics:" + ex.getMessage());
|
System.out.println("ERROR in GenericStatistics:" + ex.getMessage());
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setTest(int Test) {
|
public void setTest(int Test) {
|
||||||
m_Test = Test;
|
test = Test;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public int getTest() {
|
public int getTest() {
|
||||||
return m_Test;
|
return test;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public String[] getPropertyNames() {
|
public String[] getPropertyNames() {
|
||||||
return m_PropertyNames;
|
return propertyNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public boolean[] getState() {
|
public boolean[] getState() {
|
||||||
return m_State;
|
return states;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setState(boolean[] x) {
|
public void setState(boolean[] x) {
|
||||||
System.out.println("in statistics setState !!!!!!!!!!!!!!!!!!");
|
System.out.println("in statistics setState !!!!!!!!!!!!!!!!!!");
|
||||||
m_State = x;
|
states = x;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void initViewer() {
|
public void initViewer() {
|
||||||
m_Viewer = DataViewer.getInstance(m_MainAdapterClient,"test");
|
viewer = DataViewer.getInstance(mainAdapterClient, "test");
|
||||||
m_Graph = m_Viewer.getNewGraph("test");
|
graph = viewer.getNewGraph("test");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -141,41 +153,52 @@ public class GenericStatistics implements Serializable{
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void statechanged(Object target) {
|
public void statechanged(Object target) {
|
||||||
int len = 0;
|
int len = 0;
|
||||||
for (int i=0;i<m_State.length;i++)
|
for (int i = 0; i < states.length; i++) {
|
||||||
if (m_State[i]==true) len++;
|
if (states[i] == true) {
|
||||||
if (len==0) return;
|
len++;
|
||||||
if (m_Viewer == null) initViewer();
|
}
|
||||||
|
}
|
||||||
|
if (len == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (viewer == null) {
|
||||||
|
initViewer();
|
||||||
|
}
|
||||||
double[] data = new double[len];
|
double[] data = new double[len];
|
||||||
try {
|
try {
|
||||||
m_fields = getDeclaredFields(target);
|
fields = getDeclaredFields(target);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
System.out.println("ERROR in GenericStatistics:" + ex.getMessage());
|
System.out.println("ERROR in GenericStatistics:" + ex.getMessage());
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (int i=0;i<m_fields.length;i++) {
|
for (int i = 0; i < fields.length; i++) {
|
||||||
for (int n=0;n<m_PropertyNames.length;n++) {
|
for (int n = 0; n < propertyNames.length; n++) {
|
||||||
if (this.m_State[n]==false)
|
if (this.states[n] == false) {
|
||||||
continue;
|
continue;
|
||||||
if (m_fields[i].getName().equals(m_PropertyNames[n])) {
|
}
|
||||||
String desc = m_fields[i].toString(); //System.out.println("desc "+desc);
|
if (fields[i].getName().equals(propertyNames[n])) {
|
||||||
|
String desc = fields[i].toString(); //System.out.println("desc "+desc);
|
||||||
int istransient = desc.indexOf("transient");
|
int istransient = desc.indexOf("transient");
|
||||||
//if (TRACE) System.out.println("Field :"+m_fields[i].getName() );
|
//if (TRACE) System.out.println("Field :"+m_fields[i].getName() );
|
||||||
Object FieldValue = null;
|
Object FieldValue = null;
|
||||||
if (istransient==-1 || m_fields[i].getName().equals("elementData")) { // the elementdatahack
|
if (istransient == -1 || fields[i].getName().equals("elementData")) { // the elementdatahack
|
||||||
m_fields[i].setAccessible(true);
|
fields[i].setAccessible(true);
|
||||||
try {
|
try {
|
||||||
FieldValue = m_fields[i].get(target);
|
FieldValue = fields[i].get(target);
|
||||||
//System.out.println("m_PropertyNames "+m_PropertyNames[n] +" value "+FieldValue.toString());
|
//System.out.println("m_PropertyNames "+m_PropertyNames[n] +" value "+FieldValue.toString());
|
||||||
if (FieldValue instanceof Double)
|
if (FieldValue instanceof Double) {
|
||||||
data[index] = ((Double) FieldValue).doubleValue();
|
data[index] = ((Double) FieldValue).doubleValue();
|
||||||
if (FieldValue instanceof Integer)
|
}
|
||||||
|
if (FieldValue instanceof Integer) {
|
||||||
data[index] = ((Integer) FieldValue).doubleValue();
|
data[index] = ((Integer) FieldValue).doubleValue();
|
||||||
|
}
|
||||||
index++;
|
index++;
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
System.out.println("ERROR in GenericStatistics:" + ex.getMessage());
|
System.out.println("ERROR in GenericStatistics:" + ex.getMessage());
|
||||||
@ -186,6 +209,6 @@ public class GenericStatistics implements Serializable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_Graph.setConnectedPoint(data[1],data[0]);
|
graph.setConnectedPoint(data[1], data[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9,51 +9,48 @@ import eva2.tools.StringSelection;
|
|||||||
* @see StatsParameter
|
* @see StatsParameter
|
||||||
*/
|
*/
|
||||||
public interface InterfaceStatisticsParameter {
|
public interface InterfaceStatisticsParameter {
|
||||||
public String getName();
|
String getName();
|
||||||
public void saveInstance();
|
void saveInstance();
|
||||||
// public String globalInfo();
|
void setMultiRuns(int x);
|
||||||
// public void setTextoutput(int i);
|
int getMultiRuns();
|
||||||
// public void setPlotoutput(int i); // noone knows what these were useful for...
|
String multiRunsTipText();
|
||||||
// public int GetPlotoutput();
|
|
||||||
// public int GetTextoutput();
|
|
||||||
// public String textoutputTipText();
|
|
||||||
// public String plotFrequencyTipText();
|
|
||||||
public void setMultiRuns(int x);
|
|
||||||
public int getMultiRuns();
|
|
||||||
public String multiRunsTipText();
|
|
||||||
|
|
||||||
// public String GetInfoString();
|
|
||||||
// public void setInfoString(String s);
|
|
||||||
|
|
||||||
public boolean GetUseStatPlot(); // use averaged graph for multi-run plots or not
|
/**
|
||||||
public void setUseStatPlot(boolean x); // activate averaged graph for multi-run plots
|
* Use averaged graph for multi-run plots or not.
|
||||||
|
*
|
||||||
|
* @return If an average graph is used or not
|
||||||
|
*/
|
||||||
|
boolean getUseStatPlot();
|
||||||
|
|
||||||
// public List<String[]> getPlotDescriptions();
|
/**
|
||||||
|
* Activate averaged graph for multi-run plots.
|
||||||
|
*
|
||||||
|
* @param x If averaged graph should be activated.
|
||||||
|
*/
|
||||||
|
void setUseStatPlot(boolean x);
|
||||||
|
|
||||||
// public SelectedTag getPlotData();
|
StringSelection getFieldSelection();
|
||||||
// public void setPlotData(SelectedTag newMethod);
|
void setFieldSelection(StringSelection v);
|
||||||
|
|
||||||
public StringSelection getFieldSelection();
|
String getResultFilePrefix();
|
||||||
public void setFieldSelection(StringSelection v);
|
void setResultFilePrefix(String x);
|
||||||
|
|
||||||
public String getResultFilePrefix();
|
void setConvergenceRateThreshold(double x);
|
||||||
public void SetResultFilePrefix(String x);
|
double getConvergenceRateThreshold();
|
||||||
|
|
||||||
public void setConvergenceRateThreshold(double x);
|
void setShowTextOutput(boolean show);
|
||||||
public double getConvergenceRateThreshold();
|
boolean isShowTextOutput();
|
||||||
|
|
||||||
public void SetShowTextOutput(boolean show);
|
boolean isOutputAllFieldsAsText();
|
||||||
public boolean isShowTextOutput();
|
void setOutputAllFieldsAsText(boolean bShowFullText);
|
||||||
|
|
||||||
public boolean isOutputAllFieldsAsText();
|
void setOutputVerbosity(SelectedTag sTag);
|
||||||
public void setOutputAllFieldsAsText(boolean bShowFullText);
|
SelectedTag getOutputVerbosity();
|
||||||
|
|
||||||
public void setOutputVerbosity(SelectedTag sTag);
|
int getOutputVerbosityK();
|
||||||
public SelectedTag getOutputVerbosity();
|
void setOutputVerbosityK(int k);
|
||||||
|
|
||||||
public int getOutputVerbosityK();
|
void setOutputTo(SelectedTag sTag);
|
||||||
public void setOutputVerbosityK(int k);
|
SelectedTag getOutputTo();
|
||||||
|
|
||||||
public void setOutputTo(SelectedTag sTag);
|
|
||||||
public SelectedTag getOutputTo();
|
|
||||||
}
|
}
|
@ -18,19 +18,19 @@ import eva2.server.go.strategies.InterfaceOptimizer;
|
|||||||
*/
|
*/
|
||||||
public class StatisticsDummy implements InterfaceStatistics, InterfaceTextListener {
|
public class StatisticsDummy implements InterfaceStatistics, InterfaceTextListener {
|
||||||
boolean consoleOut = false;
|
boolean consoleOut = false;
|
||||||
StatsParameter sParams = null;
|
StatisticsParameter sParams = null;
|
||||||
AbstractEAIndividual bestCurrentIndividual, bestRunIndy, bestIndividualAllover;
|
AbstractEAIndividual bestCurrentIndividual, bestRunIndy, bestIndividualAllover;
|
||||||
|
|
||||||
public StatisticsDummy() {
|
public StatisticsDummy() {
|
||||||
bestIndividualAllover = null;
|
bestIndividualAllover = null;
|
||||||
sParams = new StatsParameter();
|
sParams = new StatisticsParameter();
|
||||||
sParams.setOutputVerbosityK(StatsParameter.VERBOSITY_NONE);
|
sParams.setOutputVerbosityK(StatisticsParameter.VERBOSITY_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public StatisticsDummy(boolean doConsoleOut) {
|
public StatisticsDummy(boolean doConsoleOut) {
|
||||||
bestIndividualAllover = null;
|
bestIndividualAllover = null;
|
||||||
sParams = new StatsParameter();
|
sParams = new StatisticsParameter();
|
||||||
sParams.setOutputVerbosityK(StatsParameter.VERBOSITY_NONE);
|
sParams.setOutputVerbosityK(StatisticsParameter.VERBOSITY_NONE);
|
||||||
consoleOut = doConsoleOut;
|
consoleOut = doConsoleOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
390
src/eva2/server/stat/StatisticsParameter.java
Normal file
390
src/eva2/server/stat/StatisticsParameter.java
Normal file
@ -0,0 +1,390 @@
|
|||||||
|
package eva2.server.stat;
|
||||||
|
|
||||||
|
import eva2.gui.BeanInspector;
|
||||||
|
import eva2.gui.GenericObjectEditor;
|
||||||
|
import eva2.server.go.InterfaceNotifyOnInformers;
|
||||||
|
import eva2.server.go.problems.InterfaceAdditionalPopulationInformer;
|
||||||
|
import eva2.tools.EVAERROR;
|
||||||
|
import eva2.tools.SelectedTag;
|
||||||
|
import eva2.tools.Serializer;
|
||||||
|
import eva2.tools.StringSelection;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A set of parameters for statistics in EvA2. Several data entries are provided by the AbstractStatistics class,
|
||||||
|
* others by the additional informers. This class allows customization of entries and frequency of data output.
|
||||||
|
* Data entries can be selected using a StringSelection instance.
|
||||||
|
* There is a switch called "output full data as text" which will be interpreted by AbstractStatistics showing
|
||||||
|
* all or only the selected entities.
|
||||||
|
*
|
||||||
|
* @see AbstractStatistics
|
||||||
|
* @author mkron
|
||||||
|
*/
|
||||||
|
public class StatisticsParameter implements InterfaceStatisticsParameter, InterfaceNotifyOnInformers, Serializable {
|
||||||
|
private static final long serialVersionUID = -8681061379203108390L;
|
||||||
|
private static final Logger LOGGER = Logger.getLogger(StatisticsParameter.class.getName());
|
||||||
|
public final static int VERBOSITY_NONE = 0;
|
||||||
|
public final static int VERBOSITY_FINAL = 1;
|
||||||
|
public final static int VERBOSITY_KTH_IT = 2;
|
||||||
|
public final static int VERBOSITY_ALL = 3;
|
||||||
|
SelectedTag outputVerbosity = new SelectedTag("No output", "Final results", "K-th iterations", "All iterations");
|
||||||
|
public final static int OUTPUT_FILE = 0;
|
||||||
|
public final static int OUTPUT_WINDOW = 1;
|
||||||
|
public final static int OUTPUT_FILE_WINDOW = 2;
|
||||||
|
SelectedTag outputTo = new SelectedTag("File (current dir.)", "Text-window", "Both file and text-window");
|
||||||
|
private int verboK = 10;
|
||||||
|
private int m_Textoutput = 0;
|
||||||
|
private int m_MultiRuns = 1;
|
||||||
|
private String m_ResultFilePrefix = "EvA2";
|
||||||
|
protected String m_Name = "not defined";
|
||||||
|
private boolean m_useStatPlot = true;
|
||||||
|
private boolean showAdditionalProblemInfo = false;
|
||||||
|
private double m_ConvergenceRateThreshold = 0.001;
|
||||||
|
private StringSelection graphSel = new StringSelection(GraphSelectionEnum.currentBest, GraphSelectionEnum.getInfoStrings());
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static StatisticsParameter getInstance(boolean loadDefaultSerFile) {
|
||||||
|
if (loadDefaultSerFile) {
|
||||||
|
return getInstance("Statistics.ser");
|
||||||
|
} else {
|
||||||
|
return new StatisticsParameter();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load or create a new instance of the class.
|
||||||
|
*
|
||||||
|
* @return A loaded (from file) or new instance of the class.
|
||||||
|
*/
|
||||||
|
public static StatisticsParameter getInstance(String serFileName) {
|
||||||
|
StatisticsParameter instance = null;
|
||||||
|
try {
|
||||||
|
FileInputStream fileStream = new FileInputStream(serFileName);
|
||||||
|
instance = (StatisticsParameter) Serializer.loadObject(fileStream);
|
||||||
|
} catch (FileNotFoundException ex) {
|
||||||
|
LOGGER.log(Level.WARNING, "Could not store instance object.", ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new StatisticsParameter();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public StatisticsParameter() {
|
||||||
|
m_Name = "Statistics";
|
||||||
|
outputVerbosity.setSelectedTag(VERBOSITY_KTH_IT);
|
||||||
|
outputTo.setSelectedTag(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
String ret = "\r\nStatisticsParameter (" + super.toString() + "):\r\nm_MultiRuns=" + m_MultiRuns
|
||||||
|
+ ", m_Textoutput=" + m_Textoutput
|
||||||
|
+ // ", m_Plotoutput=" + m_Plotoutput +
|
||||||
|
", verbosity= " + outputVerbosity.getSelectedString()
|
||||||
|
+ "\nTo " + outputTo.getSelectedString()
|
||||||
|
+ ", " + BeanInspector.toString(graphSel.getStrings());
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void saveInstance() {
|
||||||
|
try {
|
||||||
|
FileOutputStream fileStream = new FileOutputStream("Statistics.ser");
|
||||||
|
Serializer.storeObject(fileStream, this);
|
||||||
|
} catch (FileNotFoundException ex) {
|
||||||
|
LOGGER.log(Level.WARNING, "Could not store instance object.", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private StatisticsParameter(StatisticsParameter Source) {
|
||||||
|
m_ConvergenceRateThreshold = Source.m_ConvergenceRateThreshold;
|
||||||
|
m_useStatPlot = Source.m_useStatPlot;
|
||||||
|
m_Textoutput = Source.m_Textoutput;
|
||||||
|
// m_Plotoutput = Source.m_Plotoutput;
|
||||||
|
// m_PlotFitness = Source.m_PlotFitness;
|
||||||
|
m_MultiRuns = Source.m_MultiRuns;
|
||||||
|
m_ResultFilePrefix = Source.m_ResultFilePrefix;
|
||||||
|
verboK = Source.verboK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public Object getClone() {
|
||||||
|
return new StatisticsParameter(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return m_Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String globalInfo() {
|
||||||
|
return "Configure statistics and output of the optimization run. Changes to the data selection state will not take effect during a run.";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void setMultiRuns(int x) {
|
||||||
|
m_MultiRuns = x;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int getMultiRuns() {
|
||||||
|
return m_MultiRuns;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String multiRunsTipText() {
|
||||||
|
return "Number of independent optimization runs to evaluate.";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public String infoStringTipText() {
|
||||||
|
return "Infostring displayed on fitness graph by prssing the right mouse button.";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use averaged graph for multi-run plots or not
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean getUseStatPlot() {
|
||||||
|
return m_useStatPlot;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Activate or deactivate averaged graph for multi-run plots
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void setUseStatPlot(boolean x) {
|
||||||
|
m_useStatPlot = x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String useStatPlotTipText() {
|
||||||
|
return "Plotting each fitness graph separately if multiruns > 1.";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void setResultFilePrefix(String x) {
|
||||||
|
if (x == null) {
|
||||||
|
m_ResultFilePrefix = "";
|
||||||
|
} else {
|
||||||
|
m_ResultFilePrefix = x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getResultFilePrefix() {
|
||||||
|
return m_ResultFilePrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setShowTextOutput(boolean show) {
|
||||||
|
// activate if not activated
|
||||||
|
if (show && outputTo.getSelectedTagID() == 0) {
|
||||||
|
outputTo.setSelectedTag(2);
|
||||||
|
} // deactivate if activated
|
||||||
|
else if (!show && outputTo.getSelectedTagID() > 0) {
|
||||||
|
outputTo.setSelectedTag(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isShowTextOutput() {
|
||||||
|
return outputTo.getSelectedTagID() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// *
|
||||||
|
// */
|
||||||
|
// public String resultFileNameTipText() {
|
||||||
|
// return "File name for the result file. If empty or 'none', no output file will be created.";
|
||||||
|
// }
|
||||||
|
public String convergenceRateThresholdTipText() {
|
||||||
|
return "Provided the optimal fitness is at zero, give the threshold below which it is considered as 'reached'";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param x
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void setConvergenceRateThreshold(double x) {
|
||||||
|
m_ConvergenceRateThreshold = x;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public double getConvergenceRateThreshold() {
|
||||||
|
return m_ConvergenceRateThreshold;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOutputAllFieldsAsText() {
|
||||||
|
return showAdditionalProblemInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOutputAllFieldsAsText(boolean bShowFullText) {
|
||||||
|
showAdditionalProblemInfo = bShowFullText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String outputAllFieldsAsTextTipText() {
|
||||||
|
return "Output all available data fields or only the selected entries as text.";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void hideHideable() {
|
||||||
|
setOutputVerbosity(getOutputVerbosity());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOutputVerbosity(SelectedTag sTag) {
|
||||||
|
outputVerbosity = sTag;
|
||||||
|
GenericObjectEditor.setHideProperty(this.getClass(), "outputVerbosityK", sTag.getSelectedTagID() != VERBOSITY_KTH_IT);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOutputVerbosity(int i) {
|
||||||
|
outputVerbosity.setSelectedTag(i);
|
||||||
|
GenericObjectEditor.setHideProperty(this.getClass(), "outputVerbosityK", outputVerbosity.getSelectedTagID() != VERBOSITY_KTH_IT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SelectedTag getOutputVerbosity() {
|
||||||
|
return outputVerbosity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String outputVerbosityTipText() {
|
||||||
|
return "Set the data output level.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getOutputVerbosityK() {
|
||||||
|
return verboK;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOutputVerbosityK(int k) {
|
||||||
|
verboK = k;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String outputVerbosityKTipText() {
|
||||||
|
return "Set the interval of data output for intermediate verbosity (in generations).";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SelectedTag getOutputTo() {
|
||||||
|
return outputTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOutputTo(SelectedTag tag) {
|
||||||
|
outputTo = tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOutputTo(int i) {
|
||||||
|
outputTo.setSelectedTag(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String outputToTipText() {
|
||||||
|
return "Set the output destination; to deactivate output, set verbosity to none.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StringSelection getFieldSelection() {
|
||||||
|
return graphSel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setFieldSelection(StringSelection v) {
|
||||||
|
graphSel = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String fieldSelectionTipText() {
|
||||||
|
return "Select the data fields to be collected and plotted. Note that only simple types can be plotted to the GUI.";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* May be called to dynamically alter the set of graphs that can be
|
||||||
|
* selected, using a list of informer instances, which usually are the
|
||||||
|
* problem and the optimizer instance.
|
||||||
|
*
|
||||||
|
* @see InterfaceAdditionalPopulationInformer
|
||||||
|
*/
|
||||||
|
public void setInformers(List<InterfaceAdditionalPopulationInformer> informers) {
|
||||||
|
ArrayList<String> headerFields = new ArrayList<String>();
|
||||||
|
ArrayList<String> infoFields = new ArrayList<String>();
|
||||||
|
// parse list of header elements, show additional Strings according to names.
|
||||||
|
for (InterfaceAdditionalPopulationInformer inf : informers) {
|
||||||
|
String[] dataHeader = inf.getAdditionalDataHeader();
|
||||||
|
headerFields.addAll(Arrays.asList(dataHeader));
|
||||||
|
if (infoFields.size() < headerFields.size()) { // add info strings for tool tips - fill up with null if none have been returned.
|
||||||
|
String[] infos = inf.getAdditionalDataInfo();
|
||||||
|
if (infos != null) {
|
||||||
|
if (infos.length != dataHeader.length) {
|
||||||
|
System.out.println(BeanInspector.toString(infos));
|
||||||
|
System.out.println(BeanInspector.toString(dataHeader));
|
||||||
|
EVAERROR.errorMsgOnce("Warning, mismatching number of headers and additional data fields for " + inf.getClass() + " (" + dataHeader.length + " vs. " + infos.length + ").");
|
||||||
|
}
|
||||||
|
infoFields.addAll(Arrays.asList(infos));
|
||||||
|
}
|
||||||
|
while (infoFields.size() < headerFields.size()) {
|
||||||
|
infoFields.add(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// header += inf.getAdditionalDataHeader(null); // lets hope this works with a null
|
||||||
|
}
|
||||||
|
// create additional fields to be selectable by the user, defined by the informer headers
|
||||||
|
// StringSelection ss = new StringSelection(GraphSelectionEnum.getAndAppendArray(headerFields.toArray(new String[headerFields.size()])));
|
||||||
|
StringSelection ss = new StringSelection(GraphSelectionEnum.currentBest, GraphSelectionEnum.getInfoStrings(),
|
||||||
|
headerFields, infoFields.toArray(new String[infoFields.size()]));
|
||||||
|
ss.takeOverSelection(graphSel);
|
||||||
|
// System.out.println("In " + this + ": setting new informers: " + BeanInspector.toString(ss.getStrings()));
|
||||||
|
// This works!
|
||||||
|
setFieldSelection(ss);
|
||||||
|
// System.out.println("After: " + this);
|
||||||
|
}
|
||||||
|
}
|
@ -58,21 +58,21 @@ public class StatisticsStandalone extends AbstractStatistics implements Interfac
|
|||||||
}
|
}
|
||||||
|
|
||||||
public StatisticsStandalone(String resultFileName) {
|
public StatisticsStandalone(String resultFileName) {
|
||||||
this(resultFileName, 1, resultFileName==null ? StatsParameter.VERBOSITY_NONE : StatsParameter.VERBOSITY_FINAL, false);
|
this(resultFileName, 1, resultFileName==null ? StatisticsParameter.VERBOSITY_NONE : StatisticsParameter.VERBOSITY_FINAL, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public StatisticsStandalone(String resultFileName, int multiRuns, int verbosity, boolean outputAllFieldsAsText) {
|
public StatisticsStandalone(String resultFileName, int multiRuns, int verbosity, boolean outputAllFieldsAsText) {
|
||||||
this(StatsParameter.getInstance(false));
|
this(StatisticsParameter.getInstance(false));
|
||||||
m_StatsParams.setMultiRuns(multiRuns);
|
m_StatsParams.setMultiRuns(multiRuns);
|
||||||
m_StatsParams.setOutputVerbosity(m_StatsParams.getOutputVerbosity().setSelectedTag(verbosity));
|
m_StatsParams.setOutputVerbosity(m_StatsParams.getOutputVerbosity().setSelectedTag(verbosity));
|
||||||
m_StatsParams.SetResultFilePrefix(resultFileName);
|
m_StatsParams.setResultFilePrefix(resultFileName);
|
||||||
m_StatsParams.setOutputAllFieldsAsText(outputAllFieldsAsText);
|
m_StatsParams.setOutputAllFieldsAsText(outputAllFieldsAsText);
|
||||||
if (resultFileName==null) m_StatsParams.getOutputTo().setSelectedTag(StatsParameter.OUTPUT_WINDOW);
|
if (resultFileName==null) m_StatsParams.getOutputTo().setSelectedTag(StatisticsParameter.OUTPUT_WINDOW);
|
||||||
else m_StatsParams.setOutputTo(m_StatsParams.getOutputTo().setSelectedTag(StatsParameter.OUTPUT_FILE));
|
else m_StatsParams.setOutputTo(m_StatsParams.getOutputTo().setSelectedTag(StatisticsParameter.OUTPUT_FILE));
|
||||||
}
|
}
|
||||||
|
|
||||||
public StatisticsStandalone() {
|
public StatisticsStandalone() {
|
||||||
this(new StatsParameter());
|
this(new StatisticsParameter());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initPlots(PopulationInterface pop, List<InterfaceAdditionalPopulationInformer> informerList) {
|
protected void initPlots(PopulationInterface pop, List<InterfaceAdditionalPopulationInformer> informerList) {
|
||||||
|
@ -43,25 +43,23 @@ import java.util.logging.Logger;
|
|||||||
* from AbstractStatistics.
|
* from AbstractStatistics.
|
||||||
*/
|
*/
|
||||||
public class StatisticsWithGUI extends AbstractStatistics implements Serializable, InterfaceStatistics {
|
public class StatisticsWithGUI extends AbstractStatistics implements Serializable, InterfaceStatistics {
|
||||||
|
|
||||||
private static final long serialVersionUID = 3213603978877954103L;
|
private static final long serialVersionUID = 3213603978877954103L;
|
||||||
private static final Logger LOGGER = Logger.getLogger(eva2.EvAInfo.defaultLogger);
|
private static final Logger LOGGER = Logger.getLogger(StatisticsWithGUI.class.getName());
|
||||||
// Plot frames:
|
// Plot frames:
|
||||||
private GraphWindow[] fitnessFrame; // frame for the fitness plots
|
private GraphWindow[] fitnessFrame; // frame for the fitness plots
|
||||||
private Graph[][] fitnessGraph;
|
private Graph[][] fitnessGraph;
|
||||||
private Graph[][] statGraph;
|
private Graph[][] statGraph;
|
||||||
|
|
||||||
private String graphInfoString;
|
private String graphInfoString;
|
||||||
protected int plotCounter;
|
protected int plotCounter;
|
||||||
|
|
||||||
private MainAdapterClient mainAdapterClient; // the connection to the client MainAdapter
|
private MainAdapterClient mainAdapterClient; // the connection to the client MainAdapter
|
||||||
private JTextoutputFrameInterface proxyPrinter;
|
private JTextoutputFrameInterface proxyPrinter;
|
||||||
|
/*
|
||||||
/* List of descriptor strings and optional indices. strictly its
|
* List of descriptor strings and optional indices. strictly its redundant
|
||||||
* redundant since super.lastGraphSelection is always available.
|
* since super.lastGraphSelection is always available. However it spares
|
||||||
* However it spares some time.
|
* some time.
|
||||||
*/
|
*/
|
||||||
private transient List<Pair<String, Integer>> graphDesc = null;
|
private transient List<Pair<String, Integer>> graphDesc = null;
|
||||||
|
|
||||||
protected static String hostName = null;
|
protected static String hostName = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,17 +80,18 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
|
|||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
LOGGER.log(Level.WARNING, "Could not retrieve hostname.", ex);
|
LOGGER.log(Level.WARNING, "Could not retrieve hostname.", ex);
|
||||||
}
|
}
|
||||||
} else hostName = "localhost";
|
} else {
|
||||||
|
hostName = "localhost";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((client == null) || client.getHostName().equals(hostName)) {
|
if ((client == null) || client.getHostName().equals(hostName)) {
|
||||||
m_StatsParams = StatsParameter.getInstance(true);
|
m_StatsParams = StatisticsParameter.getInstance(true);
|
||||||
proxyPrinter = new JTextoutputFrame("TextOutput of " + hostName);
|
proxyPrinter = new JTextoutputFrame("TextOutput of " + hostName);
|
||||||
} else { // we use RMI
|
} else { // we use RMI
|
||||||
m_StatsParams = (InterfaceStatisticsParameter) RMIProxyLocal.newInstance(
|
m_StatsParams = (InterfaceStatisticsParameter) RMIProxyLocal.newInstance(
|
||||||
StatsParameter.getInstance(true));
|
StatisticsParameter.getInstance(true));
|
||||||
proxyPrinter = (JTextoutputFrameInterface) RMIProxyRemote.newInstance(new
|
proxyPrinter = (JTextoutputFrameInterface) RMIProxyRemote.newInstance(new JTextoutputFrame("TextOutput " + hostName),
|
||||||
JTextoutputFrame("TextOutput " + hostName),
|
|
||||||
mainAdapterClient);
|
mainAdapterClient);
|
||||||
}
|
}
|
||||||
addTextListener(proxyPrinter);
|
addTextListener(proxyPrinter);
|
||||||
@ -109,7 +108,9 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
|
|||||||
// m_PlotCounter = m_StatsParams.GetPlotoutput();
|
// m_PlotCounter = m_StatsParams.GetPlotoutput();
|
||||||
if ((fitnessFrame != null) && (fitnessFrame[0] != null)) {
|
if ((fitnessFrame != null) && (fitnessFrame[0] != null)) {
|
||||||
PlotInterface p = fitnessFrame[0].getPlotter();
|
PlotInterface p = fitnessFrame[0].getPlotter();
|
||||||
if ((p!=null) && p.isValid()) ((Plot)p).getFunctionArea().clearLegend();
|
if ((p != null) && p.isValid()) {
|
||||||
|
((Plot) p).getFunctionArea().clearLegend();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +123,9 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
|
|||||||
}
|
}
|
||||||
|
|
||||||
int fullRuns = optRunsPerformed;
|
int fullRuns = optRunsPerformed;
|
||||||
if (!normal) fullRuns--;
|
if (!normal) {
|
||||||
|
fullRuns--;
|
||||||
|
}
|
||||||
|
|
||||||
// unite the graphs only if the break was "normal"
|
// unite the graphs only if the break was "normal"
|
||||||
if ((m_StatsParams.getMultiRuns() > 1) && (statGraph != null)) {
|
if ((m_StatsParams.getMultiRuns() > 1) && (statGraph != null)) {
|
||||||
@ -156,8 +159,10 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void initPlots(PopulationInterface pop, List<InterfaceAdditionalPopulationInformer> informerList) {
|
protected void initPlots(PopulationInterface pop, List<InterfaceAdditionalPopulationInformer> informerList) {
|
||||||
if (TRACE) System.out.println("initPlots");
|
if (TRACE) {
|
||||||
if (m_StatsParams instanceof StatsParameter) {
|
System.out.println("initPlots");
|
||||||
|
}
|
||||||
|
if (m_StatsParams instanceof StatisticsParameter) {
|
||||||
// StringSelection ss = ((StatsParameter)m_StatsParams).getGraphSelection();
|
// StringSelection ss = ((StatsParameter)m_StatsParams).getGraphSelection();
|
||||||
graphDesc = lastFieldSelection.getSelectedWithIndex();
|
graphDesc = lastFieldSelection.getSelectedWithIndex();
|
||||||
// for (int i=0; i<description.get(0).length; i++) graphDesc.add(description.get(0)[i]);
|
// for (int i=0; i<description.get(0).length; i++) graphDesc.add(description.get(0)[i]);
|
||||||
@ -189,8 +194,8 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
|
|||||||
fitnessGraph[i][j].jump();
|
fitnessGraph[i][j].jump();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_StatsParams.getMultiRuns() > 1 &&
|
if (m_StatsParams.getMultiRuns() > 1
|
||||||
m_StatsParams.GetUseStatPlot() == true) {
|
&& m_StatsParams.getUseStatPlot() == true) {
|
||||||
// String Info = m_StatsParams.GetInfoString();
|
// String Info = m_StatsParams.GetInfoString();
|
||||||
statGraph = new Graph[windowCount][];
|
statGraph = new Graph[windowCount][];
|
||||||
for (int i = 0; i < statGraph.length; i++) {
|
for (int i = 0; i < statGraph.length; i++) {
|
||||||
@ -237,10 +242,13 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
|
|||||||
// boolean doPlotAdditionalInfo = m_StatsParams.isOutputAdditionalInfo();
|
// boolean doPlotAdditionalInfo = m_StatsParams.isOutputAdditionalInfo();
|
||||||
for (int i = 0; i < graphDesc.size(); i++) {
|
for (int i = 0; i < graphDesc.size(); i++) {
|
||||||
Integer colIndex = i + 1; // always add one because the function calls are located in column zero
|
Integer colIndex = i + 1; // always add one because the function calls are located in column zero
|
||||||
if (lastIsShowFull) colIndex = 1+graphDesc.get(i).tail;
|
if (lastIsShowFull) {
|
||||||
|
colIndex = 1 + graphDesc.get(i).tail;
|
||||||
|
}
|
||||||
// plot the column as indicated by the graph description
|
// plot the column as indicated by the graph description
|
||||||
if (currentStatDoubleData[colIndex]!=null) plotFitnessPoint(0, subGraph++, functionCalls, currentStatDoubleData[colIndex]);
|
if (currentStatDoubleData[colIndex] != null) {
|
||||||
else {
|
plotFitnessPoint(0, subGraph++, functionCalls, currentStatDoubleData[colIndex]);
|
||||||
|
} else {
|
||||||
// EVAERROR.errorMsgOnce("Error, data field " + graphDesc.get(i).head + " does not contain primitive data and cannot be plotted.");
|
// EVAERROR.errorMsgOnce("Error, data field " + graphDesc.get(i).head + " does not contain primitive data and cannot be plotted.");
|
||||||
subGraph++; // increase index anyways or the name assignment gets inconsistent
|
subGraph++; // increase index anyways or the name assignment gets inconsistent
|
||||||
}
|
}
|
||||||
@ -249,8 +257,9 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is more or less deprecated. The current standard population does not
|
* This method is more or less deprecated. The current standard population
|
||||||
* define specific data. However its used by the ES module implementation.
|
* does not define specific data. However its used by the ES module
|
||||||
|
* implementation.
|
||||||
*/
|
*/
|
||||||
public void plotSpecificData(PopulationInterface pop, List<InterfaceAdditionalPopulationInformer> informer) {
|
public void plotSpecificData(PopulationInterface pop, List<InterfaceAdditionalPopulationInformer> informer) {
|
||||||
double[] specificData = pop.getSpecificData();
|
double[] specificData = pop.getSpecificData();
|
||||||
|
@ -1,419 +0,0 @@
|
|||||||
package eva2.server.stat;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import eva2.gui.BeanInspector;
|
|
||||||
import eva2.gui.GenericObjectEditor;
|
|
||||||
import eva2.server.go.InterfaceNotifyOnInformers;
|
|
||||||
import eva2.server.go.problems.InterfaceAdditionalPopulationInformer;
|
|
||||||
import eva2.tools.EVAERROR;
|
|
||||||
import eva2.tools.SelectedTag;
|
|
||||||
import eva2.tools.Serializer;
|
|
||||||
import eva2.tools.StringSelection;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A set of parameters for statistics in EvA2. Several data entries are provided by the AbstractStatistics class,
|
|
||||||
* others by the additional informers. This class allows customization of entries and frequency of data output.
|
|
||||||
* Data entries can be selected using a StringSelection instance.
|
|
||||||
* There is a switch called "output full data as text" which will be interpreted by AbstractStatistics showing
|
|
||||||
* all or only the selected entities.
|
|
||||||
*
|
|
||||||
* @see AbstractStatistics
|
|
||||||
* @author mkron
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class StatsParameter implements InterfaceStatisticsParameter, InterfaceNotifyOnInformers, Serializable {
|
|
||||||
private static final long serialVersionUID = -8681061379203108390L;
|
|
||||||
|
|
||||||
private static boolean TRACE = false;
|
|
||||||
private static final Logger LOGGER = Logger.getLogger(eva2.EvAInfo.defaultLogger);
|
|
||||||
|
|
||||||
public final static int VERBOSITY_NONE = 0;
|
|
||||||
public final static int VERBOSITY_FINAL = 1;
|
|
||||||
public final static int VERBOSITY_KTH_IT = 2;
|
|
||||||
public final static int VERBOSITY_ALL = 3;
|
|
||||||
SelectedTag outputVerbosity = new SelectedTag("No output", "Final results", "K-th iterations", "All iterations");
|
|
||||||
|
|
||||||
public final static int OUTPUT_FILE = 0;
|
|
||||||
public final static int OUTPUT_WINDOW = 1;
|
|
||||||
public final static int OUTPUT_FILE_WINDOW = 2;
|
|
||||||
SelectedTag outputTo = new SelectedTag("File (current dir.)", "Text-window", "Both file and text-window");
|
|
||||||
private int verboK = 10;
|
|
||||||
|
|
||||||
// private int m_PlotFitness = PLOT_BEST;
|
|
||||||
private int m_Textoutput = 0;
|
|
||||||
// private int m_Plotoutput = 1;
|
|
||||||
private int m_MultiRuns = 1;
|
|
||||||
private String m_ResultFilePrefix = "EvA2";
|
|
||||||
protected String m_Name = "not defined";
|
|
||||||
// protected String m_InfoString = "";
|
|
||||||
private boolean m_useStatPlot = true;
|
|
||||||
private boolean showAdditionalProblemInfo = false;
|
|
||||||
private double m_ConvergenceRateThreshold=0.001;
|
|
||||||
|
|
||||||
private StringSelection graphSel = new StringSelection(GraphSelectionEnum.currentBest, GraphSelectionEnum.getInfoStrings());
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public static StatsParameter getInstance(boolean loadDefaultSerFile) {
|
|
||||||
if (loadDefaultSerFile) {
|
|
||||||
return getInstance("Statistics.ser");
|
|
||||||
} else {
|
|
||||||
return new StatsParameter();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load or create a new instance of the class.
|
|
||||||
*
|
|
||||||
* @return A loaded (from file) or new instance of the class.
|
|
||||||
*/
|
|
||||||
public static StatsParameter getInstance(String serFileName) {
|
|
||||||
StatsParameter instance = null;
|
|
||||||
try {
|
|
||||||
FileInputStream fileStream = new FileInputStream(serFileName);
|
|
||||||
instance = (StatsParameter) Serializer.loadObject(fileStream);
|
|
||||||
} catch (FileNotFoundException ex) {
|
|
||||||
LOGGER.log(Level.WARNING, "Could not store instance object.", ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (instance == null) {
|
|
||||||
instance = new StatsParameter();
|
|
||||||
}
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public StatsParameter() {
|
|
||||||
m_Name = "Statistics";
|
|
||||||
outputVerbosity.setSelectedTag(VERBOSITY_KTH_IT);
|
|
||||||
outputTo.setSelectedTag(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public String toString() {
|
|
||||||
String ret = "\r\nStatParameter (" + super.toString() + "):\r\nm_MultiRuns=" + m_MultiRuns +
|
|
||||||
", m_Textoutput=" + m_Textoutput +
|
|
||||||
// ", m_Plotoutput=" + m_Plotoutput +
|
|
||||||
", verbosity= " + outputVerbosity.getSelectedString() +
|
|
||||||
"\nTo " + outputTo.getSelectedString() +
|
|
||||||
", " + BeanInspector.toString(graphSel.getStrings());
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void saveInstance() {
|
|
||||||
try {
|
|
||||||
FileOutputStream fileStream = new FileOutputStream("Statistics.ser");
|
|
||||||
Serializer.storeObject(fileStream, this);
|
|
||||||
} catch (FileNotFoundException ex) {
|
|
||||||
LOGGER.log(Level.WARNING, "Could not store instance object.", ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private StatsParameter(StatsParameter Source) {
|
|
||||||
m_ConvergenceRateThreshold = Source.m_ConvergenceRateThreshold;
|
|
||||||
m_useStatPlot = Source.m_useStatPlot;
|
|
||||||
m_Textoutput = Source.m_Textoutput;
|
|
||||||
// m_Plotoutput = Source.m_Plotoutput;
|
|
||||||
// m_PlotFitness = Source.m_PlotFitness;
|
|
||||||
m_MultiRuns = Source.m_MultiRuns;
|
|
||||||
m_ResultFilePrefix = Source.m_ResultFilePrefix;
|
|
||||||
verboK = Source.verboK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public Object getClone() {
|
|
||||||
return new StatsParameter(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public String getName() {
|
|
||||||
return m_Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String globalInfo() {
|
|
||||||
return "Configure statistics and output of the optimization run. Changes to the data selection state will not take effect during a run.";
|
|
||||||
}
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// *
|
|
||||||
// */
|
|
||||||
// public String plotFrequencyTipText() {
|
|
||||||
// return "Frequency how often the fitness plot gets an update. plotoutput=1 -> there is a output every generation. plotoutput<0 -> there is no plot output";
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// *
|
|
||||||
// */
|
|
||||||
// public String printMeanTipText() {
|
|
||||||
// return "Prints the mean of the fitness plot. Makes only sense when multiRuns > 1;";
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void setMultiRuns(int x) {
|
|
||||||
m_MultiRuns = x;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public int getMultiRuns() {
|
|
||||||
return m_MultiRuns;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public String multiRunsTipText() {
|
|
||||||
return "Number of independent optimization runs to evaluate.";
|
|
||||||
}
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// *
|
|
||||||
// */
|
|
||||||
// public String GetInfoString() {
|
|
||||||
// return m_InfoString;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// *
|
|
||||||
// */
|
|
||||||
// public void setInfoString(String s) {
|
|
||||||
// m_InfoString = s;
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public String infoStringTipText() {
|
|
||||||
return "Infostring displayed on fitness graph by prssing the right mouse button.";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use averaged graph for multi-run plots or not
|
|
||||||
*/
|
|
||||||
public boolean GetUseStatPlot() {
|
|
||||||
return m_useStatPlot;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Activate or deactivate averaged graph for multi-run plots
|
|
||||||
*/
|
|
||||||
public void setUseStatPlot(boolean x) {
|
|
||||||
m_useStatPlot = x;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String useStatPlotTipText() {
|
|
||||||
return "Plotting each fitness graph separately if multiruns > 1.";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void SetResultFilePrefix(String x) {
|
|
||||||
if (x==null) m_ResultFilePrefix = "";
|
|
||||||
else m_ResultFilePrefix = x;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public String getResultFilePrefix() {
|
|
||||||
return m_ResultFilePrefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetShowTextOutput(boolean show) {
|
|
||||||
// activate if not activated
|
|
||||||
if (show && outputTo.getSelectedTagID() == 0) outputTo.setSelectedTag(2);
|
|
||||||
// deactivate if activated
|
|
||||||
else if (!show && outputTo.getSelectedTagID()>0) outputTo.setSelectedTag(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isShowTextOutput() {
|
|
||||||
return outputTo.getSelectedTagID()>0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// *
|
|
||||||
// */
|
|
||||||
// public String resultFileNameTipText() {
|
|
||||||
// return "File name for the result file. If empty or 'none', no output file will be created.";
|
|
||||||
// }
|
|
||||||
|
|
||||||
public String convergenceRateThresholdTipText() {
|
|
||||||
return "Provided the optimal fitness is at zero, give the threshold below which it is considered as 'reached'";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param x
|
|
||||||
*/
|
|
||||||
public void setConvergenceRateThreshold(double x) {
|
|
||||||
m_ConvergenceRateThreshold = x;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public double getConvergenceRateThreshold() {
|
|
||||||
return m_ConvergenceRateThreshold;
|
|
||||||
}
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * @return the showOutputData
|
|
||||||
// */
|
|
||||||
// public boolean isShowTextOutput() {
|
|
||||||
// return showTextOutput;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// *
|
|
||||||
// * @param showOutputData the showOutputData to set
|
|
||||||
// */
|
|
||||||
// public void setShowTextOutput(boolean bShow) {
|
|
||||||
// this.showTextOutput = bShow;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public String showTextOutputTipText() {
|
|
||||||
// return "Indicates whether further text output should be printed";
|
|
||||||
// }
|
|
||||||
|
|
||||||
public boolean isOutputAllFieldsAsText() {
|
|
||||||
return showAdditionalProblemInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOutputAllFieldsAsText(boolean bShowFullText) {
|
|
||||||
showAdditionalProblemInfo = bShowFullText;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String outputAllFieldsAsTextTipText() {
|
|
||||||
return "Output all available data fields or only the selected entries as text.";
|
|
||||||
}
|
|
||||||
|
|
||||||
public void hideHideable() {
|
|
||||||
setOutputVerbosity(getOutputVerbosity());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOutputVerbosity(SelectedTag sTag) {
|
|
||||||
outputVerbosity = sTag;
|
|
||||||
GenericObjectEditor.setHideProperty(this.getClass(), "outputVerbosityK", sTag.getSelectedTagID() != VERBOSITY_KTH_IT);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOutputVerbosity(int i) {
|
|
||||||
outputVerbosity.setSelectedTag(i);
|
|
||||||
GenericObjectEditor.setHideProperty(this.getClass(), "outputVerbosityK", outputVerbosity.getSelectedTagID() != VERBOSITY_KTH_IT);
|
|
||||||
}
|
|
||||||
|
|
||||||
public SelectedTag getOutputVerbosity() {
|
|
||||||
return outputVerbosity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String outputVerbosityTipText() {
|
|
||||||
return "Set the data output level.";
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getOutputVerbosityK() {
|
|
||||||
return verboK;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOutputVerbosityK(int k) {
|
|
||||||
verboK = k;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String outputVerbosityKTipText() {
|
|
||||||
return "Set the interval of data output for intermediate verbosity (in generations).";
|
|
||||||
}
|
|
||||||
|
|
||||||
public SelectedTag getOutputTo() {
|
|
||||||
return outputTo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOutputTo(SelectedTag tag) {
|
|
||||||
outputTo = tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOutputTo(int i) {
|
|
||||||
outputTo.setSelectedTag(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String outputToTipText() {
|
|
||||||
return "Set the output destination; to deactivate output, set verbosity to none.";
|
|
||||||
}
|
|
||||||
|
|
||||||
public StringSelection getFieldSelection() {
|
|
||||||
return graphSel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFieldSelection(StringSelection v) {
|
|
||||||
graphSel = v;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String fieldSelectionTipText() {
|
|
||||||
return "Select the data fields to be collected and plotted. Note that only simple types can be plotted to the GUI.";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* May be called to dynamically alter the set of graphs that can be selected,
|
|
||||||
* using a list of informer instances, which usually are the problem and the
|
|
||||||
* optimizer instance.
|
|
||||||
*
|
|
||||||
* @see InterfaceAdditionalPopulationInformer
|
|
||||||
*/
|
|
||||||
public void setInformers(
|
|
||||||
List<InterfaceAdditionalPopulationInformer> informers) {
|
|
||||||
ArrayList<String> headerFields = new ArrayList<String>();
|
|
||||||
ArrayList<String> infoFields = new ArrayList<String>();
|
|
||||||
// parse list of header elements, show additional Strings according to names.
|
|
||||||
for (InterfaceAdditionalPopulationInformer inf : informers) {
|
|
||||||
String[] dataHeader = inf.getAdditionalDataHeader();
|
|
||||||
headerFields.addAll(Arrays.asList(dataHeader));
|
|
||||||
if (infoFields.size()<headerFields.size()) { // add info strings for tool tips - fill up with null if none have been returned.
|
|
||||||
String[] infos = inf.getAdditionalDataInfo();
|
|
||||||
if (infos!=null) {
|
|
||||||
if (infos.length!=dataHeader.length) {
|
|
||||||
System.out.println(BeanInspector.toString(infos));
|
|
||||||
System.out.println(BeanInspector.toString(dataHeader));
|
|
||||||
EVAERROR.errorMsgOnce("Warning, mismatching number of headers and additional data fields for " + inf.getClass() + " ("+dataHeader.length+ " vs. " + infos.length + ").");
|
|
||||||
}
|
|
||||||
infoFields.addAll(Arrays.asList(infos));
|
|
||||||
}
|
|
||||||
while (infoFields.size()<headerFields.size()) infoFields.add(null);
|
|
||||||
}
|
|
||||||
// header += inf.getAdditionalDataHeader(null); // lets hope this works with a null
|
|
||||||
}
|
|
||||||
// create additional fields to be selectable by the user, defined by the informer headers
|
|
||||||
// StringSelection ss = new StringSelection(GraphSelectionEnum.getAndAppendArray(headerFields.toArray(new String[headerFields.size()])));
|
|
||||||
StringSelection ss = new StringSelection(GraphSelectionEnum.currentBest, GraphSelectionEnum.getInfoStrings(),
|
|
||||||
headerFields, infoFields.toArray(new String[infoFields.size()]));
|
|
||||||
ss.takeOverSelection(graphSel);
|
|
||||||
// System.out.println("In " + this + ": setting new informers: " + BeanInspector.toString(ss.getStrings()));
|
|
||||||
// This works!
|
|
||||||
setFieldSelection(ss);
|
|
||||||
// System.out.println("After: " + this);
|
|
||||||
}
|
|
||||||
}
|
|
@ -18,6 +18,7 @@ import eva2.gui.BeanInspector;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class StringSelection implements Serializable {
|
public class StringSelection implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -1512329288445831907L;
|
private static final long serialVersionUID = -1512329288445831907L;
|
||||||
private String[] strObjects;
|
private String[] strObjects;
|
||||||
private String[] toolTips;
|
private String[] toolTips;
|
||||||
@ -26,7 +27,8 @@ public class StringSelection implements Serializable {
|
|||||||
private transient Class<? extends Enum> enumClass = null;
|
private transient Class<? extends Enum> enumClass = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor with a String array of selectable strings and optional descriptions.
|
* Constructor with a String array of selectable strings and optional
|
||||||
|
* descriptions.
|
||||||
*
|
*
|
||||||
* @param sArr a String array of selectable strings
|
* @param sArr a String array of selectable strings
|
||||||
* @param tips descriptive strings of same length or null
|
* @param tips descriptive strings of same length or null
|
||||||
@ -40,8 +42,9 @@ public class StringSelection implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor with a String array of selectable strings and optional descriptions.
|
* Constructor with a String array of selectable strings and optional
|
||||||
* A single element is preselected by index, all others deselected.
|
* descriptions. A single element is preselected by index, all others
|
||||||
|
* deselected.
|
||||||
*
|
*
|
||||||
* @param sArr a String array of selectable strings
|
* @param sArr a String array of selectable strings
|
||||||
* @param tips descriptive strings of same length or null
|
* @param tips descriptive strings of same length or null
|
||||||
@ -49,7 +52,9 @@ public class StringSelection implements Serializable {
|
|||||||
*/
|
*/
|
||||||
public StringSelection(String[] sArr, String[] tips, int initialSel) {
|
public StringSelection(String[] sArr, String[] tips, int initialSel) {
|
||||||
this(sArr, tips);
|
this(sArr, tips);
|
||||||
if (initialSel<getLength()) setSelected(initialSel, true);
|
if (initialSel < getLength()) {
|
||||||
|
setSelected(initialSel, true);
|
||||||
|
}
|
||||||
enumClass = null;
|
enumClass = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,8 +90,9 @@ public class StringSelection implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a string selection that allows all enum fields of the given type plus a list of additional
|
* Construct a string selection that allows all enum fields of the given
|
||||||
* strings to be selected. The enum fields will be first in the selection list.
|
* type plus a list of additional strings to be selected. The enum fields
|
||||||
|
* will be first in the selection list.
|
||||||
*
|
*
|
||||||
* @param e
|
* @param e
|
||||||
* @param headerFields
|
* @param headerFields
|
||||||
@ -117,8 +123,11 @@ public class StringSelection implements Serializable {
|
|||||||
* @return a descriptive String for element i or null
|
* @return a descriptive String for element i or null
|
||||||
*/
|
*/
|
||||||
public String getElementInfo(int i) {
|
public String getElementInfo(int i) {
|
||||||
if (toolTips!=null && (toolTips.length>i)) return toolTips[i];
|
if (toolTips != null && (toolTips.length > i)) {
|
||||||
else return null;
|
return toolTips[i];
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -157,8 +166,9 @@ public class StringSelection implements Serializable {
|
|||||||
// return e.toString().equals(strObjects[e.ordinal()]);
|
// return e.toString().equals(strObjects[e.ordinal()]);
|
||||||
// } else return false;
|
// } else return false;
|
||||||
if (enumClass != null) {
|
if (enumClass != null) {
|
||||||
if (e.getClass().equals(enumClass)) return isSelected(e.ordinal());
|
if (e.getClass().equals(enumClass)) {
|
||||||
else {
|
return isSelected(e.ordinal());
|
||||||
|
} else {
|
||||||
System.err.println("Error, the string selection was constructed with a different enum class - invalid request (StringSelection.isSelected(Enum)");
|
System.err.println("Error, the string selection was constructed with a different enum class - invalid request (StringSelection.isSelected(Enum)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -169,8 +179,8 @@ public class StringSelection implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a given string is selected within this instance. If the
|
* Check if a given string is selected within this instance. If the String
|
||||||
* String is not found, false is returned.
|
* is not found, false is returned.
|
||||||
*
|
*
|
||||||
* @param str
|
* @param str
|
||||||
* @return
|
* @return
|
||||||
@ -186,7 +196,8 @@ public class StringSelection implements Serializable {
|
|||||||
if (selIndex == null) {
|
if (selIndex == null) {
|
||||||
System.err.println("Error, unknown string for StringSelection: " + str + ", selectable were " + BeanInspector.toString(getStrings()));
|
System.err.println("Error, unknown string for StringSelection: " + str + ", selectable were " + BeanInspector.toString(getStrings()));
|
||||||
return false;
|
return false;
|
||||||
} return isSelected(selIndex);
|
}
|
||||||
|
return isSelected(selIndex);
|
||||||
// for (int i=0; i<strObjects.length; i++) {
|
// for (int i=0; i<strObjects.length; i++) {
|
||||||
// if (strObjects[i].equals(str)) return isSelected(i);
|
// if (strObjects[i].equals(str)) return isSelected(i);
|
||||||
// }
|
// }
|
||||||
@ -194,8 +205,8 @@ public class StringSelection implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the ordinal of the given String within the StringSelection. If
|
* Return the ordinal of the given String within the StringSelection. If the
|
||||||
* the string could not be found, -1 is returned.
|
* string could not be found, -1 is returned.
|
||||||
*
|
*
|
||||||
* @param str
|
* @param str
|
||||||
* @return
|
* @return
|
||||||
@ -208,8 +219,11 @@ public class StringSelection implements Serializable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Integer selIndex = stringToIndexHash.get(str);
|
Integer selIndex = stringToIndexHash.get(str);
|
||||||
if (selIndex==null) return -1;
|
if (selIndex == null) {
|
||||||
else return selIndex.intValue();
|
return -1;
|
||||||
|
} else {
|
||||||
|
return selIndex.intValue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -225,7 +239,7 @@ public class StringSelection implements Serializable {
|
|||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
setSelected(index, v);
|
setSelected(index, v);
|
||||||
} else {
|
} else {
|
||||||
System.err.println("Error, unknown string " + str + " cant be selected in " + this.getClass());
|
System.err.println("Error, unknown string " + str + " can't be selected in " + this.getClass());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,8 +263,8 @@ public class StringSelection implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply the selection state of the given instance to this instance. Compares
|
* Apply the selection state of the given instance to this instance.
|
||||||
* Strings and takes over the selection state if they are equal.
|
* Compares Strings and takes over the selection state if they are equal.
|
||||||
*
|
*
|
||||||
* @param sel
|
* @param sel
|
||||||
*/
|
*/
|
||||||
@ -289,30 +303,42 @@ public class StringSelection implements Serializable {
|
|||||||
*/
|
*/
|
||||||
public String[] getSelected() {
|
public String[] getSelected() {
|
||||||
ArrayList<String> ret = new ArrayList<String>();
|
ArrayList<String> ret = new ArrayList<String>();
|
||||||
for (int i=0; i<getLength(); i++) if (isSelected(i)) ret.add(getElement(i));
|
for (int i = 0; i < getLength(); i++) {
|
||||||
|
if (isSelected(i)) {
|
||||||
|
ret.add(getElement(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
return ret.toArray(new String[ret.size()]);
|
return ret.toArray(new String[ret.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a sub-list of the selected items paired up with the respective index.
|
* Return a sub-list of the selected items paired up with the respective
|
||||||
|
* index.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<Pair<String, Integer>> getSelectedWithIndex() {
|
public List<Pair<String, Integer>> getSelectedWithIndex() {
|
||||||
ArrayList<Pair<String, Integer>> ret = new ArrayList<Pair<String, Integer>>();
|
ArrayList<Pair<String, Integer>> ret = new ArrayList<Pair<String, Integer>>();
|
||||||
for (int i=0; i<getLength(); i++) if (isSelected(i)) ret.add(new Pair<String,Integer>(getElement(i), i));
|
for (int i = 0; i < getLength(); i++) {
|
||||||
|
if (isSelected(i)) {
|
||||||
|
ret.add(new Pair<String, Integer>(getElement(i), i));
|
||||||
|
}
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return only those selected fields which are members of the given enum.
|
* Return only those selected fields which are members of the given enum.
|
||||||
|
*
|
||||||
* @param e
|
* @param e
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Enum[] getSelectedEnum(Enum[] e) {
|
public Enum[] getSelectedEnum(Enum[] e) {
|
||||||
LinkedList<Integer> selectedList = new LinkedList<Integer>();
|
LinkedList<Integer> selectedList = new LinkedList<Integer>();
|
||||||
for (int i = 0; i < e.length; i++) {
|
for (int i = 0; i < e.length; i++) {
|
||||||
if (isSelected(e[i])) selectedList.add(i);
|
if (isSelected(e[i])) {
|
||||||
|
selectedList.add(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Enum[] ret = (Enum[]) java.lang.reflect.Array.newInstance(e[0].getClass(), selectedList.size());
|
Enum[] ret = (Enum[]) java.lang.reflect.Array.newInstance(e[0].getClass(), selectedList.size());
|
||||||
Iterator<Integer> iter = selectedList.iterator();
|
Iterator<Integer> iter = selectedList.iterator();
|
||||||
|
@ -786,7 +786,7 @@ public class DArea extends JComponent implements DParent, Printable {
|
|||||||
System.out.println("DArea.setVisibleRectangle(DRectangle)");
|
System.out.println("DArea.setVisibleRectangle(DRectangle)");
|
||||||
if (rect.isEmpty())
|
if (rect.isEmpty())
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"You shopuld never try to set an empty rectangle\n"
|
"You should never try to set an empty rectangle\n"
|
||||||
+ "as the visible rectangle of an DArea");
|
+ "as the visible rectangle of an DArea");
|
||||||
|
|
||||||
if (!rect.equals(visible_rect) && rect.getWidth() > 0
|
if (!rect.equals(visible_rect) && rect.getWidth() > 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user