Cleanup and documentation update.

refs #2
This commit is contained in:
Fabian Becker 2014-10-23 13:53:52 +02:00
parent c7bf4dd7e2
commit b13e81e59c
44 changed files with 175 additions and 522 deletions

View File

@ -1 +0,0 @@
package eva2.client;

View File

@ -1 +1,4 @@
/**
* Contains example implementations for custom Terminators and Optimizations.
*/
package eva2.examples; package eva2.examples;

View File

@ -511,7 +511,7 @@ public class BeanInspector {
* For a primitive type, return the boxed referenced type. Return null for * For a primitive type, return the boxed referenced type. Return null for
* any non-primitive type. * any non-primitive type.
* *
* @param clz1 * @param cls
* @return * @return
*/ */
public static Class getBoxedType(Class cls) { public static Class getBoxedType(Class cls) {

View File

@ -11,7 +11,7 @@ import javax.swing.tree.DefaultMutableTreeNode;
* *
* @author mkron * @author mkron
* @see PropertySheetPanel * @see PropertySheetPanel
* @see GOParameters * @see eva2.optimization.modules.OptimizationParameters
*/ */
public class EvATreeNode extends DefaultMutableTreeNode { public class EvATreeNode extends DefaultMutableTreeNode {
private String[] childrenNames = null; private String[] childrenNames = null;

View File

@ -1,8 +1,8 @@
package eva2.gui; package eva2.gui;
import eva2.EvAInfo; import eva2.EvAInfo;
import eva2.client.ClassPreloader; import eva2.util.ClassPreloader;
import eva2.client.EvAComAdapter; import eva2.util.EvAComAdapter;
import eva2.optimization.OptimizationStateListener; import eva2.optimization.OptimizationStateListener;
import eva2.optimization.go.InterfaceOptimizationParameters; import eva2.optimization.go.InterfaceOptimizationParameters;
import eva2.optimization.modules.AbstractModuleAdapter; import eva2.optimization.modules.AbstractModuleAdapter;
@ -90,7 +90,7 @@ public class Main extends JFrame implements OptimizationStateListener {
/** /**
* Constructor of GUI of EvA2. Works as client for the EvA2 server. Note * Constructor of GUI of EvA2. Works as client for the EvA2 server. Note
* that the Main initialized multi-threaded for efficiency. Use {@link #awaitGuiInitialized()} * that the Main initialized multi-threaded for efficiency. Use {@link #awaitClientInitialized()} }
* to await full initialization if necessary. * to await full initialization if necessary.
*/ */
public Main(final String hostName) { public Main(final String hostName) {
@ -100,7 +100,7 @@ public class Main extends JFrame implements OptimizationStateListener {
/** /**
* A constructor. Splash screen is optional, Gui is activated, no parent * A constructor. Splash screen is optional, Gui is activated, no parent
* window. Note that the Main initialized multi-threaded for * window. Note that the Main initialized multi-threaded for
* efficiency. Use {@link #awaitGuiInitialized()} to await full * efficiency. Use {@link #awaitClientInitialized()} to await full
* initialization if necessary. * initialization if necessary.
* *
* @param hostName * @param hostName
@ -114,7 +114,7 @@ public class Main extends JFrame implements OptimizationStateListener {
/** /**
* A constructor with optional spash screen. Note that the Main is * A constructor with optional spash screen. Note that the Main is
* initialized multi-threaded for efficiency. Use {@link #awaitGuiInitialized()} * initialized multi-threaded for efficiency. Use {@link #awaitClientInitialized()}
* to await full initialization if necessary. * to await full initialization if necessary.
* *
* @param hostName * @param hostName
@ -128,7 +128,7 @@ public class Main extends JFrame implements OptimizationStateListener {
/** /**
* A constructor with optional splash screen. Note that the Main * A constructor with optional splash screen. Note that the Main
* initialized multi-threaded for efficiency. Use {@link #awaitGuiInitialized()} * initialized multi-threaded for efficiency. Use {@link #awaitClientInitialized()}
* to await full initialization if necessary. * to await full initialization if necessary.
* *
* @param hostName * @param hostName
@ -144,11 +144,11 @@ public class Main extends JFrame implements OptimizationStateListener {
/** /**
* A constructor with optional splash screen. Note that the Main * A constructor with optional splash screen. Note that the Main
* initialized multi-threaded for efficiency. Use {@link #awaitGuiInitialized()} * initialized multi-threaded for efficiency. Use {@link #awaitClientInitialized()}
* to await full initialization if necessary. * to await full initialization if necessary.
* *
* @param hostName * @param hostName
* @param paramsFile * @param optimizationParameters
* @param autorun * @param autorun
* @param noSplash * @param noSplash
* @param noGui * @param noGui
@ -179,7 +179,7 @@ public class Main extends JFrame implements OptimizationStateListener {
* from a file (paramsFile) or given directly as a java instance. Both may * from a file (paramsFile) or given directly as a java instance. Both may
* be null to start with standard parameters. If both are non null, the java * be null to start with standard parameters. If both are non null, the java
* instance has the higher priority. Note that the Main initialized * instance has the higher priority. Note that the Main initialized
* multi-threaded for efficiency. Use {@link #awaitGuiInitialized()} to * multi-threaded for efficiency. Use {@link #awaitClientInitialized()} to
* await full initialization if necessary. * await full initialization if necessary.
* *
* @param hostName * @param hostName

View File

@ -1 +1,4 @@
/**
* Base package for the EvA2 GUI.
*/
package eva2.gui; package eva2.gui;

View File

@ -0,0 +1,4 @@
/**
* JSON package for serializing and deserializing optimization configurations.
*/
package eva2.json;

View File

@ -26,6 +26,7 @@ public final class ModuleServer {
/** /**
* *
* @param EvAProps
*/ */
public ModuleServer(Properties EvAProps) { public ModuleServer(Properties EvAProps) {
if (instanceCounter > 0) { if (instanceCounter > 0) {
@ -93,6 +94,9 @@ public final class ModuleServer {
* module classes; if necessary through a remote proxy. Try to load a given * module classes; if necessary through a remote proxy. Try to load a given
* parameter file in case its a GOModuleAdapter. * parameter file in case its a GOModuleAdapter.
* *
* @param selectedModuleName
* @param optimizationParameters
* @param noGuiLogFile
* @return the loaded module adapter instance * @return the loaded module adapter instance
*/ */
public ModuleAdapter createModuleAdapter(String selectedModuleName, InterfaceOptimizationParameters optimizationParameters, String noGuiLogFile) { public ModuleAdapter createModuleAdapter(String selectedModuleName, InterfaceOptimizationParameters optimizationParameters, String noGuiLogFile) {

View File

@ -7,11 +7,11 @@ import javax.swing.*;
* SwingWorker 3), an abstract class that you subclass to * SwingWorker 3), an abstract class that you subclass to
* perform GUI-related work in a dedicated thread. For * perform GUI-related work in a dedicated thread. For
* instructions on using this class, see: * instructions on using this class, see:
* <p/> * </p><p>
* http://java.sun.com/products/jfc/tsc/articles/threads/threads2.html * http://java.sun.com/products/jfc/tsc/articles/threads/threads2.html
* or * or
* http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html * http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html
* <p/> * </p><p>
* Note that the API changed slightly in the 3rd version: * Note that the API changed slightly in the 3rd version:
* You must now invoke start() on the SwingWorker after * You must now invoke start() on the SwingWorker after
* creating it. * creating it.

View File

@ -8,6 +8,7 @@ import java.io.Serializable;
/** /**
* Starts a statistics GUI and the GOProcessor thread. * Starts a statistics GUI and the GOProcessor thread.
*/ */
@SuppressWarnings("unused")
public class GOModuleAdapter extends GenericModuleAdapter implements ModuleAdapter, Serializable { public class GOModuleAdapter extends GenericModuleAdapter implements ModuleAdapter, Serializable {
private static final String moduleName = "Genetic_Optimization"; private static final String moduleName = "Genetic_Optimization";

View File

@ -56,7 +56,6 @@ public class GenericModuleAdapter extends AbstractModuleAdapter implements Seria
* *
* @param adapterName The AdapterName * @param adapterName The AdapterName
* @param helperFName name of a html help file name * @param helperFName name of a html help file name
* @param Client The client to serve
* @param params a parameter set describing the optimizer module * @param params a parameter set describing the optimizer module
* @param optimizerExpert set to true if setting the optimizer is an expert option being hidden from the gui * @param optimizerExpert set to true if setting the optimizer is an expert option being hidden from the gui
*/ */

View File

@ -20,7 +20,7 @@ import java.util.logging.Level;
/** /**
* OptimizationParameters for configuration of an * OptimizationParameters for configuration of an
* optimization run. * optimization run.
* <p/> * </p><p>
* This class is used to generate the default GUI * This class is used to generate the default GUI
* configuration panel for optimizations. * configuration panel for optimizations.
*/ */

View File

@ -40,8 +40,6 @@ import java.util.logging.Logger;
* interface, it is applied to the instance that returned it directly. For * interface, it is applied to the instance that returned it directly. For
* arrays of objects each array entry is again handled by checking for * arrays of objects each array entry is again handled by checking for
* getParamControl, thus recursive controllable structures are possible. * getParamControl, thus recursive controllable structures are possible.
*
* @author mkron
*/ */
public class Processor extends Thread implements InterfaceProcessor, InterfacePopulationChangedEventListener { public class Processor extends Thread implements InterfaceProcessor, InterfacePopulationChangedEventListener {
@ -227,7 +225,6 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
optimizationParameters.getOptimizer().addPopulationChangedEventListener(this); optimizationParameters.getOptimizer().addPopulationChangedEventListener(this);
runCounter = 0; runCounter = 0;
String popLog = null; //"populationLog.txt";
while (isOptimizationRunning() && (runCounter < statistics.getStatisticsParameter().getMultiRuns())) { while (isOptimizationRunning() && (runCounter < statistics.getStatisticsParameter().getMultiRuns())) {
LOGGER.info(String.format("Starting Optimization %d/%d", runCounter + 1, statistics.getStatisticsParameter().getMultiRuns())); LOGGER.info(String.format("Starting Optimization %d/%d", runCounter + 1, statistics.getStatisticsParameter().getMultiRuns()));
@ -244,19 +241,11 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
if (optimizationStateListener != null) { if (optimizationStateListener != null) {
optimizationStateListener.updateProgress(getStatusPercent(optimizationParameters.getOptimizer().getPopulation(), runCounter, statistics.getStatisticsParameter().getMultiRuns()), null); optimizationStateListener.updateProgress(getStatusPercent(optimizationParameters.getOptimizer().getPopulation(), runCounter, statistics.getStatisticsParameter().getMultiRuns()), null);
} }
if (popLog != null) {
EVAHELP.clearLog(popLog);
}
do { // main loop do { // main loop
maybeUpdateParamCtrl(optimizationParameters); maybeUpdateParamCtrl(optimizationParameters);
this.optimizationParameters.getOptimizer().optimize(); this.optimizationParameters.getOptimizer().optimize();
// registerPopulationStateChanged *SHOULD* be fired by the optimizer or resp. the population
// as we are event listener
if (popLog != null) {
EVAHELP.logString(this.optimizationParameters.getOptimizer().getPopulation().getIndyList(), popLog);
}
} }
while (isOptimizationRunning() && !this.optimizationParameters.getTerminator().isTerminated(this.optimizationParameters.getOptimizer().getAllSolutions())); while (isOptimizationRunning() && !this.optimizationParameters.getTerminator().isTerminated(this.optimizationParameters.getOptimizer().getAllSolutions()));

View File

@ -1 +1,4 @@
/**
*
*/
package eva2.optimization; package eva2.optimization;

View File

@ -955,7 +955,7 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
* population. If the population is empty, -1 is returned. * population. If the population is empty, -1 is returned.
* *
* @return The index of the best individual. * @return The index of the best individual.
* @see getIndexOfBestOrWorstIndividual() * @see #getIndexOfBestOrWorstIndividual(boolean, java.util.Comparator)
*/ */
public int getIndexOfBestIndividualPrefFeasible() { public int getIndexOfBestIndividualPrefFeasible() {
if (size() < 1) { if (size() < 1) {
@ -969,7 +969,7 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
* the population. * the population.
* *
* @return The index of the worst individual. * @return The index of the worst individual.
* @see getIndexOfBestOrWorstIndividual() * @see #getIndexOfBestOrWorstIndividual(boolean, java.util.Comparator)
*/ */
public int getIndexOfWorstIndividualNoConstr() { public int getIndexOfWorstIndividualNoConstr() {
return getIndexOfBestOrWorstIndy(false, false, -1); return getIndexOfBestOrWorstIndy(false, false, -1);
@ -981,7 +981,7 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
* fitIndex < 0). If the population is empty, -1 is returned. * fitIndex < 0). If the population is empty, -1 is returned.
* *
* @return The index of the best individual. * @return The index of the best individual.
* @see getIndexOfBestOrWorstIndividual() * @see #getIndexOfBestOrWorstIndividual(boolean, java.util.Comparator)
*/ */
public int getIndexOfBestIndividualPrefFeasible(int fitIndex) { public int getIndexOfBestIndividualPrefFeasible(int fitIndex) {
if (size() < 1) { if (size() < 1) {
@ -996,7 +996,7 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
* fitIndex < 0). * fitIndex < 0).
* *
* @return The index of the best individual. * @return The index of the best individual.
* @see getIndexOfBestOrWorstIndividual() * @see #getIndexOfBestOrWorstIndividual(boolean, java.util.Comparator)
*/ */
public int getIndexOfWorstIndividualNoConstr(int fitIndex) { public int getIndexOfWorstIndividualNoConstr(int fitIndex) {
return getIndexOfBestOrWorstIndy(false, false, fitIndex); return getIndexOfBestOrWorstIndy(false, false, fitIndex);
@ -1257,7 +1257,6 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
* instance. * instance.
* *
* @param n * @param n
* @param l
*/ */
public Population toTail(int n) { public Population toTail(int n) {
Population retPop = new Population(n); Population retPop = new Population(n);
@ -1310,8 +1309,7 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
* the population has not been modified. The returned array must not be * the population has not been modified. The returned array must not be
* altered! * altered!
* *
* @param fitIndex the fitness criterion to be used or -1 for pareto * @param comp The comparator
* dominance
* @return * @return
*/ */
public ArrayList<AbstractEAIndividual> getSorted(Comparator<Object> comp) { public ArrayList<AbstractEAIndividual> getSorted(Comparator<Object> comp) {
@ -1332,7 +1330,7 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
/** /**
* Returns the sorted population as a new population instance. * Returns the sorted population as a new population instance.
* *
* @see getSorted(Comparator) * @see #getSorted(java.util.Comparator)
*/ */
public Population getSortedPop(Comparator<Object> comp) { public Population getSortedPop(Comparator<Object> comp) {
Population pop = this.cloneWithoutInds(); Population pop = this.cloneWithoutInds();
@ -1386,8 +1384,8 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
* returns dst Population. * returns dst Population.
* *
* @param n * @param n
* @param from * @param src
* @param to * @param dst
* @return * @return
*/ */
public static Population moveNInds(int n, Population src, Population dst) { public static Population moveNInds(int n, Population src, Population dst) {
@ -1402,8 +1400,8 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
/** /**
* Move one random individual from src to dst population. * Move one random individual from src to dst population.
* *
* @param from * @param src
* @param to * @param dst
*/ */
public static void moveRandIndFromTo(Population src, Population dst) { public static void moveRandIndFromTo(Population src, Population dst) {
int k = RNG.randomInt(src.size()); int k = RNG.randomInt(src.size());
@ -1762,7 +1760,7 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
* individual to be removed is not contained in the instance. Otherwise, * individual to be removed is not contained in the instance. Otherwise,
* this is ignored. * this is ignored.
* *
* @param tmpPop * @param popToRemove
* @param errorOnMissing * @param errorOnMissing
*/ */
public void removeMembers(Population popToRemove, boolean errorOnMissing) { public void removeMembers(Population popToRemove, boolean errorOnMissing) {
@ -1843,7 +1841,7 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
/** /**
* Returns the average, minimal and maximal individual distance as diversity * Returns the average, minimal and maximal individual distance as diversity
* measure for the population. If the given metric argument is null, the * measure for the population. If the given metric argument is null, the
* euclidian distance of individual positions is used, which presumes that {@link AbstractEAIndividual.getDoublePosition(indy)} * euclidian distance of individual positions is used, which presumes that {@link eva2.optimization.individuals.AbstractEAIndividual#getDoublePosition(eva2.optimization.individuals.AbstractEAIndividual)}
* returns a valid double position for the individuals of the population. * returns a valid double position for the individuals of the population.
* This is of course rather expensive computationally. * This is of course rather expensive computationally.
* *
@ -1859,7 +1857,7 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
/** /**
* Returns the average, minimal and maximal individual distance as diversity * Returns the average, minimal and maximal individual distance as diversity
* measure for the population. If the given metric argument is null, the * measure for the population. If the given metric argument is null, the
* euclidian distance of individual positions is used, which presumes that {@link AbstractEAIndividual.getDoublePosition(indy)} * euclidian distance of individual positions is used, which presumes that {@link AbstractEAIndividual#getDoublePosition(eva2.optimization.individuals.AbstractEAIndividual)}
* returns a valid double position for the individuals of the population. * returns a valid double position for the individuals of the population.
* This is of course rather expensive computationally. * This is of course rather expensive computationally.
* *
@ -2046,7 +2044,7 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
* Return a Pair of the individuals index and distance. If the population is * Return a Pair of the individuals index and distance. If the population is
* empty, a Pair of (-1,-1) is returned. * empty, a Pair of (-1,-1) is returned.
* *
* @param pos * @param refIndy
* @param pop * @param pop
* @param closestOrFarthest if true, the closest individual is retrieved, * @param closestOrFarthest if true, the closest individual is retrieved,
* otherwise the farthest * otherwise the farthest
@ -2073,8 +2071,8 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
* population. * population.
* *
* @param indy * @param indy
* @param pop
* @param d * @param d
* @param metric
* @return true if d(indy,pop)<=d, else false * @return true if d(indy,pop)<=d, else false
*/ */
public boolean isWithinPopDist(AbstractEAIndividual indy, double d, InterfaceDistanceMetric metric) { public boolean isWithinPopDist(AbstractEAIndividual indy, double d, InterfaceDistanceMetric metric) {
@ -2140,7 +2138,6 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
* *
* @param criterion * @param criterion
* @return * @return
* @see AbstractEAIndidivual.getDoublePosition(individual)
*/ */
public double[] getCenterWeighted(AbstractSelProb selProb, int criterion, boolean obeyConst) { public double[] getCenterWeighted(AbstractSelProb selProb, int criterion, boolean obeyConst) {
selProb.computeSelectionProbability(this, "Fitness", obeyConst); selProb.computeSelectionProbability(this, "Fitness", obeyConst);
@ -2162,7 +2159,7 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
* Search for the closest individual to the indexed individual within the * Search for the closest individual to the indexed individual within the
* population. Return its index or -1 if none could be found. * population. Return its index or -1 if none could be found.
* *
* @param indy * @param neighborIndex
* @return closest neighbor (euclidian measure) of the given individual in * @return closest neighbor (euclidian measure) of the given individual in
* the given population * the given population
*/ */
@ -2309,8 +2306,8 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
* true and the individuals are out of range, they are projected into the * true and the individuals are out of range, they are projected into the
* range by force. * range by force.
* *
* @param modRange * @param range
* @param b * @param forceRange
*/ */
public void updateRange(double[][] range, boolean forceRange) { public void updateRange(double[][] range, boolean forceRange) {
for (int i = 0; i < size(); i++) { for (int i = 0; i < size(); i++) {
@ -2337,19 +2334,6 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
public String initMethodTipText() { public String initMethodTipText() {
return "Define the initial sampling method. Note that anything other than inidividualDefault will override the individual initialization concerning the positions in solution space."; return "Define the initial sampling method. Note that anything other than inidividualDefault will override the individual initialization concerning the positions in solution space.";
} }
// /**
// * Check whether the population at the current state has been marked as
// * evaluated. This allows to avoid double evaluations.
// *
// * @return true if the population has been marked as evaluated in its current state, else false
// */
// public boolean isEvaluated() {
// if (evaluationTimeModCount != modCount) return false;
// Pair<Integer,Integer> hashes = getIndyHashSums();
//
// if (evaluationTimeHashes == null) return false;
// else return ((hashes.head().equals(evaluationTimeHashes.head())) && (hashes.tail().equals(evaluationTimeHashes.tail())) && (evaluationTimeModCount == modCount));
// }
/** /**
* Add the population data of a given population to this instance. Note that * Add the population data of a given population to this instance. Note that
@ -2435,7 +2419,7 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
* Return true if the current instance is a subset of the given population, * Return true if the current instance is a subset of the given population,
* otherwise false. * otherwise false.
* *
* @param offspring * @param set
* @return * @return
*/ */
public boolean isSubSet(Population set) { public boolean isSubSet(Population set) {

View File

@ -97,7 +97,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
private List<InterfaceAdditionalPopulationInformer> lastInformerList = null; private List<InterfaceAdditionalPopulationInformer> lastInformerList = null;
private PopulationInterface lastSols = null; private PopulationInterface lastSols = null;
private String textFieldDelimiter = "\t"; private String textFieldDelimiter = "\t";
private int defaultFitCriterion = 0; // TODO this might be a user chosen int - or even more elegantly, a MOSOConverter private int defaultFitCriterion = 0; // ToDo this might be a user chosen int - or even more elegantly, a MOSOConverter
protected StringSelection lastFieldSelection = null; // store the graph selection at the beginning of a multi-run protected StringSelection lastFieldSelection = null; // store the graph selection at the beginning of a multi-run
protected boolean lastIsShowFull = false; // store the "show full text" stats property at the beginning of a multi-run protected boolean lastIsShowFull = false; // store the "show full text" stats property at the beginning of a multi-run
@ -891,7 +891,6 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
} }
} }
return values; return values;
// return StringTools.concatValues(values, textFieldDelimiter);
} }
/** /**
@ -899,7 +898,6 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
* The length of this list depends on the field selection state. * The length of this list depends on the field selection state.
* *
* @param informerList * @param informerList
* @param pop
* @param metaInfo if non null, the meta info strings are returned in this list * @param metaInfo if non null, the meta info strings are returned in this list
* @return * @return
*/ */
@ -913,7 +911,6 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
if (metaInfo != null) { if (metaInfo != null) {
metaInfo.addAll(Arrays.asList(informer.getAdditionalDataInfo())); metaInfo.addAll(Arrays.asList(informer.getAdditionalDataInfo()));
} }
// hdr = hdr + "\t " + informer.getAdditionalDataHeader(pop);
} }
Iterator<String> hIter = headers.iterator(); Iterator<String> hIter = headers.iterator();
Iterator<String> mIter = (metaInfo != null) ? metaInfo.iterator() : null; Iterator<String> mIter = (metaInfo != null) ? metaInfo.iterator() : null;
@ -950,48 +947,15 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
return new Pair<>(statValuesString, statValues.toArray(new Object[statValues.size()])); return new Pair<>(statValuesString, statValues.toArray(new Object[statValues.size()]));
} }
// /**
// * Append additional informer informations to the given StringBuffer.
// *
// * @param informerList
// * @param pop
// * @param sbuf
// */
// protected Double[] appendAdditionalInfo(List<InterfaceAdditionalPopulationInformer> informerList, PopulationInterface pop, StringBuffer sbuf) {
// if (informerList != null) {
// ArrayList<Object> additionalObjects = new ArrayList<Object>(5);
//
// for (InterfaceAdditionalPopulationInformer informer : informerList) {
// additionalObjects.addAll(Arrays.asList(informer.getAdditionalDataValue(pop)));
// }
// String addInfo = StringTools.concatValues(additionalObjects, textFieldDelimiter);
// Double[] retVals = parseDoubles(additionalObjects);
// if (sbuf!=null) sbuf.append(addInfo);
// return retVals;
//
//// StringBuffer addBuffer = new StringBuffer();
//// for (InterfaceAdditionalPopulationInformer informer : informerList) {
//// addBuffer.append(" \t ");
//// addBuffer.append(informer.getAdditionalDataValue(pop));
//// }
//// String addInfo = addBuffer.toString().trim();
//// if (addInfo.startsWith("\t")) addInfo.substring(2); // remove first separator to avoid returning empty field as double
//// Double[] retVals = parseDoubles(addInfo, "\t");
//// if (sbuf!=null) sbuf.append(addInfo);
//// return retVals;
// }
// return null;
// }
/** /**
* @deprecated The method {@link #createNextGenerationPerformed(PopulationInterface, List)} should be used instead. * @deprecated The method {@link #createNextGenerationPerformed(eva2.optimization.population.PopulationInterface, eva2.optimization.strategies.InterfaceOptimizer, java.util.List)} should be used instead.
*/ */
@Override @Override
public synchronized void createNextGenerationPerformed(double[] bestfit, public synchronized void createNextGenerationPerformed(double[] bestFit,
double[] worstfit, int calls) { double[] worstFit, int calls) {
functionCalls = calls; functionCalls = calls;
currentBestFit = bestfit; currentBestFit = bestFit;
currentWorstFit = worstfit; currentWorstFit = worstFit;
currentBestFeasibleFit = null; currentBestFeasibleFit = null;
currentMeanFit = null; currentMeanFit = null;
@ -1044,7 +1008,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
* If the population returns a specific data array, this method is called instead of doing standard output * If the population returns a specific data array, this method is called instead of doing standard output
* *
* @param pop * @param pop
* @param informer * @param informerList
*/ */
public abstract void plotSpecificData(PopulationInterface pop, List<InterfaceAdditionalPopulationInformer> informerList); public abstract void plotSpecificData(PopulationInterface pop, List<InterfaceAdditionalPopulationInformer> informerList);

View File

@ -52,17 +52,16 @@ public class GenericStatistics implements Serializable {
states = new boolean[fields.length]; states = new boolean[fields.length];
for (int i = 0; i < fields.length; i++) { for (int i = 0; i < fields.length; i++) {
String desc = fields[i].toString(); //System.out.println("desc "+desc); String desc = fields[i].toString(); //System.out.println("desc "+desc);
int istransient = desc.indexOf("transient"); int isTransient = desc.indexOf("transient");
Object FieldValue = null; Object FieldValue = null;
if (istransient == -1 || fields[i].getName().equals("elementData")) { // the elementdatahack if (isTransient == -1 || fields[i].getName().equals("elementData")) { // the elementdatahack
fields[i].setAccessible(true); fields[i].setAccessible(true);
FieldValue = fields[i].get(target); FieldValue = fields[i].get(target);
} }
propertyNames[i] = fields[i].getName(); propertyNames[i] = fields[i].getName();
} }
} catch (Exception ex) { } catch (Exception ex) {
System.out.println("ERROR in GenericStatistics:" + ex.getMessage()); LOGGER.severe("GenericStatistics:" + ex.getMessage());
ex.printStackTrace();
} }
} }
@ -98,7 +97,6 @@ public class GenericStatistics implements Serializable {
* *
*/ */
public void setState(boolean[] x) { public void setState(boolean[] x) {
System.out.println("in statistics setState !!!!!!!!!!!!!!!!!!");
states = x; states = x;
} }
@ -149,8 +147,7 @@ public class GenericStatistics implements Serializable {
try { try {
fields = getDeclaredFields(target); fields = getDeclaredFields(target);
} catch (Exception ex) { } catch (Exception ex) {
System.out.println("ERROR in GenericStatistics:" + ex.getMessage()); LOGGER.severe("ERROR in GenericStatistics:" + ex.getMessage());
ex.printStackTrace();
} }
int index = 0; int index = 0;
for (int i = 0; i < fields.length; i++) { for (int i = 0; i < fields.length; i++) {
@ -159,11 +156,11 @@ public class GenericStatistics implements Serializable {
continue; continue;
} }
if (fields[i].getName().equals(propertyNames[n])) { if (fields[i].getName().equals(propertyNames[n])) {
String desc = fields[i].toString(); //System.out.println("desc "+desc); String desc = fields[i].toString();
int istransient = desc.indexOf("transient"); int isTransient = desc.indexOf("transient");
Object fieldValue = null; Object fieldValue = null;
if (istransient == -1 || fields[i].getName().equals("elementData")) { // the elementdatahack if (isTransient == -1 || fields[i].getName().equals("elementData")) { // the elementdatahack
fields[i].setAccessible(true); fields[i].setAccessible(true);
try { try {
fieldValue = fields[i].get(target); fieldValue = fields[i].get(target);
@ -175,8 +172,7 @@ public class GenericStatistics implements Serializable {
} }
index++; index++;
} catch (Exception ex) { } catch (Exception ex) {
System.out.println("ERROR in GenericStatistics:" + ex.getMessage()); LOGGER.severe("ERROR in GenericStatistics:" + ex.getMessage());
ex.printStackTrace();
} }
} }
break; break;

View File

@ -5,11 +5,10 @@ import eva2.tools.StringSelection;
/** /**
* An Enum to be used in the statistics classes for identifying data fields. * An Enum to be used in the statistics classes for identifying data fields.
* *
* @author mkron
* @see AbstractStatistics * @see AbstractStatistics
*/ */
public enum GraphSelectionEnum { public enum GraphSelectionEnum {
// DONT change this order, or the relation to AbstractStatistics will be lost // DON'T change this order, or the relation to AbstractStatistics will be lost
currentBest, meanFit, currentWorst, runBest, currentBestFeasible, runBestFeasible, currentBest, meanFit, currentWorst, runBest, currentBestFeasible, runBestFeasible,
avgEucPopDistance, maxEucPopDistance, avgPopMetricDist, maxPopMetricDist; avgEucPopDistance, maxEucPopDistance, avgPopMetricDist, maxPopMetricDist;

View File

@ -15,7 +15,7 @@ public interface InterfaceStatistics {
/** /**
* Initialize statistics computations. * Initialize statistics computations.
*/ */
void startOptimizationPerformed(String InfoString, int runnumber, Object params, List<InterfaceAdditionalPopulationInformer> informerList); // called from processor void startOptimizationPerformed(String infoString, int runNumber, Object params, List<InterfaceAdditionalPopulationInformer> informerList); // called from processor
/** /**
* Finalize statistics computations. * Finalize statistics computations.
@ -34,7 +34,7 @@ public interface InterfaceStatistics {
void createNextGenerationPerformed(PopulationInterface Pop, InterfaceOptimizer opt, List<InterfaceAdditionalPopulationInformer> informerList); void createNextGenerationPerformed(PopulationInterface Pop, InterfaceOptimizer opt, List<InterfaceAdditionalPopulationInformer> informerList);
void createNextGenerationPerformed(double[] bestfit, double[] worstfit, int calls); void createNextGenerationPerformed(double[] bestFit, double[] worstFit, int calls);
InterfaceStatisticsParameter getStatisticsParameter(); // called from moduleadapter InterfaceStatisticsParameter getStatisticsParameter(); // called from moduleadapter

View File

@ -183,7 +183,6 @@ public class OptimizationJobList extends PropertySelectableList<OptimizationJob>
genericArrayEditor.addUpperActionButton("Test Stats", al); genericArrayEditor.addUpperActionButton("Test Stats", al);
genericArrayEditor.addLowerActionButton("Save selected", sal); genericArrayEditor.addLowerActionButton("Save selected", sal);
// edi.addPopupItem("Reset selected", getClearSelectedActionListener(parent, jobList)); // this option does not make much sense - instead of deleting data, taking over the settings for a new run is more plausible
genericArrayEditor.addPopupItem("Reuse as current settings", getReuseActionListener(parent, jobList)); genericArrayEditor.addPopupItem("Reuse as current settings", getReuseActionListener(parent, jobList));
genericArrayEditor.setAdditionalCenterPane(createStatsPanel(jobList, genericArrayEditor)); genericArrayEditor.setAdditionalCenterPane(createStatsPanel(jobList, genericArrayEditor));
genericArrayEditor.setValue(jobList); genericArrayEditor.setValue(jobList);
@ -193,12 +192,11 @@ public class OptimizationJobList extends PropertySelectableList<OptimizationJob>
private static JComponent createStatsPanel(final OptimizationJobList jobList, final GenericArrayEditor edi) { private static JComponent createStatsPanel(final OptimizationJobList jobList, final GenericArrayEditor edi) {
JParaPanel pan = new JParaPanel(EvAStatisticalEvaluation.statsParams, "Statistics"); JParaPanel pan = new JParaPanel(EvAStatisticalEvaluation.statsParams, "Statistics");
JComponent paraPan = pan.makePanel(); return pan.makePanel();
return paraPan;
} }
private static ActionListener getReuseActionListener(final Component parent, final OptimizationJobList jobList) { private static ActionListener getReuseActionListener(final Component parent, final OptimizationJobList jobList) {
ActionListener al = new ActionListener() { return new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -215,11 +213,10 @@ public class OptimizationJobList extends PropertySelectableList<OptimizationJob>
} }
} }
}; };
return al;
} }
private static ActionListener getClearSelectedActionListener(final Component parent, final OptimizationJobList jobList) { private static ActionListener getClearSelectedActionListener(final Component parent, final OptimizationJobList jobList) {
ActionListener al = new ActionListener() { return new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -229,13 +226,12 @@ public class OptimizationJobList extends PropertySelectableList<OptimizationJob>
} }
} }
}; };
return al;
} }
/** /**
* Link a processor to the job list for re-scheduling jobs. * Link a processor to the job list for re-scheduling jobs.
* *
* @param processor * @param mod
*/ */
public void setModule(ModuleAdapter mod) { public void setModule(ModuleAdapter mod) {
module = mod; module = mod;
@ -251,16 +247,9 @@ public class OptimizationJobList extends PropertySelectableList<OptimizationJob>
} }
public boolean removeTextListener(InterfaceTextListener tListener) { public boolean removeTextListener(InterfaceTextListener tListener) {
if (listeners != null) { return listeners != null && listeners.remove(tListener);
return listeners.remove(tListener);
} else {
return false;
}
} }
/*
* (non-Javadoc) @see eva2.server.stat.InterfaceTextListener#print(java.lang.String)
*/
@Override @Override
public void print(String str) { public void print(String str) {
if (listeners != null) { if (listeners != null) {
@ -270,9 +259,6 @@ public class OptimizationJobList extends PropertySelectableList<OptimizationJob>
} }
} }
/*
* (non-Javadoc) @see eva2.server.stat.InterfaceTextListener#println(java.lang.String)
*/
@Override @Override
public void println(String str) { public void println(String str) {
if (listeners != null) { if (listeners != null) {

View File

@ -51,8 +51,8 @@ public class StatisticsDummy implements InterfaceStatistics, InterfaceTextListen
} }
@Override @Override
public void createNextGenerationPerformed(double[] bestfit, public void createNextGenerationPerformed(double[] bestFit,
double[] worstfit, int calls) { double[] worstFit, int calls) {
} }
@Override @Override
@ -93,9 +93,9 @@ public class StatisticsDummy implements InterfaceStatistics, InterfaceTextListen
} }
@Override @Override
public void startOptimizationPerformed(String InfoString, int runnumber, public void startOptimizationPerformed(String infoString, int runNumber,
Object params, List<InterfaceAdditionalPopulationInformer> informerList) { Object params, List<InterfaceAdditionalPopulationInformer> informerList) {
if (runnumber == 0) { if (runNumber == 0) {
bestIndividualAllover = null; bestIndividualAllover = null;
} }
bestRunIndy = null; bestRunIndy = null;

View File

@ -424,7 +424,6 @@ public class ANPSO extends NichePSO implements InterfaceOptimizer, InterfaceAddi
/** /**
* The returned array may contain null entries (for indies scheduled for reinitialization). * The returned array may contain null entries (for indies scheduled for reinitialization).
* *
* @param pop
* @return an array of references sorted according to the particle indices * @return an array of references sorted according to the particle indices
* (i.e. returnedArray[i] = individual with individualIndex i) * (i.e. returnedArray[i] = individual with individualIndex i)
*/ */
@ -569,11 +568,7 @@ public class ANPSO extends NichePSO implements InterfaceOptimizer, InterfaceAddi
useAsMainSwarm(newMainPop); useAsMainSwarm(newMainPop);
} }
/**********************************************************************************************************************
* Optimization
*/
/** /**
* @tested (non-Javadoc) @see javaeva.server.oa.go.Strategies.InterfaceOptimizer#optimize()
*/ */
@Override @Override
public void optimize() { public void optimize() {
@ -674,7 +669,6 @@ public class ANPSO extends NichePSO implements InterfaceOptimizer, InterfaceAddi
*/ */
/** /**
* @param size * @param size
* @tested ps
* sets the !initial! size of the mainswarm population * sets the !initial! size of the mainswarm population
* use this instead of getPopulation.setPopulationSize() * use this instead of getPopulation.setPopulationSize()
*/ */
@ -709,7 +703,6 @@ public class ANPSO extends NichePSO implements InterfaceOptimizer, InterfaceAddi
/** /**
* @return a population consisting of copies from the mainswarm and all subswarms. * @return a population consisting of copies from the mainswarm and all subswarms.
* @tested junit
* returns a population consisting of copies from the mainswarm and all subswarms * returns a population consisting of copies from the mainswarm and all subswarms
* (active and inactive, so the size of this Population is not necessarily constant). * (active and inactive, so the size of this Population is not necessarily constant).
* Especially important for the call back regarding the output file... * Especially important for the call back regarding the output file...
@ -748,7 +741,6 @@ public class ANPSO extends NichePSO implements InterfaceOptimizer, InterfaceAddi
/** /**
* @return array with copies of the gbest individuals * @return array with copies of the gbest individuals
* @tested junit
* returns the cloned global best individuals (ie best of all time) from every subswarm * returns the cloned global best individuals (ie best of all time) from every subswarm
*/ */
public Population getSubswarmRepresentatives() { public Population getSubswarmRepresentatives() {
@ -769,7 +761,6 @@ public class ANPSO extends NichePSO implements InterfaceOptimizer, InterfaceAddi
/** /**
* @return descriptive string of the elite * @return descriptive string of the elite
* @tested emp
* returns a string that lists the global best individuals (ie best of all time) from every subswarm * returns a string that lists the global best individuals (ie best of all time) from every subswarm
*/ */
public String getSubswarmRepresentativesAsString() { public String getSubswarmRepresentativesAsString() {
@ -782,7 +773,6 @@ public class ANPSO extends NichePSO implements InterfaceOptimizer, InterfaceAddi
} }
/** /**
* @tested plots all subswarms as connected lines to their respective best individual
*/ */
@Override @Override
protected void plotSubSwarms() { protected void plotSubSwarms() {
@ -845,7 +835,6 @@ public class ANPSO extends NichePSO implements InterfaceOptimizer, InterfaceAddi
* @return inactive particles with given index * @return inactive particles with given index
* (may return more than one particle for a given index because indizes are reused during deactivation * (may return more than one particle for a given index because indizes are reused during deactivation
* and the reinitialized particle may be deactivated again...) * and the reinitialized particle may be deactivated again...)
* @tested method not used any more
*/ */
public Vector<AbstractEAIndividual> getInactiveIndiesByParticleIndex(Integer index) { public Vector<AbstractEAIndividual> getInactiveIndiesByParticleIndex(Integer index) {
Vector<AbstractEAIndividual> indies = null; Vector<AbstractEAIndividual> indies = null;
@ -862,7 +851,6 @@ public class ANPSO extends NichePSO implements InterfaceOptimizer, InterfaceAddi
/** /**
* @return The name of the algorithm * @return The name of the algorithm
* @tested nn
* This method will return a naming String * This method will return a naming String
*/ */
@Override @Override
@ -1031,22 +1019,6 @@ public class ANPSO extends NichePSO implements InterfaceOptimizer, InterfaceAddi
return representatives; return representatives;
} }
/*
public String[] getAdditionalDataHeader(PopulationInterface pop) {
return new String[]{"mainSwarmSize","numActSpec","numArchived", "archivedMedCorr"};
}
public Object[] getAdditionalDataValue(PopulationInterface pop) {
int actSwarms = countActiveSubswarms();
double medCor = (getSubswarmRepresentatives(true)).getCorrelations()[3]; // median correlation of best indies of inactive subswarms
return new Object[]{getMainSwarm().getPopulation().size(),
actSwarms,
(getSubSwarms().size()-actSwarms),
medCor};
}
*/
/** /**
* Return the median correlation of the best individuals of the given set of swarms. * Return the median correlation of the best individuals of the given set of swarms.
*/ */

View File

@ -195,7 +195,7 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial
} }
isEmpty = (isEmpty && (result[i] == 0)); isEmpty = (isEmpty && (result[i] == 0));
} }
// single parent! dont add another one // single parent! don't add another one
} }
return result; return result;
@ -250,7 +250,7 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial
} }
isEmpty = (isEmpty && (result[i] == 0)); isEmpty = (isEmpty && (result[i] == 0));
} }
// single parent! dont add another one // single parent! don't add another one
} }
return result; return result;
@ -538,8 +538,7 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial
optimizationProblem.evaluate(children); optimizationProblem.evaluate(children);
/** /**
* MdP: added a reevalutation mechanism for dynamically changing * Re-evalutation mechanism for dynamically changing problems
* problems
*/ */
if (isReEvaluate()) { if (isReEvaluate()) {
for (int i = 0; i < this.population.size(); i++) { for (int i = 0; i < this.population.size(); i++) {
@ -594,8 +593,7 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial
/** /**
* MdP: added a reevalutation mechanism for dynamically changing * Reevalutation mechanism for dynamically changing problems
* problems
*/ */
if (isReEvaluate()) { if (isReEvaluate()) {
nextDoomed = -1; nextDoomed = -1;

View File

@ -1,4 +1,4 @@
/** /**
* Base package of the project that contains globally important classes. * Base package of EvA2
*/ */
package eva2; package eva2;

View File

@ -56,7 +56,6 @@ public abstract class AbstractOptimizationProblem implements InterfaceOptimizati
population.incrFunctionCalls(); population.incrFunctionCalls();
semaphore.release(); semaphore.release();
} }
} }
/** /**
@ -68,7 +67,7 @@ public abstract class AbstractOptimizationProblem implements InterfaceOptimizati
*/ */
public static final String OLD_FITNESS_KEY = "oldFitness"; public static final String OLD_FITNESS_KEY = "oldFitness";
private int parallelthreads = 1; private int parallelThreads = 1;
protected AbstractEAIndividual template = null; protected AbstractEAIndividual template = null;
@ -83,11 +82,11 @@ public abstract class AbstractOptimizationProblem implements InterfaceOptimizati
public abstract Object clone(); public abstract Object clone();
public int getParallelThreads() { public int getParallelThreads() {
return parallelthreads; return parallelThreads;
} }
public void setParallelThreads(int parallelthreads) { public void setParallelThreads(int parallelThreads) {
this.parallelthreads = parallelthreads; this.parallelThreads = parallelThreads;
} }
public String parallelThreadsTipText() { public String parallelThreadsTipText() {
@ -120,10 +119,10 @@ public abstract class AbstractOptimizationProblem implements InterfaceOptimizati
AbstractEAIndividual tmpIndy; AbstractEAIndividual tmpIndy;
evaluatePopulationStart(population); evaluatePopulationStart(population);
if (this.parallelthreads > 1) { if (this.parallelThreads > 1) {
Vector<AbstractEAIndividual> queue = new Vector<>(population.size()); Vector<AbstractEAIndividual> queue = new Vector<>(population.size());
Semaphore sema = new Semaphore(0); Semaphore sema = new Semaphore(0);
ExecutorService pool = Executors.newFixedThreadPool(parallelthreads); ExecutorService pool = Executors.newFixedThreadPool(parallelThreads);
int cntIndies = 0; int cntIndies = 0;
for (; cntIndies < population.size(); cntIndies++) { for (; cntIndies < population.size(); cntIndies++) {
AbstractEAIndividual tmpindy = (AbstractEAIndividual) population.get(cntIndies); AbstractEAIndividual tmpindy = (AbstractEAIndividual) population.get(cntIndies);
@ -160,17 +159,14 @@ public abstract class AbstractOptimizationProblem implements InterfaceOptimizati
* *
* @param population * @param population
*/ */
public void evaluatePopulationStart(Population population) {}
public void evaluatePopulationStart(Population population) {
}
/** /**
* Empty thunk for implementation in subclasses. This is called after a population was evaluated. * Empty thunk for implementation in subclasses. This is called after a population was evaluated.
* *
* @param population * @param population
*/ */
public void evaluatePopulationEnd(Population population) { public void evaluatePopulationEnd(Population population) {}
}
/** /**
* This method evaluate a single individual and sets the fitness values * This method evaluate a single individual and sets the fitness values
@ -224,7 +220,7 @@ public abstract class AbstractOptimizationProblem implements InterfaceOptimizati
*/ */
@Override @Override
public Double getDoublePlotValue(Population pop) { public Double getDoublePlotValue(Population pop) {
return new Double(pop.getBestEAIndividual().getFitness(0)); return pop.getBestEAIndividual().getFitness(0);
} }
/** /**

View File

@ -40,17 +40,15 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipFile; import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream; import java.util.zip.ZipInputStream;
/** /**
* Loads resource file from directory OR jar file. Now it is easier possible to * Loads resource file from directory OR jar file. Now it is easier possible to
* access resource files in a directory structure or a .jar/.zip file. * access resource files in a directory structure or a .jar/.zip file.
* *
* @.author Marcel Kronfeld * @author Marcel Kronfeld
* @.author wegnerj * @author wegnerj
* @.author Robin Friedman, rfriedman@TriadTherapeutics.com * @author Robin Friedman, rfriedman@TriadTherapeutics.com
* @.author Gerd Mueller * @author Gerd Mueller
* @.license GPL * @license GPL
* @.cvsversion $Revision: 1.3 $, $Date: 2005/02/17 16:48:44 $
*/ */
public class BasicResourceLoader implements ResourceLoader { public class BasicResourceLoader implements ResourceLoader {
/** /**
@ -81,7 +79,7 @@ public class BasicResourceLoader implements ResourceLoader {
/** /**
* Description of the Method * Description of the Method
* *
* @param resourceFile Description of the Parameter * @param resourceFile Source file to read
* @return Description of the Return Value * @return Description of the Return Value
*/ */
public static List<String> readLines(String resourceFile) { public static List<String> readLines(String resourceFile) {
@ -91,8 +89,8 @@ public class BasicResourceLoader implements ResourceLoader {
/** /**
* Description of the Method * Description of the Method
* *
* @param resourceFile Description of the Parameter * @param resourceFile Source file to read
* @param ignoreComments Description of the Parameter * @param ignoreCommentedLines Whether to ignore commented lines
* @return Description of the Return Value * @return Description of the Return Value
*/ */
public static List<String> readLines(String resourceFile, public static List<String> readLines(String resourceFile,
@ -106,7 +104,7 @@ public class BasicResourceLoader implements ResourceLoader {
* @param resourceFile File to read * @param resourceFile File to read
* @param ignorePrefix array of prefixes which mark a line to be ignored * @param ignorePrefix array of prefixes which mark a line to be ignored
* @param lOffset offset of the first line to read * @param lOffset offset of the first line to read
* @param lCnt number of lines to read, if <= 0, all lines are read * @param lCnt number of lines to read, if less than 0, all lines are read
* @return List of lines which were read or null on an error * @return List of lines which were read or null on an error
*/ */
public static List<String> readLines(String resourceFile, public static List<String> readLines(String resourceFile,

View File

@ -1,210 +0,0 @@
package eva2.tools;
/**
* *******************************************************
* <p/>
* Class CubicSpline
* <p/>
* Class for performing an interpolation using a cubic spline
* setTabulatedArrays and interpolate adapted from Numerical Recipes in C
* <p/>
* WRITTEN BY: Mick Flanagan
* <p/>
* DATE: May 2002
* <p/>
* DOCUMENTATION:
* See Michael T Flanagan's JAVA library on-line web page:
* CubicSpline.html
* <p/>
* ********************************************************
*/
public class CubicSpline {
private int npoints = 0; // no. of tabulated points
private double[] y = null; // y=f(x) tabulated function
private double[] x = null; // x in tabulated function f(x)
private double[] y2 = null; // returned second derivatives of y
private double yp1 = 0.0D; // first derivative at point one
// default value = zero (natural spline)
private double ypn = 0.0D; // first derivative at point n
// default value = zero (natural spline)
// Constructors
// Constructor with data arrays initialised to arrays x and y
public CubicSpline(double[] x, double[] y) {
this.npoints = x.length;
if (this.npoints != y.length) {
throw new IllegalArgumentException("Arrays x and y are of different length");
}
this.x = new double[npoints];
this.y = new double[npoints];
this.y2 = new double[npoints];
for (int i = 0; i < this.npoints; i++) {
this.x[i] = x[i];
this.y[i] = y[i];
}
this.yp1 = 1e40;
this.ypn = 1e40;
}
// Constructor with data arrays initialised to zero
// Primarily for use by BiCubicSpline
CubicSpline(int npoints) {
this.npoints = npoints;
this.x = new double[npoints];
this.y = new double[npoints];
this.y2 = new double[npoints];
this.yp1 = 1e40;
this.ypn = 1e40;
}
// METHODS
// Resets the x y data arrays - primarily for use in BiCubicSpline
public void resetData(double[] x, double[] y) {
if (x.length != y.length) {
throw new IllegalArgumentException("Arrays x and y are of different length");
}
if (this.npoints != x.length) {
throw new IllegalArgumentException("Original array length not matched by new array length");
}
for (int i = 0; i < this.npoints; i++) {
this.x[i] = x[i];
this.y[i] = y[i];
}
}
// Returns a new CubicSpline setting array lengths to n and all array values to zero with natural spline default
// Primarily for use in BiCubicSpline
public static CubicSpline zero(int n) {
CubicSpline aa = new CubicSpline(n);
return aa;
}
// Create a one dimensional array of cubic spline objects of length n each of array length m
// Primarily for use in BiCubicSpline
public static CubicSpline[] oneDarray(int n, int m) {
CubicSpline[] a = new CubicSpline[n];
for (int i = 0; i < n; i++) {
a[i] = CubicSpline.zero(m);
}
return a;
}
// Enters the first derivatives of the cubic spline at
// the first and last point of the tabulated data
// Overrides a natural spline
public void setDerivLimits(double yp1, double ypn) {
this.yp1 = yp1;
this.ypn = ypn;
}
// Returns the internal array of second derivatives
public double[] getDeriv() {
return this.y2;
}
// Calculates the second derivatives of the tabulated function
// for use by the cubic spline interpolation method (.interpolate)
public void calcDeriv() {
int i = 0, k = 0;
double p = 0.0D, qn = 0.0D, sig = 0.0D, un = 0.0D;
double[] u = new double[npoints];
if (yp1 > 0.99e30) {
y2[0] = u[0] = 0.0;
} else {
this.y2[0] = -0.5;
u[0] = (3.0 / (this.x[1] - this.x[0])) * ((this.y[1] - this.y[0]) / (this.x[1] - this.x[0]) - this.yp1);
}
for (i = 1; i <= this.npoints - 2; i++) {
sig = (this.x[i] - this.x[i - 1]) / (this.x[i + 1] - this.x[i - 1]);
p = sig * this.y2[i - 1] + 2.0;
this.y2[i] = (sig - 1.0) / p;
u[i] = (this.y[i + 1] - this.y[i]) / (this.x[i + 1] - this.x[i]) - (this.y[i] - this.y[i - 1]) / (this.x[i] - this.x[i - 1]);
u[i] = (6.0 * u[i] / (this.x[i + 1] - this.x[i - 1]) - sig * u[i - 1]) / p;
}
if (this.ypn > 0.99e30) {
qn = un = 0.0;
} else {
qn = 0.5;
un = (3.0 / (this.x[npoints - 1] - this.x[this.npoints - 2])) * (this.ypn - (this.y[this.npoints - 1] - this.y[this.npoints - 2]) / (this.x[this.npoints - 1] - x[this.npoints - 2]));
}
this.y2[this.npoints - 1] = (un - qn * u[this.npoints - 2]) / (qn * this.y2[this.npoints - 2] + 1.0);
for (k = this.npoints - 2; k >= 0; k--) {
this.y2[k] = this.y2[k] * this.y2[k + 1] + u[k];
}
}
// INTERPOLATE
// Returns an interpolated value of y for a value of xfrom a tabulated function y=f(x)
// after the data has been entered via a constructor and the derivatives calculated and
// stored by calcDeriv().
public double interpolate(double xx) {
int klo = 0, khi = 0, k = 0;
double h = 0.0D, b = 0.0D, a = 0.0D, yy = 0.0D;
if (xx < this.x[0] || xx > this.x[this.npoints - 1]) {
// System.out.println(xx);
xx -= 0.00001;
//throw new IllegalArgumentException("x is outside the range of data points");
}
klo = 0;
khi = this.npoints - 1;
while (khi - klo > 1) {
k = (khi + klo) >> 1;
if (this.x[k] > xx) {
khi = k;
} else {
klo = k;
}
}
h = this.x[khi] - this.x[klo];
if (h == 0.0) {
throw new IllegalArgumentException("Two values of x are identical");
} else {
a = (this.x[khi] - xx) / h;
b = (xx - this.x[klo]) / h;
yy = a * this.y[klo] + b * this.y[khi] + ((a * a * a - a) * this.y2[klo] + (b * b * b - b) * this.y2[khi]) * (h * h) / 6.0;
}
return yy;
}
// Returns an interpolated value of y for a value of x (xx) from a tabulated function y=f(x)
// after the derivatives (deriv) have been calculated independently of and calcDeriv().
public static double interpolate(double xx, double[] x, double[] y, double[] deriv) {
if (((x.length != y.length) || (x.length != deriv.length)) || (y.length != deriv.length)) {
throw new IllegalArgumentException("array lengths are not all equal");
}
int n = x.length;
int klo = 0, khi = 0, k = 0;
double h = 0.0D, b = 0.0D, a = 0.0D, yy = 0.0D;
klo = 0;
khi = n - 1;
while (khi - klo > 1) {
k = (khi + klo) >> 1;
if (x[k] > xx) {
khi = k;
} else {
klo = k;
}
}
h = x[khi] - x[klo];
if (h == 0.0) {
throw new IllegalArgumentException("Two values of x are identical");
} else {
a = (x[khi] - xx) / h;
b = (xx - x[klo]) / h;
yy = a * y[klo] + b * y[khi] + ((a * a * a - a) * deriv[klo] + (b * b * b - b) * deriv[khi]) * (h * h) / 6.0;
}
return yy;
}
}

View File

@ -1,21 +1,7 @@
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 java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Hashtable; import java.util.Hashtable;
@ -25,7 +11,7 @@ import java.util.zip.ZipInputStream;
/** /**
* JarResources: JarResources maps all resources included in a * JarResources: JarResources maps all resources included in a
* Zip or Jar file. Additionaly, it provides a method to extract one * Zip or Jar file. Additionally, it provides a method to extract one
* as a blob. * as a blob.
*/ */
public final class JarResources { public final class JarResources {
@ -34,15 +20,15 @@ public final class JarResources {
public boolean debugOn = false; public boolean debugOn = false;
// jar resource mapping tables // jar resource mapping tables
private Hashtable htSizes = new Hashtable(); private Hashtable<String,Integer> htSizes = new Hashtable<>();
private Hashtable htJarContents = new Hashtable(); private Hashtable<String,byte[]> htJarContents = new Hashtable<>();
// a jar file // a jar file
private String jarFileName; private String jarFileName;
/** /**
* creates a JarResources. It extracts all resources from a Jar * creates a JarResources. It extracts all resources from a Jar
* into an internal hashtable, keyed by resource names. * into an internal HashTable, keyed by resource names.
* *
* @param jarFileName a jar or zip file * @param jarFileName a jar or zip file
*/ */
@ -57,7 +43,7 @@ public final class JarResources {
* @param name a resource name. * @param name a resource name.
*/ */
public byte[] getResource(String name) { public byte[] getResource(String name) {
return (byte[]) htJarContents.get(name); return htJarContents.get(name);
} }
/** /**
@ -73,15 +59,15 @@ public final class JarResources {
if (debugOn) { if (debugOn) {
System.out.println(dumpZipEntry(ze)); System.out.println(dumpZipEntry(ze));
} }
htSizes.put(ze.getName(), new Integer((int) ze.getSize())); htSizes.put(ze.getName(), (int) ze.getSize());
} }
zf.close(); zf.close();
// extract resources and put them into the hashtable. // extract resources and put them into the HashTable.
FileInputStream fis = new FileInputStream(jarFileName); FileInputStream fis = new FileInputStream(jarFileName);
BufferedInputStream bis = new BufferedInputStream(fis); BufferedInputStream bis = new BufferedInputStream(fis);
ZipInputStream zis = new ZipInputStream(bis); ZipInputStream zis = new ZipInputStream(bis);
ZipEntry ze = null; ZipEntry ze;
while ((ze = zis.getNextEntry()) != null) { while ((ze = zis.getNextEntry()) != null) {
if (ze.isDirectory()) { if (ze.isDirectory()) {
continue; continue;
@ -94,11 +80,11 @@ public final class JarResources {
int size = (int) ze.getSize(); int size = (int) ze.getSize();
// -1 means unknown size. // -1 means unknown size.
if (size == -1) { if (size == -1) {
size = ((Integer) htSizes.get(ze.getName())).intValue(); size = htSizes.get(ze.getName());
} }
byte[] b = new byte[size]; byte[] b = new byte[size];
int rb = 0; int rb = 0;
int chunk = 0; int chunk;
while ((size - rb) > 0) { while ((size - rb) > 0) {
chunk = zis.read(b, rb, size - rb); chunk = zis.read(b, rb, size - rb);
if (chunk == -1) { if (chunk == -1) {
@ -106,7 +92,7 @@ public final class JarResources {
} }
rb += chunk; rb += chunk;
} }
// add to internal resource hashtable // add to internal resource HashTable
htJarContents.put(ze.getName(), b); htJarContents.put(ze.getName(), b);
if (debugOn) { if (debugOn) {
System.out.println( System.out.println(
@ -118,8 +104,6 @@ public final class JarResources {
} }
} catch (NullPointerException e) { } catch (NullPointerException e) {
System.out.println("done."); System.out.println("done.");
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -144,15 +128,15 @@ public final class JarResources {
} }
sb.append(ze.getName()); sb.append(ze.getName());
sb.append("\t"); sb.append("\t");
sb.append("" + ze.getSize()); sb.append("").append(ze.getSize());
if (ze.getMethod() == ZipEntry.DEFLATED) { if (ze.getMethod() == ZipEntry.DEFLATED) {
sb.append("/" + ze.getCompressedSize()); sb.append("/").append(ze.getCompressedSize());
} }
return (sb.toString()); return (sb.toString());
} }
/** /**
* Is a test driver. Given a jar file and a resource name, it trys to * Is a test driver. Given a jar file and a resource name, it tries to
* extract the resource and then tells us whether it could or not. * extract the resource and then tells us whether it could or not.
* <p/> * <p/>
* <strong>Example</strong> * <strong>Example</strong>
@ -185,4 +169,4 @@ public final class JarResources {
} }
} }
} // End of JarResources class. }

View File

@ -41,7 +41,6 @@ public class ReflectPackage {
* *
* @param pckgname * @param pckgname
* @return * @return
* @throws ClassNotFoundException
*/ */
public static int getClassesFromFilesFltr(HashSet<Class> set, String path, String pckgname, boolean includeSubs, Class reqSuperCls) { public static int getClassesFromFilesFltr(HashSet<Class> set, String path, String pckgname, boolean includeSubs, Class reqSuperCls) {
try { try {
@ -91,9 +90,7 @@ public class ReflectPackage {
} else { } else {
cntAdded += addClass(set, cls); cntAdded += addClass(set, cls);
} }
} catch (Exception e) { } catch (Exception | Error e) {
System.err.println("ReflectPackage: Couldnt get Class from jar for " + pckgname + '.' + file + ": " + e.getMessage());
} catch (Error e) {
System.err.println("ReflectPackage: Couldnt get Class from jar for " + pckgname + '.' + file + ": " + e.getMessage()); System.err.println("ReflectPackage: Couldnt get Class from jar for " + pckgname + '.' + file + ": " + e.getMessage());
} }
} else if (includeSubs) { } else if (includeSubs) {

View File

@ -4,7 +4,6 @@ package eva2.tools;
* This serves as activation state of one item in an array of Tags * This serves as activation state of one item in an array of Tags
* identified by integer IDs. String names should be unique as well as integer IDs. * identified by integer IDs. String names should be unique as well as integer IDs.
*/ */
public class SelectedTag implements java.io.Serializable { public class SelectedTag implements java.io.Serializable {
protected int selectedId; protected int selectedId;
protected Tag[] tags; protected Tag[] tags;
@ -30,7 +29,7 @@ public class SelectedTag implements java.io.Serializable {
* Constructor from a String array, creates a Tag array where the IDs correspond to array index. * Constructor from a String array, creates a Tag array where the IDs correspond to array index.
* *
* @param selID * @param selID
* @param tagStrings * @param strings
*/ */
public SelectedTag(int selID, String... strings) { public SelectedTag(int selID, String... strings) {
init(selID, strings); init(selID, strings);

View File

@ -26,7 +26,6 @@ public class SerializedObject implements Serializable {
* *
* @param obj the Object to serialize. * @param obj the Object to serialize.
* @throws IOException * @throws IOException
* @throws Exception if the object is not Serializable.
*/ */
public SerializedObject(Object obj) throws IOException { public SerializedObject(Object obj) throws IOException {
this(obj, false); this(obj, false);
@ -38,7 +37,6 @@ public class SerializedObject implements Serializable {
* @param obj the Object to serialize. * @param obj the Object to serialize.
* @param compress true if the object should be stored compressed. * @param compress true if the object should be stored compressed.
* @throws IOException * @throws IOException
* @throws Exception if the object is not Serializable.
*/ */
public SerializedObject(Object obj, boolean compress) throws IOException { public SerializedObject(Object obj, boolean compress) throws IOException {
isCompressed = compress; isCompressed = compress;
@ -51,8 +49,7 @@ public class SerializedObject implements Serializable {
* @param obj the Object to serialize * @param obj the Object to serialize
* @param compress true if the object should be compressed. * @param compress true if the object should be compressed.
* @return the byte array containing the serialized object. * @return the byte array containing the serialized object.
* @throws IOException * @throws IOException if the object is not Serializable.
* @throws Exception if the object is not Serializable.
*/ */
protected static byte[] toByteArray(Object obj, boolean compress) throws IOException { protected static byte[] toByteArray(Object obj, boolean compress) throws IOException {
ByteArrayOutputStream bo = new ByteArrayOutputStream(); ByteArrayOutputStream bo = new ByteArrayOutputStream();
@ -86,10 +83,6 @@ public class SerializedObject implements Serializable {
Object result = oi.readObject(); Object result = oi.readObject();
oi.close(); oi.close();
return result; return result;
// } catch (Exception ex) {
// ex.printStackTrace();
// }
// return null;
} }
/** /**

View File

@ -22,8 +22,8 @@ public final class StringTools {
* Returns a HTML formatted String, in which each line is at most lineBreak * Returns a HTML formatted String, in which each line is at most lineBreak
* symbols long. * symbols long.
* *
* @param string * @param string Text to be converted to HTML
* @param lineBreak * @param lineBreak Number of characters until a line break is inserted
* @return * @return
*/ */
public static String toHTML(String string, int lineBreak) { public static String toHTML(String string, int lineBreak) {
@ -129,7 +129,7 @@ public final class StringTools {
|| (!ignoreCase && (args[i].equals(keys[k])))) { // if the key was found || (!ignoreCase && (args[i].equals(keys[k])))) { // if the key was found
found = true; found = true;
if (arities[k] == 0) { if (arities[k] == 0) {
values[k] = new String("true"); values[k] = "true";
} // and its zero-arity, just return true as its value } // and its zero-arity, just return true as its value
else { // else return an array of size arity with following strings else { // else return an array of size arity with following strings
try { try {
@ -302,7 +302,7 @@ public final class StringTools {
* Concatenate a list of Objects using a given delimiter string. * Concatenate a list of Objects using a given delimiter string.
* The objects are converted to strings using the BeanInspector class. * The objects are converted to strings using the BeanInspector class.
* *
* @param headlineFields * @param objects
* @param delim * @param delim
* @return * @return
*/ */
@ -337,7 +337,7 @@ public final class StringTools {
/** /**
* Remove or replace blanks, braces, etc. from a string for use as a file name. * Remove or replace blanks, braces, etc. from a string for use as a file name.
* *
* @param predefName * @param str
* @return * @return
*/ */
public static String simplifySymbols(String str) { public static String simplifySymbols(String str) {

View File

@ -7,8 +7,6 @@ import java.util.List;
/** /**
* Collection of miscellaneous static helper methods. * Collection of miscellaneous static helper methods.
*
* @author mkron
*/ */
public final class ToolBox { public final class ToolBox {
/** /**
@ -20,28 +18,29 @@ public final class ToolBox {
/** /**
* Convert all items of an enum to a String array and append the given String array at the end. * Convert all items of an enum to a String array and append the given String array at the end.
* *
* @param additionals * @param e The enum to convert
* @param additionalValues Additional string values
* @return * @return
*/ */
public static String[] appendEnumAndArray(Enum<?> e, String[] additionals) { public static String[] appendEnumAndArray(Enum<?> e, String[] additionalValues) {
Enum<?>[] fields = e.getClass().getEnumConstants(); Enum<?>[] fields = e.getClass().getEnumConstants();
int enumLen = fields.length; //values().length; int enumLen = fields.length; //values().length;
int len = enumLen + additionals.length; int len = enumLen + additionalValues.length;
String[] ret = new String[len]; String[] ret = new String[len];
for (int i = 0; i < enumLen; i++) { for (int i = 0; i < enumLen; i++) {
ret[i] = fields[i].toString(); ret[i] = fields[i].toString();
} }
System.arraycopy(additionals, enumLen - enumLen, ret, enumLen, ret.length - enumLen); System.arraycopy(additionalValues, enumLen - enumLen, ret, enumLen, ret.length - enumLen);
return ret; return ret;
} }
/** /**
* Append two String arrays. If both are null, null is returned. * Append two String arrays. If both are null, null is returned.
* *
* @param strArr1 * @param strArr1 First array
* @param strArr2 * @param strArr2 Second array
* @return * @return A single array containing the merged set of values
*/ */
public static String[] appendArrays(String[] strArr1, String[] strArr2) { public static String[] appendArrays(String[] strArr1, String[] strArr2) {
if (strArr1 == null) { if (strArr1 == null) {
@ -82,16 +81,15 @@ public final class ToolBox {
* converted double arrays whenever this is directly possible, or null otherwise. * converted double arrays whenever this is directly possible, or null otherwise.
* The length of the array will correspond to the length of the given list. * The length of the array will correspond to the length of the given list.
* *
* @param l * @param l A list of Objects
* @return * @return A double array containing the converted object values
* @see BeanInspector.toString(Object)
*/ */
public static Double[] parseDoubles(List<Object> l) { public static Double[] parseDoubles(List<Object> l) {
ArrayList<Double> vals = new ArrayList<>(); ArrayList<Double> values = new ArrayList<>();
for (Object o : l) { for (Object o : l) {
vals.add(toDouble(o)); // null if unsuccessfull values.add(toDouble(o)); // null if unsuccessful
} }
return vals.toArray(new Double[vals.size()]); return values.toArray(new Double[values.size()]);
} }
/** /**
@ -107,8 +105,7 @@ public final class ToolBox {
return ((Number) o).doubleValue(); return ((Number) o).doubleValue();
} else { } else {
try { try {
Double d = Double.parseDouble(BeanInspector.toString(o)); return Double.parseDouble(BeanInspector.toString(o));
return d;
} catch (Exception e) { } catch (Exception e) {
// Here be dragons! // Here be dragons!
} }
@ -120,9 +117,8 @@ public final class ToolBox {
* For an array of objects, generate an array of Double which contains the * For an array of objects, generate an array of Double which contains the
* converted double arrays whenever this is directly possible, or null otherwise. * converted double arrays whenever this is directly possible, or null otherwise.
* *
* @param l * @param os
* @return * @return Double array containing the converted object values.
* @see BeanInspector.toString(Object)
*/ */
public static Double[] parseDoubles(Object[] os) { public static Double[] parseDoubles(Object[] os) {
Double[] vals = new Double[os.length]; Double[] vals = new Double[os.length];

View File

@ -94,10 +94,10 @@ public class DArea extends JComponent implements DParent, Printable {
/** /**
* method 'adds' a certain border around the contained rectangle that means * method 'adds' a certain border around the contained rectangle that means
* that it takes the old border and takes the maxima of the old and the new * that it takes the old border and takes the maximum of the old and the new
* values * values
* *
* @param clip the java.awt.Insets object of the new clip * @param b The border
*/ */
@Override @Override
public void addDBorder(DBorder b) { public void addDBorder(DBorder b) {
@ -146,7 +146,7 @@ public class DArea extends JComponent implements DParent, Printable {
/** /**
* returns the measures of the DArea The DMeasures object calculates the * returns the measures of the DArea The DMeasures object calculates the
* different coodinates and contains a Graphics object to paint the * different coordinates and contains a Graphics object to paint the
* DElements of the area * DElements of the area
* *
* @return the measures of the DArea * @return the measures of the DArea
@ -424,8 +424,7 @@ public class DArea extends JComponent implements DParent, Printable {
* @param pf the @see java.awt.print.PageFormat * @param pf the @see java.awt.print.PageFormat
* @param pi the page index * @param pi the page index
* @return int @see java.awt.print.Printable * @return int @see java.awt.print.Printable
* @see java.awt.print.Printable and * @see java.awt.print.Printable
* @see java.awt.print.PrintJob
*/ */
@Override @Override
public int print(Graphics g, PageFormat pf, int pi) { public int print(Graphics g, PageFormat pf, int pi) {

View File

@ -97,7 +97,7 @@ public class DArray implements DIntDoubleMap {
* the given image value becomes the image of (highest source value + 1) * the given image value becomes the image of (highest source value + 1)
* *
* @param image the new image value * @param image the new image value
* @return <code>true<\code> when the minmal or the maximal image value * @return <code>true</code> when the minimal or the maximal image value
* has been changed by this method call, else it returns * has been changed by this method call, else it returns
* <code>false</code> @see #getMinImageValue(), #getMaxImageValue() * <code>false</code> @see #getMinImageValue(), #getMaxImageValue()
*/ */

View File

@ -6,7 +6,7 @@ import java.awt.*;
* <code>DComponent</code> is the mother of all objects which can be displayed * <code>DComponent</code> is the mother of all objects which can be displayed
* by a <code>DArea</code> object, even when it would be also enough to * by a <code>DArea</code> object, even when it would be also enough to
* implement the <code>DElement</code> interface to an class * implement the <code>DElement</code> interface to an class
* <p/> * </p>
* DComponent is abstract because the paint method has to be overridden * DComponent is abstract because the paint method has to be overridden
*/ */
public abstract class DComponent implements DElement { public abstract class DComponent implements DElement {

View File

@ -16,7 +16,7 @@ public interface DIntDoubleMap {
* *
* @param source the preimage of the image * @param source the preimage of the image
* @param image the new image of the source value * @param image the new image of the source value
* @return <code>true<\code> when the minmal or the maximal image value * @return <code>true</code> when the minimal or the maximal image value
* has been changed by this method call, else it returns * has been changed by this method call, else it returns
* <code>false</code> @see #getMinImageValue(), #getMaxImageValue() * <code>false</code> @see #getMinImageValue(), #getMaxImageValue()
*/ */
@ -34,7 +34,7 @@ public interface DIntDoubleMap {
* the image of the highest source value + 1 should be the given image value * the image of the highest source value + 1 should be the given image value
* *
* @param image the new image value * @param image the new image value
* @return <code>true<\code> when the minmal or the maximal image value * @return <code>true</code> when the minimal or the maximal image value
* has been changed by this method call, else it returns * has been changed by this method call, else it returns
* <code>false</code> @see #getMinImageValue(), #getMaxImageValue() * <code>false</code> @see #getMinImageValue(), #getMaxImageValue()
*/ */
@ -51,23 +51,23 @@ public interface DIntDoubleMap {
* returns the maximal image value * returns the maximal image value
* *
* @return the maximal image value * @return the maximal image value
* @throw an IllegalArgumentException when it has no image values * @throws IllegalArgumentException when it has no image values
*/ */
double getMaxImageValue(); double getMaxImageValue();
/** /**
* returns the minimal image value * returns the minimal image value
* *
* @return the minmal image value * @return the minimal image value
* @throw an IllegalArgumentException when it has no image values * @throws IllegalArgumentException when it has no image values
*/ */
double getMinImageValue(); double getMinImageValue();
/** /**
* returns the minimal image value * returns the minimal image value
* *
* @return the minmal image value * @return the minimal image value
* @throw an IllegalArgumentException when it has no image values * @throws IllegalArgumentException when it has no image values
*/ */
double getMinPositiveImageValue(); double getMinPositiveImageValue();
@ -76,7 +76,7 @@ public interface DIntDoubleMap {
* when at least one of them has changed * when at least one of them has changed
* *
* @return <code>true</code> when either the maximal image value or the * @return <code>true</code> when either the maximal image value or the
* minmal image value has changed * minimal image value has changed
*/ */
boolean restore(); boolean restore();

View File

@ -202,7 +202,7 @@ public class DRectangle extends DComponent {
/** /**
* method resizes the rectangle to insert p * method resizes the rectangle to insert p
* *
* @param the dPoint p to insert * @param p the dPoint p to insert
* @return true when the size of the rectangle changed * @return true when the size of the rectangle changed
*/ */
public boolean insert(DPoint p) { public boolean insert(DPoint p) {

View File

@ -144,8 +144,8 @@ public class ScaledBorder implements Border {
} }
/** /**
* constructor creates a new <code>ScaledBorder<code/> * constructor creates a new <code>ScaledBorder</code>
* surrounded by the specified <code>Border<code/> * surrounded by the specified <code>Border</code>
*/ */
public ScaledBorder(Border outer) { public ScaledBorder(Border outer) {
outerBorder = outer; outerBorder = outer;
@ -171,7 +171,6 @@ public class ScaledBorder implements Border {
/** /**
* method sets the differences between source x-values of the displayed values * method sets the differences between source x-values of the displayed values
* *
* @see setAutoScaleX().
* If scale functions are used there might be a difference between the shown values * If scale functions are used there might be a difference between the shown values
* and the source values * and the source values
*/ */
@ -183,7 +182,6 @@ public class ScaledBorder implements Border {
/** /**
* method sets the differences between source y-values of the displayed values * method sets the differences between source y-values of the displayed values
* *
* @see setAutoScaleY().
* If scale functions are used there might be a difference between the shown values * If scale functions are used there might be a difference between the shown values
* and the source values * and the source values
*/ */

View File

@ -3,9 +3,12 @@ package eva2.tools.math.Jama.util;
public class Maths { public class Maths {
/** /**
* sqrt(a^2 + b^2) without under/overflow. * * sqrt(a^2 + b^2) without under/overflow.
*
* @param a
* @param b
* @return
*/ */
public static double hypot(double a, double b) { public static double hypot(double a, double b) {
double r; double r;
double aa = Math.abs(a); double aa = Math.abs(a);

View File

@ -20,11 +20,11 @@
* 13.08.1999 thread implementation due to ActiveX thread problem (0.05) * * 13.08.1999 thread implementation due to ActiveX thread problem (0.05) *
* 15.08.1999 intruduced 2 locking mechanisms to lock the engine and * * 15.08.1999 introduced 2 locking mechanisms to lock the engine and *
* wait for data to be return to caller. (0.06) * * wait for data to be return to caller. (0.06) *
* 16.08.1999 wait for all engine calls to return savely (0.06a)* * 16.08.1999 wait for all engine calls to return safely (0.06a)*
* 29.08.1999 made all engine routines "synchronized" (0.07) * * 29.08.1999 made all engine routines "synchronized" (0.07) *
@ -113,15 +113,10 @@
package eva2.tools.matlab; package eva2.tools.matlab;
// **** Thread programming. Notify and start and stop **** // **** Thread programming. Notify and start and stop ****
// Look at // Look at
// file:///e%7C/jdk1.2/docs/guide/misc/threadPrimitiveDeprecation.html // file:///e%7C/jdk1.2/docs/guide/misc/threadPrimitiveDeprecation.html
// on how to suspend, start, stop, interrupt a thread safely in JDK1.2.x
// on how to suspend, start, stop, interrupt a thread savely in JDK1.2.x
// The problem is ActiveX: one only can make calls to the engine library // The problem is ActiveX: one only can make calls to the engine library
// (especially engEvalString) from ONE single thread. // (especially engEvalString) from ONE single thread.
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;

View File

@ -1,4 +1,4 @@
package eva2.client; package eva2.util;
import eva2.gui.editor.GenericObjectEditor; import eva2.gui.editor.GenericObjectEditor;
@ -6,8 +6,6 @@ import eva2.gui.editor.GenericObjectEditor;
* This Runnable just requests a number of classes as does the * This Runnable just requests a number of classes as does the
* GenericObjectEditor so that they are loaded into the system cache. It can be * GenericObjectEditor so that they are loaded into the system cache. It can be
* done at startup time and accelerates later reloading. * done at startup time and accelerates later reloading.
*
* @author mkron
*/ */
public class ClassPreloader implements Runnable { public class ClassPreloader implements Runnable {

View File

@ -1,4 +1,4 @@
package eva2.client; package eva2.util;
import eva2.gui.LoggingPanel; import eva2.gui.LoggingPanel;

View File

@ -1 +1,4 @@
/**
* Utility classes used in EvA
*/
package eva2.util; package eva2.util;