From ee672768274c4bd0364f4dfcfaf7d73a9ca4cc17 Mon Sep 17 00:00:00 2001 From: Marcel Kronfeld Date: Fri, 5 Sep 2008 13:03:27 +0000 Subject: [PATCH] Merging mk branch changes from rev 185, minor cleanup. --- src/eva2/gui/FunctionArea.java | 7 +++ .../go/individuals/AbstractEAIndividual.java | 7 ++- .../InterfaceSelectionProbability.java | 8 +-- src/wsi/ra/tool/BasicResourceLoader.java | 58 ++++++++++++++----- 4 files changed, 60 insertions(+), 20 deletions(-) diff --git a/src/eva2/gui/FunctionArea.java b/src/eva2/gui/FunctionArea.java index b93a87a5..9ec53c56 100644 --- a/src/eva2/gui/FunctionArea.java +++ b/src/eva2/gui/FunctionArea.java @@ -115,6 +115,13 @@ public class FunctionArea extends DArea implements Serializable { drawCircle(c+""+val, position, graphID); } + public void drawCircle(String label, double xPos, double yPos, int graphID) { + double[] pos = new double[2]; + pos[0]=xPos; + pos[1]=yPos; + drawCircle(label, pos, graphID); + } + /** * Plot a circle 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 ID diff --git a/src/eva2/server/go/individuals/AbstractEAIndividual.java b/src/eva2/server/go/individuals/AbstractEAIndividual.java index 6a34a93d..74920696 100644 --- a/src/eva2/server/go/individuals/AbstractEAIndividual.java +++ b/src/eva2/server/go/individuals/AbstractEAIndividual.java @@ -763,7 +763,12 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java. // if (name.equalsIgnoreCase("Fitness")) return this.getFitness(); // if (name.equalsIgnoreCase("FitnessArray")) return this.getFitness(); Object data = m_dataHash.get(name); - if (data==null) System.err.println("Warning: data key " + name + " unknown!"); + if (data==null) { // Fitness is actually in use... so lets have a minor special treatment + if (name.compareToIgnoreCase("Fitness")==0) data = getFitness(); + else { + EVAERROR.errorMsgOnce("Warning: data key " + name + " unknown (pot. multiple errors)!"); + } + } return data; } diff --git a/src/eva2/server/go/operators/selection/probability/InterfaceSelectionProbability.java b/src/eva2/server/go/operators/selection/probability/InterfaceSelectionProbability.java index 2f810c43..97f5d140 100644 --- a/src/eva2/server/go/operators/selection/probability/InterfaceSelectionProbability.java +++ b/src/eva2/server/go/operators/selection/probability/InterfaceSelectionProbability.java @@ -3,9 +3,9 @@ package eva2.server.go.operators.selection.probability; import eva2.server.go.populations.Population; /** The interface for methods with calculate the selection - * propability from the fitness values. While the fitness + * probability from the fitness values. While the fitness * is typically to be minimized the selection probability - * is within [0,1] summs up to one and is to be maximizes. + * is within [0,1] sums up to one and is to be maximizes. * Created by IntelliJ IDEA. * User: streiche * Date: 30.03.2004 @@ -22,7 +22,7 @@ public interface InterfaceSelectionProbability { /** This method computes the selection probability for each individual * in the population. Note: Summed over the complete population the selection - * probability sums up to one. + * probability gives one. * @param population The population to compute. * @param input The name of the input. */ @@ -30,7 +30,7 @@ public interface InterfaceSelectionProbability { /** This method computes the selection probability for each individual * in the population. Note: Summed over the complete population the selection - * probability sums up to one. + * probability gives one. * @param population The population to compute. * @param input The name of the input. */ diff --git a/src/wsi/ra/tool/BasicResourceLoader.java b/src/wsi/ra/tool/BasicResourceLoader.java index a838136f..9543d3b4 100644 --- a/src/wsi/ra/tool/BasicResourceLoader.java +++ b/src/wsi/ra/tool/BasicResourceLoader.java @@ -34,18 +34,17 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.LineNumberReader; - import java.net.URL; - import java.util.ArrayList; import java.util.Enumeration; import java.util.List; import java.util.Properties; +import java.util.Vector; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.util.zip.ZipInputStream; -import wsi.ra.tool.DummyCategory; +import eva2.tools.ReflectPackage; /** @@ -324,7 +323,8 @@ public class BasicResourceLoader implements ResourceLoader // some f... special characters at the end which will not be shown // at the console output !!! resourceLocation = resourceLocation.trim(); - + InputStream in = null; + // is a relative path defined ? // this can only be possible, if this is a file resource location if (resourceLocation.startsWith("..") || @@ -333,30 +333,58 @@ public class BasicResourceLoader implements ResourceLoader ((resourceLocation.length() > 1) && (resourceLocation.charAt(1) == ':'))) { - return getStreamFromFile(resourceLocation); + in = getStreamFromFile(resourceLocation); + } +// InputStream inTest = getStreamFromFile(resourceLocation); + + if (in == null) { + in = ClassLoader.getSystemResourceAsStream(resourceLocation); } - InputStream in = ClassLoader.getSystemResourceAsStream(resourceLocation); - - if (in == null) - { + if (in == null) { // try again for web start applications in = this.getClass().getClassLoader().getResourceAsStream( resourceLocation); } - if (in == null) - { - return null; + if (in == null) { + // try to search other classpathes...? not really necessary. +// in = getStreamFromClassPath(resourceLocation); } - + if (logger.isDebugEnabled()) { - logger.debug("Stream opened for " + resourceLocation); + if (in == null) logger.debug("Unable to open stream for " + resourceLocation); + else logger.debug("Stream opened for " + resourceLocation); } return in; } +// public InputStream getStreamFromClassPath(String resourceLocation) { +// String[] dynCP = ReflectPackage.getValidCPArray(); +// Vector found = new Vector(); +// for (int i=0; i1) { +// System.err.println("Warning, more than one instance of " + resourceLocation + " were found, returning first of:"); +// for (int i=0; i