Cleanup m_ variables in eva2.tools

This commit is contained in:
Fabian Becker 2014-01-28 16:55:01 +01:00
parent b24dbac6a1
commit 00253c273a
18 changed files with 180 additions and 235 deletions

View File

@ -96,8 +96,8 @@ public class ClusteringKMeans implements InterfaceClustering, java.io.Serializab
this.m_C[i] = initialSeeds.getEAIndividual(i).getFitness().clone(); this.m_C[i] = initialSeeds.getEAIndividual(i).getFitness().clone();
} }
// this.m_C[i] = data[RNG.randomInt(0, data.length-1)]; // this.c[i] = data[RNG.randomInt(0, data.length-1)];
//this.m_C[i] = data[i]; // This works!! //this.c[i] = data[i]; // This works!!
// we won't check for double instances assuming that double instances // we won't check for double instances assuming that double instances
// will be ironed out during clustering and to prevent infinite loops // will be ironed out during clustering and to prevent infinite loops
// in case there are too many double instances or too few instances // in case there are too many double instances or too few instances
@ -269,7 +269,7 @@ public class ClusteringKMeans implements InterfaceClustering, java.io.Serializab
} }
/** /**
* This method allows you to cluster a population using m_C. The minimal cluster * This method allows you to cluster a population using c. The minimal cluster
* size is _not_ regarded here. * size is _not_ regarded here.
* *
* @param pop The population * @param pop The population

View File

@ -278,7 +278,7 @@ public class ClusteringXMeans implements InterfaceClustering, java.io.Serializab
} }
/** /**
* This mehtod allows you to cluster a population using m_C * This mehtod allows you to cluster a population using c
* *
* @param pop The population * @param pop The population
* @param c The centroids * @param c The centroids

View File

@ -226,7 +226,7 @@ public class MutateESCovarianceMatrixAdaption implements InterfaceMutation, java
for (int i = 0; i < this.m_D; i++) { for (int i = 0; i < this.m_D; i++) {
this.s_N[i] = (1.0 - this.m_c) * this.s_N[i] + this.m_c * this.cu * this.Bz[i]; this.s_N[i] = (1.0 - this.m_c) * this.s_N[i] + this.m_c * this.cu * this.Bz[i];
} }
// System.out.println("C bef:\n" + m_C.toString()); // System.out.println("C bef:\n" + c.toString());
// ADAPT COVARIANCE // ADAPT COVARIANCE
for (int i = 0; i < this.m_D; i++) { for (int i = 0; i < this.m_D; i++) {
for (int j = i; j < this.m_D; j++) { for (int j = i; j < this.m_D; j++) {
@ -235,7 +235,7 @@ public class MutateESCovarianceMatrixAdaption implements InterfaceMutation, java
this.m_C.set(j, i, Cij); this.m_C.set(j, i, Cij);
} }
} }
// System.out.println("C aft:\n" + m_C.toString()); // System.out.println("C aft:\n" + c.toString());
// ADAPT GLOBAL STEPSIZE // ADAPT GLOBAL STEPSIZE
for (int i = 0; i < this.m_D; i++) { for (int i = 0; i < this.m_D; i++) {
Bz_d = 0.0; Bz_d = 0.0;
@ -250,12 +250,12 @@ public class MutateESCovarianceMatrixAdaption implements InterfaceMutation, java
protected void evaluateNewObjectX(double[] x, double[][] range) { protected void evaluateNewObjectX(double[] x, double[][] range) {
// if (Double.isNaN((x[0]))) System.out.println("treffer in cma "+ x[0]); // if (Double.isNaN((x[0]))) System.out.println("treffer in cma "+ x[0]);
// if (Double.isNaN((m_C.get(0,0)))) System.out.println("treffer in cma"); // if (Double.isNaN((c.get(0,0)))) System.out.println("treffer in cma");
// for (int i=0;i<N;i++) { // evaluate new random values // for (int i=0;i<N;i++) { // evaluate new random values
// m_Z[i] = RNG.gaussianDouble(1.0); // m_Z[i] = RNG.gaussianDouble(1.0);
// } // }
// m_C = (m_C.plus(m_C.transpose()).times(0.5)); // MAKE C SYMMETRIC // c = (c.plus(c.transpose()).times(0.5)); // MAKE C SYMMETRIC
// EigenvalueDecomposition helper = new EigenvalueDecomposition(m_C); // EigenvalueDecomposition helper = new EigenvalueDecomposition(c);
// B = helper.getV(); // B = helper.getV();
// double [] Eigenvalues = helper.getRealEigenvalues(); // double [] Eigenvalues = helper.getRealEigenvalues();
// double[] tmpD = new double[x.length]; // double[] tmpD = new double[x.length];

View File

@ -314,7 +314,7 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
public Object getSensorValue(String sensor) { public Object getSensorValue(String sensor) {
return PSymbolicRegression.getSensorValue(sensor, m_X, m_C); return PSymbolicRegression.getSensorValue(sensor, m_X, m_C);
// for (int i = 0; i < this.m_X.length; i++) if (sensor.equalsIgnoreCase("X"+i)) return new Double(this.m_X[i]); // for (int i = 0; i < this.m_X.length; i++) if (sensor.equalsIgnoreCase("X"+i)) return new Double(this.m_X[i]);
// for (int i = 0; i < this.m_C.length; i++) if (sensor.equalsIgnoreCase("C"+i)) return new Double(this.m_C[i]); // for (int i = 0; i < this.c.length; i++) if (sensor.equalsIgnoreCase("C"+i)) return new Double(this.c[i]);
// return new Double(0); // return new Double(0);
} }
@ -351,7 +351,7 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
return new Double(0); return new Double(0);
} }
// for (int i = 0; i < this.m_X.length; i++) if (sensor.equalsIgnoreCase("X"+i)) return new Double(this.m_X[i]); // for (int i = 0; i < this.m_X.length; i++) if (sensor.equalsIgnoreCase("X"+i)) return new Double(this.m_X[i]);
// for (int i = 0; i < this.m_C.length; i++) if (sensor.equalsIgnoreCase("C"+i)) return new Double(this.m_C[i]); // for (int i = 0; i < this.c.length; i++) if (sensor.equalsIgnoreCase("C"+i)) return new Double(this.c[i]);
// return new Double(0); // return new Double(0);
} }

View File

@ -7,15 +7,15 @@ public class Cluster {
/** /**
* Number of samples in the cluster. * Number of samples in the cluster.
*/ */
public int m_SamplesInCluster; public int samplesInCluster;
/** /**
* Center of the cluster. * Center of the cluster.
*/ */
public double[] m_Center; public double[] center;
/** /**
* nearest sample (double[]) to the center of the cluster. * nearest sample (double[]) to the center of the cluster.
*/ */
public double[] m_NearestSample; public double[] nearestSample;
/** /**
* This class represents a cluster of * This class represents a cluster of
@ -26,8 +26,8 @@ public class Cluster {
* @param nearestSample Nearest sample to cluster center. * @param nearestSample Nearest sample to cluster center.
*/ */
public Cluster(double[] center, int SamplesInCluster, double[] nearestSample) { public Cluster(double[] center, int SamplesInCluster, double[] nearestSample) {
m_SamplesInCluster = SamplesInCluster; samplesInCluster = SamplesInCluster;
m_Center = center; this.center = center;
m_NearestSample = nearestSample; this.nearestSample = nearestSample;
} }
} }

