Cleanup m_ variables in eva2.tools
This commit is contained in:
parent
b24dbac6a1
commit
00253c273a
@ -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] = data[RNG.randomInt(0, data.length-1)];
|
||||
//this.m_C[i] = data[i]; // This works!!
|
||||
// this.c[i] = data[RNG.randomInt(0, data.length-1)];
|
||||
//this.c[i] = data[i]; // This works!!
|
||||
// we won't check for double instances assuming that double instances
|
||||
// will be ironed out during clustering and to prevent infinite loops
|
||||
// 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.
|
||||
*
|
||||
* @param pop The population
|
||||
|
@ -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 c The centroids
|
||||
|
@ -226,7 +226,7 @@ public class MutateESCovarianceMatrixAdaption implements InterfaceMutation, java
|
||||
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];
|
||||
}
|
||||
// System.out.println("C bef:\n" + m_C.toString());
|
||||
// System.out.println("C bef:\n" + c.toString());
|
||||
// ADAPT COVARIANCE
|
||||
for (int i = 0; i < this.m_D; i++) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
// System.out.println("C aft:\n" + m_C.toString());
|
||||
// System.out.println("C aft:\n" + c.toString());
|
||||
// ADAPT GLOBAL STEPSIZE
|
||||
for (int i = 0; i < this.m_D; i++) {
|
||||
Bz_d = 0.0;
|
||||
@ -250,12 +250,12 @@ public class MutateESCovarianceMatrixAdaption implements InterfaceMutation, java
|
||||
|
||||
protected void evaluateNewObjectX(double[] x, double[][] range) {
|
||||
// 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
|
||||
// m_Z[i] = RNG.gaussianDouble(1.0);
|
||||
// }
|
||||
// m_C = (m_C.plus(m_C.transpose()).times(0.5)); // MAKE C SYMMETRIC
|
||||
// EigenvalueDecomposition helper = new EigenvalueDecomposition(m_C);
|
||||
// c = (c.plus(c.transpose()).times(0.5)); // MAKE C SYMMETRIC
|
||||
// EigenvalueDecomposition helper = new EigenvalueDecomposition(c);
|
||||
// B = helper.getV();
|
||||
// double [] Eigenvalues = helper.getRealEigenvalues();
|
||||
// double[] tmpD = new double[x.length];
|
||||
|
@ -314,7 +314,7 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
|
||||
public Object getSensorValue(String sensor) {
|
||||
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_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);
|
||||
}
|
||||
|
||||
@ -351,7 +351,7 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
|
||||
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_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);
|
||||
}
|
||||
|
||||
|
@ -7,15 +7,15 @@ public class Cluster {
|
||||
/**
|
||||
* Number of samples in the cluster.
|
||||
*/
|
||||
public int m_SamplesInCluster;
|
||||
public int samplesInCluster;
|
||||
/**
|
||||
* Center of the cluster.
|
||||
*/
|
||||
public double[] m_Center;
|
||||
public double[] center;
|
||||
/**
|
||||
* nearest sample (double[]) to the center of the cluster.
|
||||
*/
|
||||
public double[] m_NearestSample;
|
||||
public double[] nearestSample;
|
||||
|
||||
/**
|
||||
* This class represents a cluster of
|
||||
@ -26,8 +26,8 @@ public class Cluster {
|
||||
* @param nearestSample Nearest sample to cluster center.
|
||||
*/
|
||||
public Cluster(double[] center, int SamplesInCluster, double[] nearestSample) {
|
||||
m_SamplesInCluster = SamplesInCluster;
|
||||
m_Center = center;
|
||||
m_NearestSample = nearestSample;
|
||||
samplesInCluster = SamplesInCluster;
|
||||
this.center = center;
|
||||
this.nearestSample = nearestSample;
|
||||
}
|
||||
}
|
@ -1,14 +1,4 @@
|
||||
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.net.InetAddress;
|
||||
@ -20,7 +10,7 @@ import java.util.Properties;
|
||||
*/
|
||||
public class EVAHELP {
|
||||
|
||||
private static long m_TimeStamp;
|
||||
private static long timestamp;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -58,14 +48,14 @@ public class EVAHELP {
|
||||
*
|
||||
*/
|
||||
public static void setTimeStamp() {
|
||||
m_TimeStamp = System.currentTimeMillis();
|
||||
timestamp = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static long getTimeStamp() {
|
||||
return System.currentTimeMillis() - m_TimeStamp;
|
||||
return System.currentTimeMillis() - timestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,17 +1,4 @@
|
||||
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;
|
||||
|
||||
@ -22,21 +9,21 @@ import java.util.Comparator;
|
||||
*/
|
||||
public class KMEANSJAVA {
|
||||
static public boolean TRACE = false;
|
||||
protected double[][] m_C;
|
||||
protected int[] m_IDX;
|
||||
protected double[][] c;
|
||||
protected int[] indices;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public double[][] getC() {
|
||||
return m_C;
|
||||
return c;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public int[] getIDX() {
|
||||
return m_IDX;
|
||||
return indices;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -62,34 +49,34 @@ public class KMEANSJAVA {
|
||||
K = samples.length;
|
||||
}
|
||||
int counter = 0;
|
||||
m_C = new double[K][];
|
||||
c = new double[K][];
|
||||
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) {
|
||||
// determine m_IDX start
|
||||
for (int i = 0; i < m_IDX.length; i++) {
|
||||
// determine indices start
|
||||
for (int i = 0; i < indices.length; i++) {
|
||||
int index_nc = 0; // index of nearest cluster
|
||||
double mindist = 999999999;
|
||||
for (int j = 0; j < m_C.length; j++) {
|
||||
if (mindist > dist(samples[i], m_C[j])) {
|
||||
mindist = dist(samples[i], m_C[j]);
|
||||
for (int j = 0; j < c.length; j++) {
|
||||
if (mindist > dist(samples[i], c[j])) {
|
||||
mindist = dist(samples[i], c[j]);
|
||||
index_nc = j;
|
||||
}
|
||||
}
|
||||
m_IDX[i] = index_nc;
|
||||
indices[i] = index_nc;
|
||||
}
|
||||
// determine m_IDX end !
|
||||
// determine indices end !
|
||||
// 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];
|
||||
int treffer = 0;
|
||||
for (int j = 0; j < m_IDX.length; j++) { //System.out.println("j="+j);
|
||||
if (m_IDX[j] == indexofc) {
|
||||
for (int j = 0; j < indices.length; j++) { //System.out.println("j="+j);
|
||||
if (indices[j] == indexofc) {
|
||||
treffer++;
|
||||
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];
|
||||
}
|
||||
}
|
||||
@ -97,7 +84,7 @@ public class KMEANSJAVA {
|
||||
for (int d = 0; d < newcenter.length; d++) {
|
||||
newcenter[d] /= treffer;
|
||||
}
|
||||
m_C[indexofc] = newcenter;
|
||||
c[indexofc] = newcenter;
|
||||
}
|
||||
// determine the new centers
|
||||
}
|
||||
@ -152,8 +139,8 @@ class ClusterComp implements Comparator {
|
||||
*/
|
||||
@Override
|
||||
public int compare(Object p1, Object p2) {
|
||||
int x1 = ((Cluster) p1).m_SamplesInCluster;
|
||||
int x2 = ((Cluster) p2).m_SamplesInCluster;
|
||||
int x1 = ((Cluster) p1).samplesInCluster;
|
||||
int x2 = ((Cluster) p2).samplesInCluster;
|
||||
if (x1 > x2) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public class MultirunRefiner {
|
||||
private JButton refineJButton, exitJButton;
|
||||
// private JButton confidenceJButton;
|
||||
private JTextArea inputText, outputText;
|
||||
private JScrollPane m_SP1, m_SP2;
|
||||
private JScrollPane scrollPane1, scrollPane2;
|
||||
private JMenuBar menuBar;
|
||||
private JMenu fileMenu;
|
||||
private JMenuItem loadMenuItem, saveMenuItem;
|
||||
@ -118,10 +118,10 @@ public class MultirunRefiner {
|
||||
this.myPanel.setLayout(new GridLayout(1, 2));
|
||||
this.inputText = new JTextArea();
|
||||
this.outputText = new JTextArea();
|
||||
this.m_SP1 = new JScrollPane(this.inputText);
|
||||
this.m_SP2 = new JScrollPane(this.outputText);
|
||||
this.myPanel.add(this.m_SP1);
|
||||
this.myPanel.add(this.m_SP2);
|
||||
this.scrollPane1 = new JScrollPane(this.inputText);
|
||||
this.scrollPane2 = new JScrollPane(this.outputText);
|
||||
this.myPanel.add(this.scrollPane1);
|
||||
this.myPanel.add(this.scrollPane2);
|
||||
this.mainFrame.getContentPane().add(this.myPanel, BorderLayout.CENTER);
|
||||
|
||||
this.myJButtonJPanel = new JPanel();
|
||||
@ -203,8 +203,6 @@ public class MultirunRefiner {
|
||||
* current XML document
|
||||
*/
|
||||
private void writeFile() {
|
||||
// Das hier sollte ich nicht mehr brauchen....
|
||||
//this.m_Document = this.m_XMLPanel.getXML();
|
||||
JFileChooser fc = new JFileChooser();
|
||||
fc.setDialogTitle("Select destination file");
|
||||
fc.setFileFilter(new TXTFileFilter());
|
||||
|
@ -6,12 +6,12 @@ package eva2.tools;
|
||||
*/
|
||||
|
||||
public class SelectedTag implements java.io.Serializable {
|
||||
protected int m_Selected;
|
||||
protected Tag[] m_Tags;
|
||||
protected int selectedId;
|
||||
protected Tag[] tags;
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
SelectedTag result = new SelectedTag(this.m_Selected, this.m_Tags);
|
||||
SelectedTag result = new SelectedTag(this.selectedId, this.tags);
|
||||
return (Object) result;
|
||||
}
|
||||
|
||||
@ -43,31 +43,31 @@ public class SelectedTag implements java.io.Serializable {
|
||||
* @param tags
|
||||
*/
|
||||
public SelectedTag(int selID, Tag[] tags) {
|
||||
m_Tags = tags;
|
||||
m_Selected = -1;
|
||||
this.tags = tags;
|
||||
selectedId = -1;
|
||||
for (int i = 0; i < tags.length; i++) {
|
||||
if (i != tags[i].getID()) {
|
||||
System.err.println("warning, SelectedTag with inconsistent ID, this may cause problems");
|
||||
}
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
private void init(int selID, String[] tagStrings) {
|
||||
m_Tags = new Tag[tagStrings.length];
|
||||
m_Selected = -1;
|
||||
for (int i = 0; i < m_Tags.length; i++) {
|
||||
m_Tags[i] = new Tag(i, tagStrings[i]);
|
||||
tags = new Tag[tagStrings.length];
|
||||
selectedId = -1;
|
||||
for (int i = 0; i < tags.length; i++) {
|
||||
tags[i] = new Tag(i, tagStrings[i]);
|
||||
if (selID == i) {
|
||||
m_Selected = i;
|
||||
selectedId = i;
|
||||
}
|
||||
}
|
||||
if (m_Selected == -1) {
|
||||
if (selectedId == -1) {
|
||||
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
|
||||
*/
|
||||
public SelectedTag setSelectedTag(int i) {
|
||||
if ((i >= 0) && (i < this.m_Tags.length)) {
|
||||
this.m_Selected = i;
|
||||
if ((i >= 0) && (i < this.tags.length)) {
|
||||
this.selectedId = i;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@ -95,9 +95,9 @@ public class SelectedTag implements java.io.Serializable {
|
||||
* @param str The new selected tag name
|
||||
*/
|
||||
public SelectedTag setSelectedTag(String str) {
|
||||
for (int i = 0; i < m_Tags.length; i++) {
|
||||
if (m_Tags[i].m_String.compareTo(str) == 0) {
|
||||
m_Selected = i;
|
||||
for (int i = 0; i < tags.length; i++) {
|
||||
if (tags[i].text.compareTo(str) == 0) {
|
||||
selectedId = i;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@ -119,24 +119,24 @@ public class SelectedTag implements java.io.Serializable {
|
||||
*
|
||||
*/
|
||||
public Tag getSelectedTag() {
|
||||
return m_Tags[m_Selected];
|
||||
return tags[selectedId];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public int getSelectedTagID() {
|
||||
return m_Tags[m_Selected].getID();
|
||||
return tags[selectedId].getID();
|
||||
}
|
||||
|
||||
public String getSelectedString() {
|
||||
return m_Tags[m_Selected].getString();
|
||||
return tags[selectedId].getString();
|
||||
}
|
||||
|
||||
public int getTagIDByString(String str) {
|
||||
for (int i = 0; i < m_Tags.length; i++) {
|
||||
if (m_Tags[i].equals(str)) {
|
||||
return m_Tags[i].getID();
|
||||
for (int i = 0; i < tags.length; i++) {
|
||||
if (tags[i].equals(str)) {
|
||||
return tags[i].getID();
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
@ -157,7 +157,7 @@ public class SelectedTag implements java.io.Serializable {
|
||||
*
|
||||
*/
|
||||
public Tag[] getTags() {
|
||||
return m_Tags;
|
||||
return tags;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -171,8 +171,8 @@ public class SelectedTag implements java.io.Serializable {
|
||||
|
||||
SelectedTag s = (SelectedTag) o;
|
||||
|
||||
if ((s.getTags() == m_Tags) &&
|
||||
(s.getSelectedTag() == m_Tags[m_Selected])) {
|
||||
if ((s.getTags() == tags) &&
|
||||
(s.getSelectedTag() == tags[selectedId])) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@ -187,11 +187,11 @@ public class SelectedTag implements java.io.Serializable {
|
||||
*/
|
||||
public boolean hasSameTags(SelectedTag selT) {
|
||||
Tag[] oTags = selT.getTags();
|
||||
if (oTags.length != m_Tags.length) {
|
||||
if (oTags.length != tags.length) {
|
||||
return false;
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -201,23 +201,23 @@ public class SelectedTag implements java.io.Serializable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return m_Tags[m_Selected].getString();
|
||||
return tags[selectedId].getString();
|
||||
// Character selSign = '*';
|
||||
// Character separator = '|';
|
||||
// StringBuffer sbuf;
|
||||
// if (m_Selected != 0) sbuf = new StringBuffer(m_Tags[0].getString());
|
||||
// if (selectedId != 0) sbuf = new StringBuffer(tags[0].getString());
|
||||
// else {
|
||||
// sbuf = new StringBuffer(selSign.toString());
|
||||
// sbuf.append(m_Tags[0].getString());
|
||||
// sbuf.append(tags[0].getString());
|
||||
// sbuf.append(selSign);
|
||||
// }
|
||||
// for (int i=1; i<m_Tags.length; i++) {
|
||||
// for (int i=1; i<tags.length; i++) {
|
||||
// sbuf.append(separator);
|
||||
// if (m_Selected == i) {
|
||||
// if (selectedId == i) {
|
||||
// sbuf.append(selSign);
|
||||
// sbuf.append(m_Tags[i].getString());
|
||||
// sbuf.append(tags[i].getString());
|
||||
// sbuf.append(selSign);
|
||||
// } else sbuf.append(m_Tags[i].getString());
|
||||
// } else sbuf.append(tags[i].getString());
|
||||
// }
|
||||
// return sbuf.toString();
|
||||
}
|
||||
|
@ -15,11 +15,11 @@ public class SerializedObject implements Serializable {
|
||||
/**
|
||||
* Stores the serialized object
|
||||
*/
|
||||
private byte[] m_Serialized;
|
||||
private byte[] serializedBytes;
|
||||
/**
|
||||
* 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.
|
||||
@ -41,8 +41,8 @@ public class SerializedObject implements Serializable {
|
||||
* @throws Exception if the object is not Serializable.
|
||||
*/
|
||||
public SerializedObject(Object obj, boolean compress) throws IOException {
|
||||
m_Compressed = compress;
|
||||
m_Serialized = toByteArray(obj, m_Compressed);
|
||||
isCompressed = compress;
|
||||
serializedBytes = toByteArray(obj, isCompressed);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -77,8 +77,8 @@ public class SerializedObject implements Serializable {
|
||||
*/
|
||||
public Object getObject() throws IOException, ClassNotFoundException {
|
||||
// try {
|
||||
InputStream is = new ByteArrayInputStream(m_Serialized);
|
||||
if (m_Compressed) {
|
||||
InputStream is = new ByteArrayInputStream(serializedBytes);
|
||||
if (isCompressed) {
|
||||
is = new GZIPInputStream(is);
|
||||
}
|
||||
is = new BufferedInputStream(is);
|
||||
@ -106,13 +106,13 @@ public class SerializedObject implements Serializable {
|
||||
return false;
|
||||
}
|
||||
// Check serialized length
|
||||
byte[] os = ((SerializedObject) other).m_Serialized;
|
||||
if (os.length != m_Serialized.length) {
|
||||
byte[] os = ((SerializedObject) other).serializedBytes;
|
||||
if (os.length != serializedBytes.length) {
|
||||
return false;
|
||||
}
|
||||
// Check serialized contents
|
||||
for (int i = 0; i < m_Serialized.length; i++) {
|
||||
if (m_Serialized[i] != os[i]) {
|
||||
for (int i = 0; i < serializedBytes.length; i++) {
|
||||
if (serializedBytes[i] != os[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -126,7 +126,7 @@ public class SerializedObject implements Serializable {
|
||||
*/
|
||||
@Override
|
||||
public final int hashCode() {
|
||||
return m_Serialized.length;
|
||||
return serializedBytes.length;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -136,7 +136,7 @@ public class SerializedObject implements Serializable {
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return (m_Compressed ? "Compressed object: " : "Uncompressed object: ")
|
||||
+ m_Serialized.length + " bytes";
|
||||
return (isCompressed ? "Compressed object: " : "Uncompressed object: ")
|
||||
+ serializedBytes.length + " bytes";
|
||||
}
|
||||
}
|
||||
|
@ -1,23 +1,11 @@
|
||||
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 {
|
||||
private static final long serialVersionUID = 1L;
|
||||
protected int m_ID;
|
||||
protected String m_String;
|
||||
protected int id;
|
||||
protected String text;
|
||||
|
||||
public Tag() {
|
||||
}
|
||||
@ -26,21 +14,21 @@ public class Tag implements java.io.Serializable {
|
||||
*
|
||||
*/
|
||||
public Tag(int ident, String str) {
|
||||
m_ID = ident;
|
||||
m_String = str;
|
||||
id = ident;
|
||||
text = str;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public int getID() {
|
||||
return m_ID;
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public String getString() {
|
||||
return m_String;
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
@ -13,20 +13,16 @@ import java.awt.event.WindowAdapter;
|
||||
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 {
|
||||
|
||||
AbstractEAIndividual m_Indy;
|
||||
InterfaceOptimizationProblem m_Problem;
|
||||
private InterfaceRefSolutionListener m_Listener;
|
||||
private Color m_Border = Color.BLACK;
|
||||
private Color m_Fill = null;
|
||||
private int m_Size = 4;
|
||||
AbstractEAIndividual individual;
|
||||
InterfaceOptimizationProblem optimizationProblem;
|
||||
private InterfaceRefSolutionListener refSolutionListener;
|
||||
private Color borderColor = Color.BLACK;
|
||||
private Color fillColor = null;
|
||||
private int size = 4;
|
||||
|
||||
/**
|
||||
* this method has to be overridden to paint the icon. The point itself lies
|
||||
@ -35,17 +31,17 @@ public class Chart2DDPointContentSelectable implements InterfaceDPointWithConten
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
Color prev = g.getColor();
|
||||
if (this.m_Indy.isMarked()) {
|
||||
this.m_Fill = Color.RED;
|
||||
if (this.individual.isMarked()) {
|
||||
this.fillColor = Color.RED;
|
||||
} else {
|
||||
this.m_Fill = Color.LIGHT_GRAY;
|
||||
this.fillColor = Color.LIGHT_GRAY;
|
||||
}
|
||||
g.setColor(m_Fill);
|
||||
g.fillOval(-this.m_Size, -this.m_Size, 2 * this.m_Size + 1, 2 * this.m_Size + 1);
|
||||
if (this.m_Border != null) {
|
||||
g.setColor(m_Border);
|
||||
g.setColor(fillColor);
|
||||
g.fillOval(-this.size, -this.size, 2 * this.size + 1, 2 * this.size + 1);
|
||||
if (this.borderColor != null) {
|
||||
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);
|
||||
}
|
||||
|
||||
@ -61,15 +57,15 @@ public class Chart2DDPointContentSelectable implements InterfaceDPointWithConten
|
||||
}
|
||||
|
||||
public void setBorderColor(Color c) {
|
||||
this.m_Border = c;
|
||||
this.borderColor = c;
|
||||
}
|
||||
|
||||
public void setFillColor(Color c) {
|
||||
this.m_Fill = c;
|
||||
this.fillColor = c;
|
||||
}
|
||||
|
||||
public void setSize(int d) {
|
||||
this.m_Size = d;
|
||||
this.size = d;
|
||||
}
|
||||
|
||||
/*********************************************************************************************
|
||||
@ -84,7 +80,7 @@ public class Chart2DDPointContentSelectable implements InterfaceDPointWithConten
|
||||
*/
|
||||
@Override
|
||||
public void addSelectionListener(InterfaceRefSolutionListener a) {
|
||||
this.m_Listener = a;
|
||||
this.refSolutionListener = a;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -94,7 +90,7 @@ public class Chart2DDPointContentSelectable implements InterfaceDPointWithConten
|
||||
*/
|
||||
@Override
|
||||
public InterfaceRefSolutionListener getSelectionListener() {
|
||||
return this.m_Listener;
|
||||
return this.refSolutionListener;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -102,7 +98,7 @@ public class Chart2DDPointContentSelectable implements InterfaceDPointWithConten
|
||||
*/
|
||||
@Override
|
||||
public void removeSelectionListeners() {
|
||||
this.m_Listener = null;
|
||||
this.refSolutionListener = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -112,12 +108,12 @@ public class Chart2DDPointContentSelectable implements InterfaceDPointWithConten
|
||||
*/
|
||||
@Override
|
||||
public void setEAIndividual(AbstractEAIndividual indy) {
|
||||
this.m_Indy = indy;
|
||||
this.individual = indy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractEAIndividual getEAIndividual() {
|
||||
return this.m_Indy;
|
||||
return this.individual;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -127,12 +123,12 @@ public class Chart2DDPointContentSelectable implements InterfaceDPointWithConten
|
||||
*/
|
||||
@Override
|
||||
public void setProblem(InterfaceOptimizationProblem problem) {
|
||||
this.m_Problem = problem;
|
||||
this.optimizationProblem = problem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InterfaceOptimizationProblem getProblem() {
|
||||
return this.m_Problem;
|
||||
return this.optimizationProblem;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -141,14 +137,14 @@ public class Chart2DDPointContentSelectable implements InterfaceDPointWithConten
|
||||
@Override
|
||||
public void showIndividual() {
|
||||
JFrame newFrame = new JFrame();
|
||||
newFrame.setTitle(this.m_Indy.getName() + ": " + this.m_Indy);
|
||||
newFrame.setTitle(this.individual.getName() + ": " + this.individual);
|
||||
newFrame.addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(WindowEvent ev) {
|
||||
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.pack();
|
||||
newFrame.validate();
|
||||
|
@ -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 {
|
||||
|
||||
private Color m_Border = Color.BLACK;
|
||||
private Color m_Fill = null;
|
||||
private int m_Size = 4;
|
||||
private Color borderColor = Color.BLACK;
|
||||
private Color fillColor = null;
|
||||
private int size = 4;
|
||||
|
||||
/**
|
||||
* this method has to be overridden to paint the icon. The point itself lies
|
||||
@ -23,14 +19,14 @@ public class Chart2DDPointIconCircle implements DPointIcon {
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
Color prev = g.getColor();
|
||||
if (m_Fill != null) {
|
||||
g.setColor(m_Fill);
|
||||
g.fillOval(-this.m_Size, -this.m_Size, 2 * this.m_Size + 1, 2 * this.m_Size + 1);
|
||||
if (fillColor != null) {
|
||||
g.setColor(fillColor);
|
||||
g.fillOval(-this.size, -this.size, 2 * this.size + 1, 2 * this.size + 1);
|
||||
}
|
||||
if (this.m_Border != null) {
|
||||
g.setColor(m_Border);
|
||||
if (this.borderColor != null) {
|
||||
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);
|
||||
}
|
||||
|
||||
@ -46,15 +42,15 @@ public class Chart2DDPointIconCircle implements DPointIcon {
|
||||
}
|
||||
|
||||
public void setBorderColor(Color c) {
|
||||
this.m_Border = c;
|
||||
this.borderColor = c;
|
||||
}
|
||||
|
||||
public void setFillColor(Color c) {
|
||||
this.m_Fill = c;
|
||||
this.fillColor = c;
|
||||
}
|
||||
|
||||
public void setSize(int d) {
|
||||
this.m_Size = d;
|
||||
this.size = d;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,8 +19,8 @@ import java.awt.event.WindowEvent;
|
||||
*/
|
||||
public class Chart2DDPointIconContent implements InterfaceDPointWithContent, DPointIcon {
|
||||
|
||||
AbstractEAIndividual m_Indy;
|
||||
InterfaceOptimizationProblem m_Problem;
|
||||
AbstractEAIndividual individual;
|
||||
InterfaceOptimizationProblem optimizationProblem;
|
||||
|
||||
/**
|
||||
* 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
|
||||
public void setEAIndividual(AbstractEAIndividual indy) {
|
||||
this.m_Indy = indy;
|
||||
this.individual = indy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractEAIndividual getEAIndividual() {
|
||||
return this.m_Indy;
|
||||
return this.individual;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -66,12 +66,12 @@ public class Chart2DDPointIconContent implements InterfaceDPointWithContent, DPo
|
||||
*/
|
||||
@Override
|
||||
public void setProblem(InterfaceOptimizationProblem problem) {
|
||||
this.m_Problem = problem;
|
||||
this.optimizationProblem = problem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InterfaceOptimizationProblem getProblem() {
|
||||
return this.m_Problem;
|
||||
return this.optimizationProblem;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -80,18 +80,18 @@ public class Chart2DDPointIconContent implements InterfaceDPointWithContent, DPo
|
||||
@Override
|
||||
public void showIndividual() {
|
||||
JFrame newFrame = new JFrame();
|
||||
if (this.m_Indy == null) {
|
||||
if (this.individual == null) {
|
||||
System.out.println("No individual!");
|
||||
return;
|
||||
}
|
||||
newFrame.setTitle(this.m_Indy.getName() + ": " + this.m_Indy);
|
||||
newFrame.setTitle(this.individual.getName() + ": " + this.individual);
|
||||
newFrame.addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(WindowEvent ev) {
|
||||
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.pack();
|
||||
newFrame.validate();
|
||||
|
@ -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 {
|
||||
|
||||
private Color m_Color;
|
||||
private Color color;
|
||||
|
||||
/**
|
||||
* this method has to be overridden to paint the icon. The point itself lies
|
||||
@ -22,7 +18,7 @@ public class Chart2DDPointIconCross implements DPointIcon {
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
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.setColor(prev);
|
||||
@ -40,6 +36,6 @@ public class Chart2DDPointIconCross implements DPointIcon {
|
||||
}
|
||||
|
||||
public void setColor(Color c) {
|
||||
this.m_Color = c;
|
||||
this.color = c;
|
||||
}
|
||||
}
|
||||
|
@ -13,9 +13,9 @@ import java.awt.*;
|
||||
*/
|
||||
public class Chart2DDPointIconPoint implements DPointIcon {
|
||||
|
||||
private Color m_Border = Color.BLACK;
|
||||
private Color m_Fill = Color.BLACK;
|
||||
private int m_Size = 2;
|
||||
private Color borderColor = Color.BLACK;
|
||||
private Color fillColor = Color.BLACK;
|
||||
private int size = 2;
|
||||
|
||||
/**
|
||||
* this method has to be overridden to paint the icon. The point itself lies
|
||||
@ -24,14 +24,14 @@ public class Chart2DDPointIconPoint implements DPointIcon {
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
Color prev = g.getColor();
|
||||
if (m_Fill != null) {
|
||||
g.setColor(m_Fill);
|
||||
g.fillOval(-this.m_Size, -this.m_Size, 2 * this.m_Size, 2 * this.m_Size);
|
||||
if (fillColor != null) {
|
||||
g.setColor(fillColor);
|
||||
g.fillOval(-this.size, -this.size, 2 * this.size, 2 * this.size);
|
||||
}
|
||||
if (this.m_Border != null) {
|
||||
g.setColor(m_Border);
|
||||
if (this.borderColor != null) {
|
||||
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);
|
||||
}
|
||||
|
||||
@ -47,15 +47,15 @@ public class Chart2DDPointIconPoint implements DPointIcon {
|
||||
}
|
||||
|
||||
public void setBorderColor(Color c) {
|
||||
this.m_Border = c;
|
||||
this.borderColor = c;
|
||||
}
|
||||
|
||||
public void setFillColor(Color c) {
|
||||
this.m_Fill = c;
|
||||
this.fillColor = c;
|
||||
}
|
||||
|
||||
public void setSize(int d) {
|
||||
this.m_Size = d;
|
||||
this.size = d;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,24 +1,18 @@
|
||||
package eva2.tools.chart2d;
|
||||
|
||||
|
||||
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 {
|
||||
|
||||
private DPointIcon m_Icon = new Chart2DDPointIconCross();
|
||||
private String m_Text = " ";
|
||||
private Color m_Color;
|
||||
private DPointIcon icon = new Chart2DDPointIconCross();
|
||||
private String text = " ";
|
||||
private Color color;
|
||||
|
||||
public Chart2DDPointIconText(String s) {
|
||||
m_Text = s;
|
||||
text = s;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -27,7 +21,7 @@ public class Chart2DDPointIconText implements DPointIcon {
|
||||
* @param icon The new icon
|
||||
*/
|
||||
public void setIcon(DPointIcon icon) {
|
||||
this.m_Icon = icon;
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -36,9 +30,9 @@ public class Chart2DDPointIconText implements DPointIcon {
|
||||
*/
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
this.m_Icon.paint(g);
|
||||
g.setColor(m_Color);
|
||||
g.drawString(this.m_Text, 4, 4);
|
||||
this.icon.paint(g);
|
||||
g.setColor(color);
|
||||
g.drawString(this.text, 4, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -58,6 +52,6 @@ public class Chart2DDPointIconText implements DPointIcon {
|
||||
* @param col
|
||||
*/
|
||||
public void setColor(Color col) {
|
||||
m_Color = col;
|
||||
color = col;
|
||||
}
|
||||
}
|
@ -127,17 +127,17 @@ package eva2.tools.matlab;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
public class JMatLink extends Thread {
|
||||
private static JMatLink m_Instance = null;
|
||||
private static JMatLink matlinkInstance = null;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static JMatLink getInstance() {
|
||||
// System.out.println("JMatLink getInstance () {");
|
||||
if (m_Instance == null) {
|
||||
m_Instance = new JMatLink();
|
||||
if (matlinkInstance == null) {
|
||||
matlinkInstance = new JMatLink();
|
||||
}
|
||||
return m_Instance;
|
||||
return matlinkInstance;
|
||||
}
|
||||
|
||||
// static declarations
|
||||
|
Loading…
x
Reference in New Issue
Block a user