From 0fdb7edc5217cd0e1c58494c28cde5d2450bbd39 Mon Sep 17 00:00:00 2001 From: Marcel Kronfeld Date: Wed, 3 Sep 2008 17:37:37 +0000 Subject: [PATCH] Some lonely test classes moved to the research branch. --- src/eva2/server/go/tools/InterfaceTest.java | 11 --- src/eva2/server/go/tools/Test1.java | 42 ----------- src/eva2/server/go/tools/Test2.java | 50 ------------- src/eva2/server/go/tools/Test3.java | 82 --------------------- src/eva2/server/go/tools/Test4.java | 35 --------- src/eva2/server/go/tools/Test5.java | 74 ------------------- src/eva2/server/go/tools/entity.java | 59 --------------- src/eva2/server/go/tools/point.java | 62 ---------------- 8 files changed, 415 deletions(-) delete mode 100644 src/eva2/server/go/tools/InterfaceTest.java delete mode 100644 src/eva2/server/go/tools/Test1.java delete mode 100644 src/eva2/server/go/tools/Test2.java delete mode 100644 src/eva2/server/go/tools/Test3.java delete mode 100644 src/eva2/server/go/tools/Test4.java delete mode 100644 src/eva2/server/go/tools/Test5.java delete mode 100644 src/eva2/server/go/tools/entity.java delete mode 100644 src/eva2/server/go/tools/point.java diff --git a/src/eva2/server/go/tools/InterfaceTest.java b/src/eva2/server/go/tools/InterfaceTest.java deleted file mode 100644 index 0714bacf..00000000 --- a/src/eva2/server/go/tools/InterfaceTest.java +++ /dev/null @@ -1,11 +0,0 @@ -package eva2.server.go.tools; - -/** - * Created by IntelliJ IDEA. - * User: streiche - * Date: 28.01.2004 - * Time: 13:07:47 - * To change this template use Options | File Templates. - */ -public interface InterfaceTest { -} diff --git a/src/eva2/server/go/tools/Test1.java b/src/eva2/server/go/tools/Test1.java deleted file mode 100644 index 52ce7690..00000000 --- a/src/eva2/server/go/tools/Test1.java +++ /dev/null @@ -1,42 +0,0 @@ -package eva2.server.go.tools; - -import java.io.Serializable; - -/** - * Created by IntelliJ IDEA. - * User: streiche - * Date: 28.01.2004 - * Time: 13:08:13 - * To change this template use Options | File Templates. - */ -public class Test1 implements InterfaceTest, Serializable { - private double m_Var = 1.0; - -/********************************************************************************************************************** - * These are for GUI - */ - /** This method allows the CommonJavaObjectEditorPanel to read the - * name to the current object. - * @return The name. - */ - public String getName() { - return "Test1"; - } - /** This method returns a global info string - * @return description - */ - public String globalInfo() { - return "Test1."; - } - public void setVar(double v) { - this.m_Var = v; - } - public double getVar() { - return this.m_Var; - } - public String varTipText() { - return "Test1"; - } - - -} diff --git a/src/eva2/server/go/tools/Test2.java b/src/eva2/server/go/tools/Test2.java deleted file mode 100644 index 0024f593..00000000 --- a/src/eva2/server/go/tools/Test2.java +++ /dev/null @@ -1,50 +0,0 @@ -package eva2.server.go.tools; - -import java.io.Serializable; - -/** - * Created by IntelliJ IDEA. - * User: streiche - * Date: 28.01.2004 - * Time: 13:12:40 - * To change this template use Options | File Templates. - */ -public class Test2 implements InterfaceTest, Serializable { - private double m_Var = 1.0; - private boolean m_Bol = true; - -/********************************************************************************************************************** - * These are for GUI - */ - /** This method allows the CommonJavaObjectEditorPanel to read the - * name to the current object. - * @return The name. - */ - public String getName() { - return "Test2"; - } - /** This method returns a global info string - * @return description - */ - public String globalInfo() { - return "Test2."; - } - public void setVar(double v) { - this.m_Var = v; - } - public double getVar() { - return this.m_Var; - } - public String varTipText() { - return "Test2"; - } - public void setBol(boolean v) { - this.m_Bol = v; - } - public boolean getBol() { - return this.m_Bol; - } - public String bolTipText() { - return "Test2"; - } -} diff --git a/src/eva2/server/go/tools/Test3.java b/src/eva2/server/go/tools/Test3.java deleted file mode 100644 index 1648fd07..00000000 --- a/src/eva2/server/go/tools/Test3.java +++ /dev/null @@ -1,82 +0,0 @@ -package eva2.server.go.tools; - - -import java.io.*; -import java.beans.XMLEncoder; -import java.beans.XMLDecoder; - -import eva2.server.go.individuals.GAIndividualBinaryData; -import eva2.server.go.operators.crossover.CrossoverGANPoint; -import eva2.server.go.operators.crossover.CrossoverGAUniform; -import eva2.server.go.operators.mutation.MutateGADefault; -import eva2.server.go.operators.mutation.MutateGAStandard; -import eva2.server.go.problems.F1Problem; - -public class Test3 { - - public static void main(String[] args) { - try { - XMLEncoder e; - GAIndividualBinaryData o = new GAIndividualBinaryData(); - MutateGAStandard m = new MutateGAStandard(); - m.setNumberOfMutations(2); - o.setMutationOperator(m); - o.setMutationProbability(0.13); - CrossoverGANPoint t = new CrossoverGANPoint(); - t.setNumberOfCrossovers(1); - o.setCrossoverOperator(new CrossoverGAUniform()); - o.setCrossoverProbability(0.23); - o.init(new F1Problem()); - double[] d = new double[2]; - d[0] = 2.34; - d[1] = 4.5656; - o.SetFitness(d); - e = new XMLEncoder(new BufferedOutputStream(new FileOutputStream("GAIndividualBinaryData.xml"))); - e.writeObject(o); - e.flush(); - e.close(); - GAIndividualBinaryData p; - XMLDecoder decoder = new XMLDecoder(new FileInputStream("GAIndividualBinaryData.xml")); - p = (GAIndividualBinaryData) decoder.readObject(); - System.out.println(o.getStringRepresentation()); - System.out.println(p.getStringRepresentation()); - decoder.close(); - - } catch (Exception e1) { - e1.printStackTrace(); - } - - } - /** Serialize a Java object to XML. All attributes that have getter and - * setter methods will be serialized to elements. - * @param serializable Java object that implements Serializable. - * @param outputStream Output stream to write XML to. - */ - public static void serialize(Serializable serializable, OutputStream outputStream) throws Exception { - //todo: accept vector of serializables ... - if (outputStream != null) { - XMLEncoder encoder = new XMLEncoder(outputStream); - encoder.writeObject(serializable); - encoder.close(); - } - } //serialize() - - /** - * Deserialize a Java object from XML that was serialized via the - * serialize method. - * @param inputStream Input stream to read XML from. - * @return Serializable Java object from XML. - * @throws Exception - * @see de.icomps.sgml.xml#serialize(Serializable, OutputStream) - */ - public static Serializable deserialize(InputStream inputStream) throws Exception { - Serializable result = null; - //todo: return vector of serializables ... - if (inputStream != null) { - XMLDecoder decoder = new XMLDecoder(new BufferedInputStream(inputStream)); - result = (Serializable) decoder.readObject(); - decoder.close(); - } - return result; - }//deserialize() -} \ No newline at end of file diff --git a/src/eva2/server/go/tools/Test4.java b/src/eva2/server/go/tools/Test4.java deleted file mode 100644 index f0a70ae1..00000000 --- a/src/eva2/server/go/tools/Test4.java +++ /dev/null @@ -1,35 +0,0 @@ -package eva2.server.go.tools; - -/** - * Created by IntelliJ IDEA. - * User: streiche - * Date: 04.03.2004 - * Time: 13:20:21 - * To change this template use File | Settings | File Templates. - */ - -class A { - public String getString() { - return this.getMyString(); - } - - private String getMyString() { - return "A"; - } -} - -class B extends A { - private String getMyString() { - return "B"; - } -} - -public class Test4 { - public static void main(String[] args) { - A a = new A(); - B b = new B(); - System.out.println("A.getString(): " + a.getString()); - System.out.println("B.getString(): " + b.getString()); - for (int i = 0; i < 10; i++) System.out.println("i: " + (i%5)); - } -} diff --git a/src/eva2/server/go/tools/Test5.java b/src/eva2/server/go/tools/Test5.java deleted file mode 100644 index 8a892482..00000000 --- a/src/eva2/server/go/tools/Test5.java +++ /dev/null @@ -1,74 +0,0 @@ -package eva2.server.go.tools; - -import java.io.*; - -/** - * Created by IntelliJ IDEA. - * User: streiche - * Date: 04.03.2004 - * Time: 13:24:03 - * To change this template use File | Settings | File Templates. - */ - -abstract class M { - - protected String m = "M"; - - public abstract void init(); - - public void setM(String m) { - this.m = m; - } - public String getM() { - return this.m; - } - -} - -class N extends M implements java.io.Serializable { - public void init() { - this.m = "N"; - } -} -public class Test5 { - public static void main(String[] args) { - N n = new N(); - N a = null; - n.init(); - System.out.println("N.getM(): " + n.getM()); - try { - store(n, "N.ser"); - } catch (java.io.IOException e) { - System.out.println("java.io.IOException while writing: " + e.getMessage()); - } - try { - try { - a = (N)load("N.ser"); - } catch (java.io.IOException e) { - System.out.println("java.io.IOException while reading: " + e.getMessage()); - } - } catch (java.lang.ClassNotFoundException e) { - System.out.println("java.lang.ClassNotFoundException: " + e.getMessage()); - } - if (a != null) System.out.println("A.getM(): " + a.getM()); - } - - static private void store(Serializable o, String Filename) throws IOException { - File f = new File(Filename); - FileOutputStream file = new FileOutputStream(f); - ObjectOutputStream out = new ObjectOutputStream(file); - out.writeObject(o); - out.flush(); - out.close(); - file.close(); - } - static private Object load(String Filename) throws IOException, ClassNotFoundException { - File f = new File(Filename); - FileInputStream file = new FileInputStream(f); - ObjectInputStream in = new ObjectInputStream(file); - Object ret = in.readObject(); - in.close(); - file.close(); - return ret; - } -} diff --git a/src/eva2/server/go/tools/entity.java b/src/eva2/server/go/tools/entity.java deleted file mode 100644 index 17909c72..00000000 --- a/src/eva2/server/go/tools/entity.java +++ /dev/null @@ -1,59 +0,0 @@ -package eva2.server.go.tools; - -/** - * Created by IntelliJ IDEA. - * User: streiche - * Date: 23.02.2004 - * Time: 16:52:16 - * To change this template use File | Settings | File Templates. - */ -public class entity { -private String type = null; -private String basetype = null; -private String id = null; -private String name = null; -private String color = null; - -public entity(){ -} - -public void setType(String type) { -this.type = type; -} - -public void setBasetype(String basetype) { -this.basetype = basetype; -} - -public void setId(String id) { -this.id = id; -} - -public void setName(String name) { -this.name = name; -} - -public void setColor(String color) { -this.color = color; -} - -public String getType() { -return type; -} - -public String getBasetype() { -return basetype; -} - -public String getId() { -return id; -} - -public String getName() { -return name; -} - -public String getColor() { -return color; -} -} \ No newline at end of file diff --git a/src/eva2/server/go/tools/point.java b/src/eva2/server/go/tools/point.java deleted file mode 100644 index dea0d81c..00000000 --- a/src/eva2/server/go/tools/point.java +++ /dev/null @@ -1,62 +0,0 @@ -package eva2.server.go.tools; - -/** - * Created by IntelliJ IDEA. - * User: streiche - * Date: 23.02.2004 - * Time: 16:53:16 - * To change this template use File | Settings | File Templates. - */ -public class point extends entity { -private int x = 0; -private int y = 0; - -public point() { -} - -public point(int x, int y) { -setX(x); -setY(y); - -setType("type1"); -setBasetype("basetype1"); -setColor("red"); -setName("my_name"); -} - -public void setX(int x) { -this.x = x; -} - -public void setY(int y) { -this.y = y; -} - -public int getX() { -return x; -} - -public int getY() { -return y; -} - -public void setType(String type) { -super.setType(type); -} - -public void setBasetype(String basetype) { -super.setBasetype(basetype); -} - -public void setColor(String color) { -super.setColor(color); -} - -public void setId(String id) { -super.setId(id); -} - -public void setName(String name) { -super.setName(name); -} -} \ No newline at end of file