View File

@ -1,14 +1,4 @@
package eva2.tools; package eva2.tools;
/**
* Title: EvA2
* Description:
* Copyright: Copyright (c) 2003
* Company: University of Tuebingen, Computer Architecture
* @author Holger Ulmer, Felix Streichert, Hannes Planatscher
* @version: $Revision: 255 $
* $Date: 2007-11-15 14:58:12 +0100 (Thu, 15 Nov 2007) $
* $Author: mkron $
*/
import java.io.*; import java.io.*;
import java.net.InetAddress; import java.net.InetAddress;
@ -20,7 +10,7 @@ import java.util.Properties;
*/ */
public class EVAHELP { public class EVAHELP {
private static long m_TimeStamp; private static long timestamp;
/** /**
* *
@ -58,14 +48,14 @@ public class EVAHELP {
* *
*/ */
public static void setTimeStamp() { public static void setTimeStamp() {
m_TimeStamp = System.currentTimeMillis(); timestamp = System.currentTimeMillis();
} }
/** /**
* *
*/ */
public static long getTimeStamp() { public static long getTimeStamp() {
return System.currentTimeMillis() - m_TimeStamp; return System.currentTimeMillis() - timestamp;
} }
/** /**

View File

@ -1,17 +1,4 @@
package eva2.tools; package eva2.tools;
/**
* Title: EvA2
* Description:
* Copyright: Copyright (c) 2003
* Company: University of Tuebingen, Computer Architecture
* @author Holger Ulmer, Felix Streichert, Hannes Planatscher
* @version: $Revision: 10 $
* $Date: 2006-01-18 11:02:22 +0100 (Wed, 18 Jan 2006) $
* $Author: streiche $
*/
/*==========================================================================*
* IMPORTS
*==========================================================================*/
import eva2.tools.math.RNG; import eva2.tools.math.RNG;
@ -22,21 +9,21 @@ import java.util.Comparator;
*/ */
public class KMEANSJAVA { public class KMEANSJAVA {
static public boolean TRACE = false; static public boolean TRACE = false;
protected double[][] m_C; protected double[][] c;
protected int[] m_IDX; protected int[] indices;
/** /**
* *
*/ */
public double[][] getC() { public double[][] getC() {
return m_C; return c;
} }
/** /**
* *
*/ */
public int[] getIDX() { public int[] getIDX() {
return m_IDX; return indices;
} }
/** /**
@ -62,34 +49,34 @@ public class KMEANSJAVA {
K = samples.length; K = samples.length;
} }
int counter = 0; int counter = 0;
m_C = new double[K][]; c = new double[K][];
for (int i = 0; i < K; i++) { for (int i = 0; i < K; i++) {
m_C[i] = (double[]) samples[i].clone(); c[i] = (double[]) samples[i].clone();
} }
m_IDX = new int[samples.length]; indices = new int[samples.length];
while (counter++ < iterations) { while (counter++ < iterations) {
// determine m_IDX start // determine indices start
for (int i = 0; i < m_IDX.length; i++) { for (int i = 0; i < indices.length; i++) {
int index_nc = 0; // index of nearest cluster int index_nc = 0; // index of nearest cluster
double mindist = 999999999; double mindist = 999999999;
for (int j = 0; j < m_C.length; j++) { for (int j = 0; j < c.length; j++) {
if (mindist > dist(samples[i], m_C[j])) { if (mindist > dist(samples[i], c[j])) {
mindist = dist(samples[i], m_C[j]); mindist = dist(samples[i], c[j]);
index_nc = j; index_nc = j;
} }
} }
m_IDX[i] = index_nc; indices[i] = index_nc;
} }
// determine m_IDX end ! // determine indices end !
// determine the new centers // determine the new centers
for (int indexofc = 0; indexofc < m_C.length; indexofc++) { for (int indexofc = 0; indexofc < c.length; indexofc++) {
double[] newcenter = new double[samples[0].length]; double[] newcenter = new double[samples[0].length];
int treffer = 0; int treffer = 0;
for (int j = 0; j < m_IDX.length; j++) { //System.out.println("j="+j); for (int j = 0; j < indices.length; j++) { //System.out.println("j="+j);
if (m_IDX[j] == indexofc) { if (indices[j] == indexofc) {
treffer++; treffer++;
for (int d = 0; d < newcenter.length; d++) { for (int d = 0; d < newcenter.length; d++) {
newcenter[d] += m_C[m_IDX[j]][d]; newcenter[d] += c[indices[j]][d];
//newcenter[d] = newcenter[d] + samples[j][d]; //newcenter[d] = newcenter[d] + samples[j][d];
} }
} }
@ -97,7 +84,7 @@ public class KMEANSJAVA {
for (int d = 0; d < newcenter.length; d++) { for (int d = 0; d < newcenter.length; d++) {
newcenter[d] /= treffer; newcenter[d] /= treffer;
} }
m_C[indexofc] = newcenter; c[indexofc] = newcenter;
} }
// determine the new centers // determine the new centers
} }
@ -152,8 +139,8 @@ class ClusterComp implements Comparator {
*/ */
@Override @Override
public int compare(Object p1, Object p2) { public int compare(Object p1, Object p2) {
int x1 = ((Cluster) p1).m_SamplesInCluster; int x1 = ((Cluster) p1).samplesInCluster;
int x2 = ((Cluster) p2).m_SamplesInCluster; int x2 = ((Cluster) p2).samplesInCluster;
if (x1 > x2) { if (x1 > x2) {
return -1; return -1;
} }

View File

@ -35,7 +35,7 @@ public class MultirunRefiner {
private JButton refineJButton, exitJButton; private JButton refineJButton, exitJButton;
// private JButton confidenceJButton; // private JButton confidenceJButton;
private JTextArea inputText, outputText; private JTextArea inputText, outputText;
private JScrollPane m_SP1, m_SP2; private JScrollPane scrollPane1, scrollPane2;
private JMenuBar menuBar; private JMenuBar menuBar;
private JMenu fileMenu; private JMenu fileMenu;
private JMenuItem loadMenuItem, saveMenuItem; private JMenuItem loadMenuItem, saveMenuItem;
@ -118,10 +118,10 @@ public class MultirunRefiner {
this.myPanel.setLayout(new GridLayout(1, 2)); this.myPanel.setLayout(new GridLayout(1, 2));
this.inputText = new JTextArea(); this.inputText = new JTextArea();
this.outputText = new JTextArea(); this.outputText = new JTextArea();
this.m_SP1 = new JScrollPane(this.inputText); this.scrollPane1 = new JScrollPane(this.inputText);
this.m_SP2 = new JScrollPane(this.outputText); this.scrollPane2 = new JScrollPane(this.outputText);
this.myPanel.add(this.m_SP1); this.myPanel.add(this.scrollPane1);
this.myPanel.add(this.m_SP2); this.myPanel.add(this.scrollPane2);
this.mainFrame.getContentPane().add(this.myPanel, BorderLayout.CENTER); this.mainFrame.getContentPane().add(this.myPanel, BorderLayout.CENTER);
this.myJButtonJPanel = new JPanel(); this.myJButtonJPanel = new JPanel();
@ -203,8 +203,6 @@ public class MultirunRefiner {
* current XML document * current XML document
*/ */
private void writeFile() { private void writeFile() {
// Das hier sollte ich nicht mehr brauchen....
//this.m_Document = this.m_XMLPanel.getXML();
JFileChooser fc = new JFileChooser(); JFileChooser fc = new JFileChooser();
fc.setDialogTitle("Select destination file"); fc.setDialogTitle("Select destination file");
fc.setFileFilter(new TXTFileFilter()); fc.setFileFilter(new TXTFileFilter());

View File

@ -6,12 +6,12 @@ package eva2.tools;
*/ */
public class SelectedTag implements java.io.Serializable { public class SelectedTag implements java.io.Serializable {
protected int m_Selected; protected int selectedId;
protected Tag[] m_Tags; protected Tag[] tags;
@Override @Override
public Object clone() { public Object clone() {
SelectedTag result = new SelectedTag(this.m_Selected, this.m_Tags); SelectedTag result = new SelectedTag(this.selectedId, this.tags);
return (Object) result; return (Object) result;
} }
@ -43,31 +43,31 @@ public class SelectedTag implements java.io.Serializable {
* @param tags * @param tags
*/ */
public SelectedTag(int selID, Tag[] tags) { public SelectedTag(int selID, Tag[] tags) {
m_Tags = tags; this.tags = tags;
m_Selected = -1; selectedId = -1;
for (int i = 0; i < tags.length; i++) { for (int i = 0; i < tags.length; i++) {
if (i != tags[i].getID()) { if (i != tags[i].getID()) {
System.err.println("warning, SelectedTag with inconsistent ID, this may cause problems"); System.err.println("warning, SelectedTag with inconsistent ID, this may cause problems");
} }
if (tags[i].getID() == selID) { if (tags[i].getID() == selID) {
m_Selected = i; selectedId = i;
} }
} }
if (m_Selected == -1) { if (selectedId == -1) {
throw new IllegalArgumentException("Selected tag is not valid"); throw new IllegalArgumentException("Selected tag is not valid");
} }
} }
private void init(int selID, String[] tagStrings) { private void init(int selID, String[] tagStrings) {
m_Tags = new Tag[tagStrings.length]; tags = new Tag[tagStrings.length];
m_Selected = -1; selectedId = -1;
for (int i = 0; i < m_Tags.length; i++) { for (int i = 0; i < tags.length; i++) {
m_Tags[i] = new Tag(i, tagStrings[i]); tags[i] = new Tag(i, tagStrings[i]);
if (selID == i) { if (selID == i) {
m_Selected = i; selectedId = i;
} }
} }
if (m_Selected == -1) { if (selectedId == -1) {
throw new IllegalArgumentException("Selected tag is not valid"); throw new IllegalArgumentException("Selected tag is not valid");
} }
} }
@ -81,8 +81,8 @@ public class SelectedTag implements java.io.Serializable {
* @param i The new selected tag index * @param i The new selected tag index
*/ */
public SelectedTag setSelectedTag(int i) { public SelectedTag setSelectedTag(int i) {
if ((i >= 0) && (i < this.m_Tags.length)) { if ((i >= 0) && (i < this.tags.length)) {
this.m_Selected = i; this.selectedId = i;
} }
return this; return this;
} }
@ -95,9 +95,9 @@ public class SelectedTag implements java.io.Serializable {
* @param str The new selected tag name * @param str The new selected tag name
*/ */
public SelectedTag setSelectedTag(String str) { public SelectedTag setSelectedTag(String str) {
for (int i = 0; i < m_Tags.length; i++) { for (int i = 0; i < tags.length; i++) {
if (m_Tags[i].m_String.compareTo(str) == 0) { if (tags[i].text.compareTo(str) == 0) {
m_Selected = i; selectedId = i;
return this; return this;
} }
} }
@ -119,24 +119,24 @@ public class SelectedTag implements java.io.Serializable {
* *
*/ */
public Tag getSelectedTag() { public Tag getSelectedTag() {
return m_Tags[m_Selected]; return tags[selectedId];
} }
/** /**
* *
*/ */
public int getSelectedTagID() { public int getSelectedTagID() {
return m_Tags[m_Selected].getID(); return tags[selectedId].getID();
} }
public String getSelectedString() { public String getSelectedString() {
return m_Tags[m_Selected].getString(); return tags[selectedId].getString();
} }
public int getTagIDByString(String str) { public int getTagIDByString(String str) {
for (int i = 0; i < m_Tags.length; i++) { for (int i = 0; i < tags.length; i++) {
if (m_Tags[i].equals(str)) { if (tags[i].equals(str)) {
return m_Tags[i].getID(); return tags[i].getID();
} }
} }
return -1; return -1;
@ -157,7 +157,7 @@ public class SelectedTag implements java.io.Serializable {
* *
*/ */
public Tag[] getTags() { public Tag[] getTags() {
return m_Tags; return tags;
} }
/** /**
@ -171,8 +171,8 @@ public class SelectedTag implements java.io.Serializable {
SelectedTag s = (SelectedTag) o; SelectedTag s = (SelectedTag) o;
if ((s.getTags() == m_Tags) && if ((s.getTags() == tags) &&
(s.getSelectedTag() == m_Tags[m_Selected])) { (s.getSelectedTag() == tags[selectedId])) {
return true; return true;
} else { } else {
return false; return false;
@ -187,11 +187,11 @@ public class SelectedTag implements java.io.Serializable {
*/ */
public boolean hasSameTags(SelectedTag selT) { public boolean hasSameTags(SelectedTag selT) {
Tag[] oTags = selT.getTags(); Tag[] oTags = selT.getTags();
if (oTags.length != m_Tags.length) { if (oTags.length != tags.length) {
return false; return false;
} else { } else {
for (int i = 0; i < oTags.length; i++) { for (int i = 0; i < oTags.length; i++) {
if (oTags[i].getString().compareTo(m_Tags[i].getString()) != 0) { if (oTags[i].getString().compareTo(tags[i].getString()) != 0) {
return false; return false;
} }
} }
@ -201,23 +201,23 @@ public class SelectedTag implements java.io.Serializable {
@Override @Override
public String toString() { public String toString() {
return m_Tags[m_Selected].getString(); return tags[selectedId].getString();
// Character selSign = '*'; // Character selSign = '*';
// Character separator = '|'; // Character separator = '|';
// StringBuffer sbuf; // StringBuffer sbuf;
// if (m_Selected != 0) sbuf = new StringBuffer(m_Tags[0].getString()); // if (selectedId != 0) sbuf = new StringBuffer(tags[0].getString());
// else { // else {
// sbuf = new StringBuffer(selSign.toString()); // sbuf = new StringBuffer(selSign.toString());
// sbuf.append(m_Tags[0].getString()); // sbuf.append(tags[0].getString());
// sbuf.append(selSign); // sbuf.append(selSign);
// } // }
// for (int i=1; i<m_Tags.length; i++) { // for (int i=1; i<tags.length; i++) {
// sbuf.append(separator); // sbuf.append(separator);
// if (m_Selected == i) { // if (selectedId == i) {
// sbuf.append(selSign); // sbuf.append(selSign);
// sbuf.append(m_Tags[i].getString()); // sbuf.append(tags[i].getString());
// sbuf.append(selSign); // sbuf.append(selSign);
// } else sbuf.append(m_Tags[i].getString()); // } else sbuf.append(tags[i].getString());
// } // }
// return sbuf.toString(); // return sbuf.toString();
} }

View File

@ -15,11 +15,11 @@ public class SerializedObject implements Serializable {
/** /**
* Stores the serialized object * Stores the serialized object
*/ */
private byte[] m_Serialized; private byte[] serializedBytes;
/** /**
* True if the object has been compressed during storage * True if the object has been compressed during storage
*/ */
private boolean m_Compressed; private boolean isCompressed;
/** /**
* Serializes the supplied object into a byte array without compression. * Serializes the supplied object into a byte array without compression.
@ -41,8 +41,8 @@ public class SerializedObject implements Serializable {
* @throws Exception if the object is not Serializable. * @throws Exception if the object is not Serializable.
*/ */
public SerializedObject(Object obj, boolean compress) throws IOException { public SerializedObject(Object obj, boolean compress) throws IOException {
m_Compressed = compress; isCompressed = compress;
m_Serialized = toByteArray(obj, m_Compressed); serializedBytes = toByteArray(obj, isCompressed);
} }
/** /**
@ -77,8 +77,8 @@ public class SerializedObject implements Serializable {
*/ */
public Object getObject() throws IOException, ClassNotFoundException { public Object getObject() throws IOException, ClassNotFoundException {
// try { // try {
InputStream is = new ByteArrayInputStream(m_Serialized); InputStream is = new ByteArrayInputStream(serializedBytes);
if (m_Compressed) { if (isCompressed) {
is = new GZIPInputStream(is); is = new GZIPInputStream(is);
} }
is = new BufferedInputStream(is); is = new BufferedInputStream(is);
@ -106,13 +106,13 @@ public class SerializedObject implements Serializable {
return false; return false;
} }
// Check serialized length // Check serialized length
byte[] os = ((SerializedObject) other).m_Serialized; byte[] os = ((SerializedObject) other).serializedBytes;
if (os.length != m_Serialized.length) { if (os.length != serializedBytes.length) {
return false; return false;
} }
// Check serialized contents // Check serialized contents
for (int i = 0; i < m_Serialized.length; i++) { for (int i = 0; i < serializedBytes.length; i++) {
if (m_Serialized[i] != os[i]) { if (serializedBytes[i] != os[i]) {
return false; return false;
} }
} }
@ -126,7 +126,7 @@ public class SerializedObject implements Serializable {
*/ */
@Override @Override
public final int hashCode() { public final int hashCode() {
return m_Serialized.length; return serializedBytes.length;
} }
/** /**
@ -136,7 +136,7 @@ public class SerializedObject implements Serializable {
*/ */
@Override @Override
public String toString() { public String toString() {
return (m_Compressed ? "Compressed object: " : "Uncompressed object: ") return (isCompressed ? "Compressed object: " : "Uncompressed object: ")
+ m_Serialized.length + " bytes"; + serializedBytes.length + " bytes";
} }
} }

View File

@ -1,23 +1,11 @@
package eva2.tools; package eva2.tools;
/** /**
* Title: EvA2
* Description:
* Copyright: Copyright (c) 2003
* Company: University of Tuebingen, Computer Architecture
* *
* @author Holger Ulmer, Felix Streichert, Hannes Planatscher
* @version: $Revision: 10 $
* $Date: 2006-01-18 11:02:22 +0100 (Wed, 18 Jan 2006) $
* $Author: streiche $
*/ */
/*==========================================================================*
* IMPORTS
*==========================================================================*/
public class Tag implements java.io.Serializable { public class Tag implements java.io.Serializable {
private static final long serialVersionUID = 1L; protected int id;
protected int m_ID; protected String text;
protected String m_String;
public Tag() { public Tag() {
} }
@ -26,21 +14,21 @@ public class Tag implements java.io.Serializable {
* *
*/ */
public Tag(int ident, String str) { public Tag(int ident, String str) {
m_ID = ident; id = ident;
m_String = str; text = str;
} }
/** /**
* *
*/ */
public int getID() { public int getID() {
return m_ID; return id;
} }
/** /**
* *
*/ */
public String getString() { public String getString() {
return m_String; return text;
} }
} }

View File

@ -13,20 +13,16 @@ import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
/** /**
* Created by IntelliJ IDEA. *
* User: streiche
* Date: 08.09.2005
* Time: 10:15:30
* To change this template use File | Settings | File Templates.
*/ */
public class Chart2DDPointContentSelectable implements InterfaceDPointWithContent, InterfaceSelectablePointIcon, DPointIcon { public class Chart2DDPointContentSelectable implements InterfaceDPointWithContent, InterfaceSelectablePointIcon, DPointIcon {
AbstractEAIndividual m_Indy; AbstractEAIndividual individual;
InterfaceOptimizationProblem m_Problem; InterfaceOptimizationProblem optimizationProblem;
private InterfaceRefSolutionListener m_Listener; private InterfaceRefSolutionListener refSolutionListener;
private Color m_Border = Color.BLACK; private Color borderColor = Color.BLACK;
private Color m_Fill = null; private Color fillColor = null;
private int m_Size = 4; private int size = 4;
/** /**
* this method has to be overridden to paint the icon. The point itself lies * this method has to be overridden to paint the icon. The point itself lies
@ -35,17 +31,17 @@ public class Chart2DDPointContentSelectable implements InterfaceDPointWithConten
@Override @Override
public void paint(Graphics g) { public void paint(Graphics g) {
Color prev = g.getColor(); Color prev = g.getColor();
if (this.m_Indy.isMarked()) { if (this.individual.isMarked()) {
this.m_Fill = Color.RED; this.fillColor = Color.RED;
} else { } else {
this.m_Fill = Color.LIGHT_GRAY; this.fillColor = Color.LIGHT_GRAY;
} }
g.setColor(m_Fill); g.setColor(fillColor);
g.fillOval(-this.m_Size, -this.m_Size, 2 * this.m_Size + 1, 2 * this.m_Size + 1); g.fillOval(-this.size, -this.size, 2 * this.size + 1, 2 * this.size + 1);
if (this.m_Border != null) { if (this.borderColor != null) {
g.setColor(m_Border); g.setColor(borderColor);
} }
g.drawOval(-this.m_Size, -this.m_Size, 2 * this.m_Size, 2 * this.m_Size); g.drawOval(-this.size, -this.size, 2 * this.size, 2 * this.size);
g.setColor(prev); g.setColor(prev);
} }
@ -61,15 +57,15 @@ public class Chart2DDPointContentSelectable implements InterfaceDPointWithConten
} }
public void setBorderColor(Color c) { public void setBorderColor(Color c) {
this.m_Border = c; this.borderColor = c;
} }
public void setFillColor(Color c) { public void setFillColor(Color c) {
this.m_Fill = c; this.fillColor = c;
} }
public void setSize(int d) { public void setSize(int d) {
this.m_Size = d; this.size = d;
} }
/********************************************************************************************* /*********************************************************************************************
@ -84,7 +80,7 @@ public class Chart2DDPointContentSelectable implements InterfaceDPointWithConten
*/ */
@Override @Override
public void addSelectionListener(InterfaceRefSolutionListener a) { public void addSelectionListener(InterfaceRefSolutionListener a) {
this.m_Listener = a; this.refSolutionListener = a;
} }
/** /**
@ -94,7 +90,7 @@ public class Chart2DDPointContentSelectable implements InterfaceDPointWithConten
*/ */
@Override @Override
public InterfaceRefSolutionListener getSelectionListener() { public InterfaceRefSolutionListener getSelectionListener() {
return this.m_Listener; return this.refSolutionListener;
} }
/** /**
@ -102,7 +98,7 @@ public class Chart2DDPointContentSelectable implements InterfaceDPointWithConten
*/ */
@Override @Override
public void removeSelectionListeners() { public void removeSelectionListeners() {
this.m_Listener = null; this.refSolutionListener = null;
} }
/** /**
@ -112,12 +108,12 @@ public class Chart2DDPointContentSelectable implements InterfaceDPointWithConten
*/ */
@Override @Override
public void setEAIndividual(AbstractEAIndividual indy) { public void setEAIndividual(AbstractEAIndividual indy) {
this.m_Indy = indy; this.individual = indy;
} }
@Override @Override
public AbstractEAIndividual getEAIndividual() { public AbstractEAIndividual getEAIndividual() {
return this.m_Indy; return this.individual;
} }
/** /**
@ -127,12 +123,12 @@ public class Chart2DDPointContentSelectable implements InterfaceDPointWithConten
*/ */
@Override @Override
public void setProblem(InterfaceOptimizationProblem problem) { public void setProblem(InterfaceOptimizationProblem problem) {
this.m_Problem = problem; this.optimizationProblem = problem;
} }
@Override @Override
public InterfaceOptimizationProblem getProblem() { public InterfaceOptimizationProblem getProblem() {
return this.m_Problem; return this.optimizationProblem;
} }
/** /**
@ -141,14 +137,14 @@ public class Chart2DDPointContentSelectable implements InterfaceDPointWithConten
@Override @Override
public void showIndividual() { public void showIndividual() {
JFrame newFrame = new JFrame(); JFrame newFrame = new JFrame();
newFrame.setTitle(this.m_Indy.getName() + ": " + this.m_Indy); newFrame.setTitle(this.individual.getName() + ": " + this.individual);
newFrame.addWindowListener(new WindowAdapter() { newFrame.addWindowListener(new WindowAdapter() {
@Override @Override
public void windowClosing(WindowEvent ev) { public void windowClosing(WindowEvent ev) {
System.gc(); System.gc();
} }
}); });
newFrame.getContentPane().add(this.m_Problem.drawIndividual(-1, -1, this.m_Indy)); newFrame.getContentPane().add(this.optimizationProblem.drawIndividual(-1, -1, this.individual));
newFrame.setSize(200, 300); newFrame.setSize(200, 300);
newFrame.pack(); newFrame.pack();
newFrame.validate(); newFrame.validate();

View File

@ -4,17 +4,13 @@ import java.awt.*;
/** /**
* Created by IntelliJ IDEA. *
* User: streiche
* Date: 01.04.2004
* Time: 09:55:30
* To change this template use File | Settings | File Templates.
*/ */
public class Chart2DDPointIconCircle implements DPointIcon { public class Chart2DDPointIconCircle implements DPointIcon {
private Color m_Border = Color.BLACK; private Color borderColor = Color.BLACK;
private Color m_Fill = null; private Color fillColor = null;
private int m_Size = 4; private int size = 4;
/** /**
* this method has to be overridden to paint the icon. The point itself lies * this method has to be overridden to paint the icon. The point itself lies
@ -23,14 +19,14 @@ public class Chart2DDPointIconCircle implements DPointIcon {
@Override @Override
public void paint(Graphics g) { public void paint(Graphics g) {
Color prev = g.getColor(); Color prev = g.getColor();
if (m_Fill != null) { if (fillColor != null) {
g.setColor(m_Fill); g.setColor(fillColor);
g.fillOval(-this.m_Size, -this.m_Size, 2 * this.m_Size + 1, 2 * this.m_Size + 1); g.fillOval(-this.size, -this.size, 2 * this.size + 1, 2 * this.size + 1);
} }
if (this.m_Border != null) { if (this.borderColor != null) {
g.setColor(m_Border); g.setColor(borderColor);
} }
g.drawOval(-this.m_Size, -this.m_Size, 2 * this.m_Size, 2 * this.m_Size); g.drawOval(-this.size, -this.size, 2 * this.size, 2 * this.size);
g.setColor(prev); g.setColor(prev);
} }
@ -46,15 +42,15 @@ public class Chart2DDPointIconCircle implements DPointIcon {
} }
public void setBorderColor(Color c) { public void setBorderColor(Color c) {
this.m_Border = c; this.borderColor = c;
} }
public void setFillColor(Color c) { public void setFillColor(Color c) {
this.m_Fill = c; this.fillColor = c;
} }
public void setSize(int d) { public void setSize(int d) {
this.m_Size = d; this.size = d;
} }
} }

View File

@ -19,8 +19,8 @@ import java.awt.event.WindowEvent;
*/ */
public class Chart2DDPointIconContent implements InterfaceDPointWithContent, DPointIcon { public class Chart2DDPointIconContent implements InterfaceDPointWithContent, DPointIcon {
AbstractEAIndividual m_Indy; AbstractEAIndividual individual;
InterfaceOptimizationProblem m_Problem; InterfaceOptimizationProblem optimizationProblem;
/** /**
* this method has to be overridden to paint the icon. The point itself lies * this method has to be overridden to paint the icon. The point itself lies
@ -51,12 +51,12 @@ public class Chart2DDPointIconContent implements InterfaceDPointWithContent, DPo
*/ */
@Override @Override
public void setEAIndividual(AbstractEAIndividual indy) { public void setEAIndividual(AbstractEAIndividual indy) {
this.m_Indy = indy; this.individual = indy;
} }
@Override @Override
public AbstractEAIndividual getEAIndividual() { public AbstractEAIndividual getEAIndividual() {
return this.m_Indy; return this.individual;
} }
/** /**
@ -66,12 +66,12 @@ public class Chart2DDPointIconContent implements InterfaceDPointWithContent, DPo
*/ */
@Override @Override
public void setProblem(InterfaceOptimizationProblem problem) { public void setProblem(InterfaceOptimizationProblem problem) {
this.m_Problem = problem; this.optimizationProblem = problem;
} }
@Override @Override
public InterfaceOptimizationProblem getProblem() { public InterfaceOptimizationProblem getProblem() {
return this.m_Problem; return this.optimizationProblem;
} }
/** /**
@ -80,18 +80,18 @@ public class Chart2DDPointIconContent implements InterfaceDPointWithContent, DPo
@Override @Override
public void showIndividual() { public void showIndividual() {
JFrame newFrame = new JFrame(); JFrame newFrame = new JFrame();
if (this.m_Indy == null) { if (this.individual == null) {
System.out.println("No individual!"); System.out.println("No individual!");
return; return;
} }
newFrame.setTitle(this.m_Indy.getName() + ": " + this.m_Indy); newFrame.setTitle(this.individual.getName() + ": " + this.individual);
newFrame.addWindowListener(new WindowAdapter() { newFrame.addWindowListener(new WindowAdapter() {
@Override @Override
public void windowClosing(WindowEvent ev) { public void windowClosing(WindowEvent ev) {
System.gc(); System.gc();
} }
}); });
newFrame.getContentPane().add(this.m_Problem.drawIndividual(-1, -1, this.m_Indy)); newFrame.getContentPane().add(this.optimizationProblem.drawIndividual(-1, -1, this.individual));
newFrame.setSize(200, 300); newFrame.setSize(200, 300);
newFrame.pack(); newFrame.pack();
newFrame.validate(); newFrame.validate();

View File

@ -5,15 +5,11 @@ import java.awt.*;
/** /**
* Created by IntelliJ IDEA. *
* User: streiche
* Date: 01.04.2004
* Time: 10:00:50
* To change this template use File | Settings | File Templates.
*/ */
public class Chart2DDPointIconCross implements DPointIcon { public class Chart2DDPointIconCross implements DPointIcon {
private Color m_Color; private Color color;
/** /**
* this method has to be overridden to paint the icon. The point itself lies * this method has to be overridden to paint the icon. The point itself lies
@ -22,7 +18,7 @@ public class Chart2DDPointIconCross implements DPointIcon {
@Override @Override
public void paint(Graphics g) { public void paint(Graphics g) {
Color prev = g.getColor(); Color prev = g.getColor();
g.setColor(this.m_Color); g.setColor(this.color);
g.drawLine(-1, 1, 1, -1); g.drawLine(-1, 1, 1, -1);
g.drawLine(-1, -1, 1, 1); g.drawLine(-1, -1, 1, 1);
g.setColor(prev); g.setColor(prev);
@ -40,6 +36,6 @@ public class Chart2DDPointIconCross implements DPointIcon {
} }
public void setColor(Color c) { public void setColor(Color c) {
this.m_Color = c; this.color = c;
} }
} }

View File

@ -13,9 +13,9 @@ import java.awt.*;
*/ */
public class Chart2DDPointIconPoint implements DPointIcon { public class Chart2DDPointIconPoint implements DPointIcon {
private Color m_Border = Color.BLACK; private Color borderColor = Color.BLACK;
private Color m_Fill = Color.BLACK; private Color fillColor = Color.BLACK;
private int m_Size = 2; private int size = 2;
/** /**
* this method has to be overridden to paint the icon. The point itself lies * this method has to be overridden to paint the icon. The point itself lies
@ -24,14 +24,14 @@ public class Chart2DDPointIconPoint implements DPointIcon {
@Override @Override
public void paint(Graphics g) { public void paint(Graphics g) {
Color prev = g.getColor(); Color prev = g.getColor();
if (m_Fill != null) { if (fillColor != null) {
g.setColor(m_Fill); g.setColor(fillColor);
g.fillOval(-this.m_Size, -this.m_Size, 2 * this.m_Size, 2 * this.m_Size); g.fillOval(-this.size, -this.size, 2 * this.size, 2 * this.size);
} }
if (this.m_Border != null) { if (this.borderColor != null) {
g.setColor(m_Border); g.setColor(borderColor);
} }
g.drawOval(-this.m_Size, -this.m_Size, (2 * this.m_Size) - 1, (2 * this.m_Size) - 1); g.drawOval(-this.size, -this.size, (2 * this.size) - 1, (2 * this.size) - 1);
g.setColor(prev); g.setColor(prev);
} }
@ -47,15 +47,15 @@ public class Chart2DDPointIconPoint implements DPointIcon {
} }
public void setBorderColor(Color c) { public void setBorderColor(Color c) {
this.m_Border = c; this.borderColor = c;
} }
public void setFillColor(Color c) { public void setFillColor(Color c) {
this.m_Fill = c; this.fillColor = c;
} }
public void setSize(int d) { public void setSize(int d) {
this.m_Size = d; this.size = d;
} }
} }

View File

@ -1,24 +1,18 @@
package eva2.tools.chart2d; package eva2.tools.chart2d;
import java.awt.*; import java.awt.*;
/** /**
* Created by IntelliJ IDEA. *
* User: streiche
* Date: 01.04.2004
* Time: 16:08:15
* To change this template use File | Settings | File Templates.
*/ */
public class Chart2DDPointIconText implements DPointIcon { public class Chart2DDPointIconText implements DPointIcon {
private DPointIcon m_Icon = new Chart2DDPointIconCross(); private DPointIcon icon = new Chart2DDPointIconCross();
private String m_Text = " "; private String text = " ";
private Color m_Color; private Color color;
public Chart2DDPointIconText(String s) { public Chart2DDPointIconText(String s) {
m_Text = s; text = s;
} }
/** /**
@ -27,7 +21,7 @@ public class Chart2DDPointIconText implements DPointIcon {
* @param icon The new icon * @param icon The new icon
*/ */
public void setIcon(DPointIcon icon) { public void setIcon(DPointIcon icon) {
this.m_Icon = icon; this.icon = icon;
} }
/** /**
@ -36,9 +30,9 @@ public class Chart2DDPointIconText implements DPointIcon {
*/ */
@Override @Override
public void paint(Graphics g) { public void paint(Graphics g) {
this.m_Icon.paint(g); this.icon.paint(g);
g.setColor(m_Color); g.setColor(color);
g.drawString(this.m_Text, 4, 4); g.drawString(this.text, 4, 4);
} }
/** /**
@ -58,6 +52,6 @@ public class Chart2DDPointIconText implements DPointIcon {
* @param col * @param col
*/ */
public void setColor(Color col) { public void setColor(Color col) {
m_Color = col; color = col;
} }
} }

View File

@ -127,17 +127,17 @@ package eva2.tools.matlab;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
public class JMatLink extends Thread { public class JMatLink extends Thread {
private static JMatLink m_Instance = null; private static JMatLink matlinkInstance = null;
/** /**
* *
*/ */
public static JMatLink getInstance() { public static JMatLink getInstance() {
// System.out.println("JMatLink getInstance () {"); // System.out.println("JMatLink getInstance () {");
if (m_Instance == null) { if (matlinkInstance == null) {
m_Instance = new JMatLink(); matlinkInstance = new JMatLink();
} }
return m_Instance; return matlinkInstance;
} }
// static declarations // static declarations