Some 2400 @Overrides added... LAWL
This commit is contained in:
Fabian Becker 2013-01-29 13:37:25 +00:00
parent d3ea94fe5c
commit c16a592a26
511 changed files with 4461 additions and 1587 deletions

View File

@ -40,22 +40,19 @@ import java.util.BitSet;
import java.util.List; import java.util.List;
/** /**
* <p> * <p> The OptimizerFactory allows quickly creating some optimizers without
* The OptimizerFactory allows quickly creating some optimizers without thinking * thinking much about parameters. You can access a runnable Optimization thread
* much about parameters. You can access a runnable Optimization thread and * and directly start it, or access its fully prepared GOParameter instance,
* directly start it, or access its fully prepared GOParameter instance, change * change some parameters, and start it then. </p> <p> On the other hand this
* some parameters, and start it then. * class provides an almost complete list of all currently available
* </p> * optimization procedures in EvA2. The arguments passed to the methods
* <p> * initialize the respective optimization procedure. To perform an optimization
* On the other hand this class provides an almost complete list of all * one has to do the following:
* currently available optimization procedures in EvA2. The arguments passed to * <code>
* the methods initialize the respective optimization procedure. To perform an
* optimization one has to do the following: <code>
* InterfaceOptimizer optimizer = OptimizerFactory.createCertainOptimizer(arguments); * InterfaceOptimizer optimizer = OptimizerFactory.createCertainOptimizer(arguments);
* EvaluationTerminator terminator = new EvaluationTerminator(numOfFitnessCalls); * EvaluationTerminator terminator = new EvaluationTerminator(numOfFitnessCalls);
* while (!terminator.isTerminated(optimizer.getPopulation())) optimizer.optimize(); * while (!terminator.isTerminated(optimizer.getPopulation())) optimizer.optimize();
* </code> * </code> </p>
* </p>
* *
* @version 0.1 * @version 0.1
* @since 2.0 * @since 2.0
@ -64,42 +61,25 @@ import java.util.List;
* @date 17.04.2007 * @date 17.04.2007
*/ */
public class OptimizerFactory { public class OptimizerFactory {
private static InterfaceTerminator userTerm = null; private static InterfaceTerminator userTerm = null;
public final static int STD_ES = 1; public final static int STD_ES = 1;
public final static int CMA_ES = 2; public final static int CMA_ES = 2;
public final static int STD_GA = 3; public final static int STD_GA = 3;
public final static int PSO = 4; public final static int PSO = 4;
public final static int DE = 5; public final static int DE = 5;
public final static int TRIBES = 6; public final static int TRIBES = 6;
public final static int RANDOM = 7; public final static int RANDOM = 7;
public final static int HILLCL = 8; public final static int HILLCL = 8;
public final static int CBN_ES = 9; public final static int CBN_ES = 9;
public final static int CL_HILLCL = 10; public final static int CL_HILLCL = 10;
public final static int CMA_ES_IPOP = 11; public final static int CMA_ES_IPOP = 11;
public final static int CBN_GA = 12; public final static int CBN_GA = 12;
public final static int PBIL = 13; public final static int PBIL = 13;
public final static int MOGA = 14; public final static int MOGA = 14;
public final static int defaultFitCalls = 10000; public final static int defaultFitCalls = 10000;
public final static int randSeed = 0; public final static int randSeed = 0;
private static OptimizerRunnable lastRunnable = null; private static OptimizerRunnable lastRunnable = null;
private static final int cbnDefaultHaltingWindowLength = new ClusterBasedNichingEA().getHaltingWindow(); private static final int cbnDefaultHaltingWindowLength = new ClusterBasedNichingEA().getHaltingWindow();
private static final double cbnDefaultHaltingWindowEpsilon = new ClusterBasedNichingEA().getEpsilonBound(); private static final double cbnDefaultHaltingWindowEpsilon = new ClusterBasedNichingEA().getEpsilonBound();
private static final double cbnDefaultClusterSigma = 0.1; private static final double cbnDefaultClusterSigma = 0.1;
@ -136,7 +116,9 @@ public class OptimizerFactory {
de.addPopulationChangedEventListener(listener); de.addPopulationChangedEventListener(listener);
de.init(); de.init();
if (listener!=null) listener.registerPopulationStateChanged(de.getPopulation(), ""); if (listener != null) {
listener.registerPopulationStateChanged(de.getPopulation(), "");
}
return de; return de;
} }
@ -146,8 +128,8 @@ public class OptimizerFactory {
* *
* @param mu * @param mu
* @param lambda * @param lambda
* @param plus * @param plus if true this operator uses elitism otherwise a comma
* if true this operator uses elitism otherwise a comma strategy. * strategy.
* @param mutationoperator * @param mutationoperator
* @param pm * @param pm
* @param crossoveroperator * @param crossoveroperator
@ -171,14 +153,16 @@ public class OptimizerFactory {
* *
* @param mu * @param mu
* @param lambda * @param lambda
* @param plus * @param plus if true this operator uses elitism otherwise a comma
* if true this operator uses elitism otherwise a comma strategy. * strategy.
* @param mutationoperator * @param mutationoperator
* @param pm * @param pm
* @param crossoveroperator * @param crossoveroperator
* @param pc * @param pc
* @param incPopSizeFact factor by which to inrease lambda ro restart, default is 2 * @param incPopSizeFact factor by which to inrease lambda ro restart,
* @param stagThresh if the fitness changes below this value during a stagnation phase, a restart is initiated * default is 2
* @param stagThresh if the fitness changes below this value during a
* stagnation phase, a restart is initiated
* @param problem * @param problem
* @param listener * @param listener
* @return An optimization algorithm that employs an IPOP-ES. * @return An optimization algorithm that employs an IPOP-ES.
@ -211,7 +195,9 @@ public class OptimizerFactory {
theES.setProblem(problem); theES.setProblem(problem);
theES.init(); theES.init();
if (listener != null) listener.registerPopulationStateChanged(theES.getPopulation(), ""); if (listener != null) {
listener.registerPopulationStateChanged(theES.getPopulation(), "");
}
return theES; return theES;
} }
@ -229,7 +215,7 @@ public class OptimizerFactory {
* @param listener * @param listener
* @return An optimization algorithm that employes an genetic algorithm. * @return An optimization algorithm that employes an genetic algorithm.
*/ */
public static final GeneticAlgorithm createGeneticAlgorithm( public static GeneticAlgorithm createGeneticAlgorithm(
InterfaceMutation mut, double pm, InterfaceCrossover cross, InterfaceMutation mut, double pm, InterfaceCrossover cross,
double pc, InterfaceSelection select, int popsize, double pc, InterfaceSelection select, int popsize,
AbstractOptimizationProblem problem, AbstractOptimizationProblem problem,
@ -247,7 +233,9 @@ public class OptimizerFactory {
ga.addPopulationChangedEventListener(listener); ga.addPopulationChangedEventListener(listener);
ga.init(); ga.init();
if (listener!=null) listener.registerPopulationStateChanged(ga.getPopulation(), ""); if (listener != null) {
listener.registerPopulationStateChanged(ga.getPopulation(), "");
}
return ga; return ga;
} }
@ -257,16 +245,14 @@ public class OptimizerFactory {
* multi-objective selection method within the specific optimizer. This uses * multi-objective selection method within the specific optimizer. This uses
* a standard archiving strategy (NSGAII) and InformationRetrievalInserting. * a standard archiving strategy (NSGAII) and InformationRetrievalInserting.
* *
* @param subOpt * @param subOpt the specific optimizer to use
* the specific optimizer to use * @param archiveSize maximum size of the archive
* @param archiveSize
* maximum size of the archive
* @param problem * @param problem
* @param listener * @param listener
* @return An optimization algorithm that employs a multi-objective * @return An optimization algorithm that employs a multi-objective
* optimizer * optimizer
*/ */
public static final MultiObjectiveEA createMultiObjectiveEA( public static MultiObjectiveEA createMultiObjectiveEA(
InterfaceOptimizer subOpt, int archiveSize, InterfaceOptimizer subOpt, int archiveSize,
AbstractOptimizationProblem problem, AbstractOptimizationProblem problem,
InterfacePopulationChangedEventListener listener) { InterfacePopulationChangedEventListener listener) {
@ -276,7 +262,13 @@ public class OptimizerFactory {
listener); listener);
} }
public static final GOParameters standardMOGA(AbstractOptimizationProblem problem) { /**
* This method creates a multi-objective EA optimizer.
*
* @param problem
* @return
*/
public static GOParameters standardMOGA(AbstractOptimizationProblem problem) {
GOParameters gaParams = standardGA(problem); GOParameters gaParams = standardGA(problem);
int archiveSize = 100; int archiveSize = 100;
int popSize = 100; int popSize = 100;
@ -288,20 +280,16 @@ public class OptimizerFactory {
* This method creates a multi-objective EA optimizer. Remember to set a * This method creates a multi-objective EA optimizer. Remember to set a
* multi-objective selection method within the specific optimizer. * multi-objective selection method within the specific optimizer.
* *
* @param subOpt * @param subOpt the specific optimizer to use
* the specific optimizer to use * @param archiving the archiving strategy collecting the pareto front
* @param archiving * @param archiveSize maximum size of the archive
* the archiving strategy collecting the pareto front * @param infoRetrieval information retrieval strategy
* @param archiveSize
* maximum size of the archive
* @param infoRetrieval
* information retrieval strategy
* @param problem * @param problem
* @param listener * @param listener
* @return An optimization algorithm that employs a multi-objective * @return An optimization algorithm that employs a multi-objective
* optimizer * optimizer
*/ */
public static final MultiObjectiveEA createMultiObjectiveEA( public static MultiObjectiveEA createMultiObjectiveEA(
InterfaceOptimizer subOpt, InterfaceArchiving archiving, InterfaceOptimizer subOpt, InterfaceArchiving archiving,
int archiveSize, InterfaceInformationRetrieval infoRetrieval, int archiveSize, InterfaceInformationRetrieval infoRetrieval,
AbstractOptimizationProblem problem, AbstractOptimizationProblem problem,
@ -320,7 +308,7 @@ public class OptimizerFactory {
* @param problem * @param problem
* @return An optimization algorithm that performs gradient descent. * @return An optimization algorithm that performs gradient descent.
*/ */
public static final GradientDescentAlgorithm createGradientDescent( public static GradientDescentAlgorithm createGradientDescent(
AbstractOptimizationProblem problem) { AbstractOptimizationProblem problem) {
System.err.println("Currently not implemented!"); System.err.println("Currently not implemented!");
@ -339,16 +327,15 @@ public class OptimizerFactory {
} }
/** /**
* This method creates a Hill Climber algorithm with a default fixed-size mutation. * This method creates a Hill Climber algorithm with a default fixed-size
* mutation.
* *
* @param pop * @param pop The size of the population
* The size of the population * @param problem The problem to be optimized
* @param problem
* The problem to be optimized
* @param listener * @param listener
* @return An optimization procedure that performes hill climbing. * @return An optimization procedure that performs hill climbing.
*/ */
public static final HillClimbing createHillClimber(int popSize, public static HillClimbing createHillClimber(int popSize,
AbstractOptimizationProblem problem, AbstractOptimizationProblem problem,
InterfacePopulationChangedEventListener listener) { InterfacePopulationChangedEventListener listener) {
return createHillClimber(popSize, new MutateESFixedStepSize(0.2), problem, listener); return createHillClimber(popSize, new MutateESFixedStepSize(0.2), problem, listener);
@ -357,14 +344,12 @@ public class OptimizerFactory {
/** /**
* This method creates a Hill Climber algorithm. * This method creates a Hill Climber algorithm.
* *
* @param pop * @param pop The size of the population
* The size of the population * @param problem The problem to be optimized
* @param problem
* The problem to be optimized
* @param listener * @param listener
* @return An optimization procedure that performes hill climbing. * @return An optimization procedure that performs hill climbing.
*/ */
public static final HillClimbing createHillClimber(int popSize, InterfaceMutation mutator, public static HillClimbing createHillClimber(int popSize, InterfaceMutation mutator,
AbstractOptimizationProblem problem, AbstractOptimizationProblem problem,
InterfacePopulationChangedEventListener listener) { InterfacePopulationChangedEventListener listener) {
@ -379,7 +364,9 @@ public class OptimizerFactory {
hc.setProblem(problem); hc.setProblem(problem);
hc.init(); hc.init();
if (listener != null) listener.registerPopulationStateChanged(hc.getPopulation(), ""); if (listener != null) {
listener.registerPopulationStateChanged(hc.getPopulation(), "");
}
return hc; return hc;
} }
@ -393,7 +380,7 @@ public class OptimizerFactory {
* @param listener * @param listener
* @return An optimization procedure that performes the random walk. * @return An optimization procedure that performes the random walk.
*/ */
public static final MonteCarloSearch createMonteCarlo( public static MonteCarloSearch createMonteCarlo(
AbstractOptimizationProblem problem, int popsize, AbstractOptimizationProblem problem, int popsize,
InterfacePopulationChangedEventListener listener) { InterfacePopulationChangedEventListener listener) {
@ -406,14 +393,16 @@ public class OptimizerFactory {
mc.setProblem(problem); mc.setProblem(problem);
mc.init(); mc.init();
if (listener != null) listener.registerPopulationStateChanged(mc.getPopulation(), ""); if (listener != null) {
listener.registerPopulationStateChanged(mc.getPopulation(), "");
}
return mc; return mc;
} }
/** /**
* This method performs a particle swarm optimization. Standard topologies are * This method performs a particle swarm optimization. Standard topologies
* linear, grid and star. * are linear, grid and star.
* *
* @param problem * @param problem
* @param mut * @param mut
@ -427,7 +416,7 @@ public class OptimizerFactory {
* @return An optimization algorithm that performs particle swarm * @return An optimization algorithm that performs particle swarm
* optimization. * optimization.
*/ */
public static final ParticleSwarmOptimization createParticleSwarmOptimization( public static ParticleSwarmOptimization createParticleSwarmOptimization(
AbstractOptimizationProblem problem, int popsize, double phi1, AbstractOptimizationProblem problem, int popsize, double phi1,
double phi2, double speedLim, PSOTopologyEnum selectedTopology, int topologyRange, double phi2, double speedLim, PSOTopologyEnum selectedTopology, int topologyRange,
InterfacePopulationChangedEventListener listener) { InterfacePopulationChangedEventListener listener) {
@ -448,7 +437,9 @@ public class OptimizerFactory {
pso.addPopulationChangedEventListener(listener); pso.addPopulationChangedEventListener(listener);
pso.init(); pso.init();
if (listener != null) listener.registerPopulationStateChanged(pso.getPopulation(), ""); if (listener != null) {
listener.registerPopulationStateChanged(pso.getPopulation(), "");
}
return pso; return pso;
} }
@ -460,15 +451,13 @@ public class OptimizerFactory {
* *
* @param problem * @param problem
* @param popsize * @param popsize
* @param alpha * @param alpha The parameter for the linear cooling
* The parameter for the linear cooling * @param temperature The initial temperature
* @param temperature
* The initial temperature
* @param mut * @param mut
* @param listener * @param listener
* @return Returns an optimizer that performs simulated annealing. * @return Returns an optimizer that performs simulated annealing.
*/ */
public static final SimulatedAnnealing createSimulatedAnnealing( public static SimulatedAnnealing createSimulatedAnnealing(
AbstractOptimizationProblem problem, int popsize, double alpha, AbstractOptimizationProblem problem, int popsize, double alpha,
double temperature, InterfaceMutation mut, double temperature, InterfaceMutation mut,
InterfacePopulationChangedEventListener listener) { InterfacePopulationChangedEventListener listener) {
@ -485,7 +474,9 @@ public class OptimizerFactory {
sa.addPopulationChangedEventListener(listener); sa.addPopulationChangedEventListener(listener);
sa.init(); sa.init();
if (listener!=null) listener.registerPopulationStateChanged(sa.getPopulation(), ""); if (listener != null) {
listener.registerPopulationStateChanged(sa.getPopulation(), "");
}
return sa; return sa;
} }
@ -503,7 +494,7 @@ public class OptimizerFactory {
* @param listener * @param listener
* @return * @return
*/ */
public static final PopulationBasedIncrementalLearning createPBIL( public static PopulationBasedIncrementalLearning createPBIL(
double learningRate, double mutateSigma, double mutationRate, double learningRate, double mutateSigma, double mutationRate,
int positiveSamples, InterfaceSelection selection, int popsize, int positiveSamples, InterfaceSelection selection, int popsize,
AbstractOptimizationProblem problem, InterfacePopulationChangedEventListener listener) { AbstractOptimizationProblem problem, InterfacePopulationChangedEventListener listener) {
@ -520,7 +511,9 @@ public class OptimizerFactory {
pbil.addPopulationChangedEventListener(listener); pbil.addPopulationChangedEventListener(listener);
pbil.setProblem(problem); pbil.setProblem(problem);
if (listener != null) listener.registerPopulationStateChanged(pbil.getPopulation(), ""); if (listener != null) {
listener.registerPopulationStateChanged(pbil.getPopulation(), "");
}
return pbil; return pbil;
} }
@ -541,10 +534,9 @@ public class OptimizerFactory {
} }
// /////////////////////////// constructing a default OptimizerRunnable // /////////////////////////// constructing a default OptimizerRunnable
/** /**
* For an optimizer identifier, return the corresponding default parameter set including * For an optimizer identifier, return the corresponding default parameter
* initialization (thats why the problem is required). * set including initialization (thats why the problem is required).
* *
* @param optType optimizer identifier * @param optType optimizer identifier
* @param problem corresponding optimization problem * @param problem corresponding optimization problem
@ -600,8 +592,9 @@ public class OptimizerFactory {
} }
/** /**
* Produce a runnable optimizer from a strategy identifier, a problem instance and with a given * Produce a runnable optimizer from a strategy identifier, a problem
* number of fitness calls to be performed. Output is written to a file if the prefix String is given. * instance and with a given number of fitness calls to be performed. Output
* is written to a file if the prefix String is given.
* *
* @param optType * @param optType
* @param problem * @param problem
@ -616,10 +609,11 @@ public class OptimizerFactory {
} }
/** /**
* Produce a runnable optimizer from a strategy identifier, a problem instance and with a given * Produce a runnable optimizer from a strategy identifier, a problem
* terminator. Output is written to a file if the prefix String is given. If the terminator is null * instance and with a given terminator. Output is written to a file if the
* the current user-defined terminator will be used and if none is set, the default number of fitness * prefix String is given. If the terminator is null the current
* calls will be performed. * user-defined terminator will be used and if none is set, the default
* number of fitness calls will be performed.
* *
* @param optType * @param optType
* @param problem * @param problem
@ -634,15 +628,18 @@ public class OptimizerFactory {
GOParameters params = getParams(optType, problem); GOParameters params = getParams(optType, problem);
if (params != null) { if (params != null) {
opt = new OptimizerRunnable(params, outputFilePrefix); opt = new OptimizerRunnable(params, outputFilePrefix);
if (terminator != null) opt.getGOParams().setTerminator(terminator); if (terminator != null) {
else opt.getGOParams().setTerminator(getTerminator()); opt.getGOParams().setTerminator(terminator);
} else {
opt.getGOParams().setTerminator(getTerminator());
}
} }
return opt; return opt;
} }
/** /**
* Produce a runnable optimizer from a GOParameters instance. Output is written to a file if the * Produce a runnable optimizer from a GOParameters instance. Output is
* prefix String is given. * written to a file if the prefix String is given.
* *
* @param params * @param params
* @param outputFilePrefix * @param outputFilePrefix
@ -654,8 +651,10 @@ public class OptimizerFactory {
// /////////////////////////// constructing a default OptimizerRunnable // /////////////////////////// constructing a default OptimizerRunnable
/** /**
* Produce a runnable optimizer from a strategy identifier, a problem instance and with the current * Produce a runnable optimizer from a strategy identifier, a problem
* static terminator in use. Output is written to a file if the prefix String is given. * instance and with the current static terminator in use. Output is written
* to a file if the prefix String is given.
*
* @see #getOptRunnable(int, AbstractOptimizationProblem, int, String) * @see #getOptRunnable(int, AbstractOptimizationProblem, int, String)
* @param optType * @param optType
* @param problem * @param problem
@ -668,17 +667,22 @@ public class OptimizerFactory {
} }
/** /**
* Return the current user-defined terminator or, if none was set, the default terminator. * Return the current user-defined terminator or, if none was set, the
* default terminator.
* *
* @return the current default terminator * @return the current default terminator
*/ */
public static InterfaceTerminator getTerminator() { public static InterfaceTerminator getTerminator() {
if (OptimizerFactory.userTerm != null) return OptimizerFactory.userTerm; if (OptimizerFactory.userTerm != null) {
else return makeDefaultTerminator(); return OptimizerFactory.userTerm;
} else {
return makeDefaultTerminator();
}
} }
/** /**
* Return the number of evaluations performed during the last run or -1 if unavailable. * Return the number of evaluations performed during the last run or -1 if
* unavailable.
* *
* @return the number of evaluations performed during the last run or -1 * @return the number of evaluations performed during the last run or -1
*/ */
@ -687,7 +691,6 @@ public class OptimizerFactory {
} }
// /////////////////////// Creating default strategies // /////////////////////// Creating default strategies
/** /**
* Use lambda, default random seed and terminator to produce GOParameters. * Use lambda, default random seed and terminator to produce GOParameters.
* *
@ -703,7 +706,8 @@ public class OptimizerFactory {
/** /**
* Use default random seed and terminator for a parameter set. * Use default random seed and terminator for a parameter set.
* *
* @see #makeParams(InterfaceOptimizer, int, AbstractOptimizationProblem, long, InterfaceTerminator) * @see #makeParams(InterfaceOptimizer, int, AbstractOptimizationProblem,
* long, InterfaceTerminator)
* @param opt * @param opt
* @param popSize * @param popSize
* @param problem * @param problem
@ -716,7 +720,8 @@ public class OptimizerFactory {
/** /**
* Use default random seed and the population size of the optimizer. * Use default random seed and the population size of the optimizer.
* *
* @see #makeParams(InterfaceOptimizer, int, AbstractOptimizationProblem, long, InterfaceTerminator) * @see #makeParams(InterfaceOptimizer, int, AbstractOptimizationProblem,
* long, InterfaceTerminator)
* @param opt * @param opt
* @param popSize * @param popSize
* @param problem * @param problem
@ -725,11 +730,13 @@ public class OptimizerFactory {
public static GOParameters makeParams(InterfaceOptimizer opt, AbstractOptimizationProblem problem, InterfaceTerminator term) { public static GOParameters makeParams(InterfaceOptimizer opt, AbstractOptimizationProblem problem, InterfaceTerminator term) {
return makeParams(opt, opt.getPopulation().getTargetSize(), problem, randSeed, term); return makeParams(opt, opt.getPopulation().getTargetSize(), problem, randSeed, term);
} }
/** /**
* Set the population size, initialize the population and return a parameter structure containing all * Set the population size, initialize the population and return a parameter
* given parts. * structure containing all given parts.
* *
* @see #makeParams(InterfaceOptimizer, Population, AbstractOptimizationProblem, long, InterfaceTerminator) * @see #makeParams(InterfaceOptimizer, Population,
* AbstractOptimizationProblem, long, InterfaceTerminator)
* @param opt * @param opt
* @param popSize * @param popSize
* @param problem * @param problem
@ -747,8 +754,9 @@ public class OptimizerFactory {
} }
/** /**
* Create a GOParameters instance and prepare it with the given arguments. The result can be * Create a GOParameters instance and prepare it with the given arguments.
* modified and then used to create an OptimizerRunnable, which of course can simply be run. * The result can be modified and then used to create an OptimizerRunnable,
* which of course can simply be run.
* *
* @see OptimizerRunnable * @see OptimizerRunnable
* @param opt * @param opt
@ -777,9 +785,10 @@ public class OptimizerFactory {
} }
public static OptimizerRunnable optimize(OptimizerRunnable runnable) { public static OptimizerRunnable optimize(OptimizerRunnable runnable) {
if (runnable == null) if (runnable == null) {
return null; return null;
new Thread(runnable).run(); }
new Thread(runnable).start();
lastRunnable = runnable; lastRunnable = runnable;
return runnable; return runnable;
} }
@ -815,6 +824,7 @@ public class OptimizerFactory {
/** /**
* Start a runnable optimizer in a concurrent thread. * Start a runnable optimizer in a concurrent thread.
*
* @param runnable * @param runnable
* @return the started runnable * @return the started runnable
*/ */
@ -890,7 +900,6 @@ public class OptimizerFactory {
return (runnable != null) ? runnable.getDoubleSolution() : null; return (runnable != null) ? runnable.getDoubleSolution() : null;
} }
public static IndividualInterface optimizeToInd(GOParameters params) { public static IndividualInterface optimizeToInd(GOParameters params) {
OptimizerRunnable runnable = optimize(new OptimizerRunnable(params, OptimizerRunnable runnable = optimize(new OptimizerRunnable(params,
false)); false));
@ -941,7 +950,6 @@ public class OptimizerFactory {
} }
///////////////////////////// post processing ///////////////////////////// post processing
public static Population postProcess(PostProcessMethod method, int steps, double sigma, int nBest) { public static Population postProcess(PostProcessMethod method, int steps, double sigma, int nBest) {
return (lastRunnable == null) ? null : postProcess(lastRunnable, return (lastRunnable == null) ? null : postProcess(lastRunnable,
new PostProcessParams(method, steps, sigma, nBest)); new PostProcessParams(method, steps, sigma, nBest));
@ -1005,8 +1013,8 @@ public class OptimizerFactory {
} }
/** /**
* Post process the given runnable with given parameters. Return the solution set * Post process the given runnable with given parameters. Return the
* as a vector of BitSets. The runnable will not be stored. * solution set as a vector of BitSets. The runnable will not be stored.
* *
* @param runnable * @param runnable
* @param ppp * @param ppp
@ -1044,8 +1052,9 @@ public class OptimizerFactory {
} }
/** /**
* Post process the given runnable with given parameters. Return the solution set * Post process the given runnable with given parameters. Return the
* as a vector of double arrays. The runnable will not be stored. * solution set as a vector of double arrays. The runnable will not be
* stored.
* *
* @param runnable * @param runnable
* @param ppp * @param ppp
@ -1083,8 +1092,9 @@ public class OptimizerFactory {
} }
/** /**
* Post process the given runnable with given parameters. Return the solution set * Post process the given runnable with given parameters. Return the
* as a vector of AbstractEAIndividuals. The runnable will not be stored. * solution set as a vector of AbstractEAIndividuals. The runnable will not
* be stored.
* *
* @param runnable * @param runnable
* @param ppp * @param ppp
@ -1115,27 +1125,27 @@ public class OptimizerFactory {
} }
/** /**
* Add a new InterfaceTerminator to the current user-defined optimizer in a boolean combination. * Add a new InterfaceTerminator to the current user-defined optimizer in a
* The old and the given terminator will be combined as in (TOld && TNew) if * boolean combination. The old and the given terminator will be combined as
* bAnd is true, and as in (TOld || TNew) if bAnd is false. * in (TOld && TNew) if bAnd is true, and as in (TOld || TNew) if bAnd is
* If there was no user-defined terminator (or it was set to null) the new one is used without conjunction. * false. If there was no user-defined terminator (or it was set to null)
* the new one is used without conjunction.
* *
* @param newTerm * @param newTerm a new InterfaceTerminator instance
* a new InterfaceTerminator instance * @param bAnd indicate the boolean combination
* @param bAnd
* indicate the boolean combination
*/ */
public static void addTerminator(InterfaceTerminator newTerm, boolean bAnd) { public static void addTerminator(InterfaceTerminator newTerm, boolean bAnd) {
if (OptimizerFactory.userTerm == null) if (OptimizerFactory.userTerm == null) {
OptimizerFactory.userTerm = newTerm; OptimizerFactory.userTerm = newTerm;
else } else {
setTerminator(new CombinedTerminator(OptimizerFactory.userTerm, setTerminator(new CombinedTerminator(OptimizerFactory.userTerm,
newTerm, bAnd)); newTerm, bAnd));
} }
}
/** /**
* Convenience method setting an EvaluationTerminator with the given * Convenience method setting an EvaluationTerminator with the given number
* number of evaluations. * of evaluations.
* *
* @param maxEvals * @param maxEvals
*/ */
@ -1145,6 +1155,7 @@ public class OptimizerFactory {
/** /**
* Return the termination message of the last runnable, if available. * Return the termination message of the last runnable, if available.
*
* @return * @return
*/ */
public static String terminatedBecause() { public static String terminatedBecause() {
@ -1153,34 +1164,35 @@ public class OptimizerFactory {
///////////////////////////// default parameters ///////////////////////////// default parameters
/** /**
* Create a standard multi-start hill-climber parameter set with 50 initial individuals. * Create a standard multi-start hill-climber parameter set with 50 initial
* individuals.
* *
* @return a standard multi-start hill-climber * @return a standard multi-start hill-climber
*/ */
public static final GOParameters hillClimbing( public static GOParameters hillClimbing(
AbstractOptimizationProblem problem) { AbstractOptimizationProblem problem) {
return hillClimbing(problem, 50); return hillClimbing(problem, 50);
} }
/** /**
* Create a standard multi-start hill-climber parameter set with the given number of * Create a standard multi-start hill-climber parameter set with the given
* individuals. * number of individuals.
* *
* @return a standard multi-start hill-climber * @return a standard multi-start hill-climber
*/ */
public static final GOParameters hillClimbing( public static GOParameters hillClimbing(
AbstractOptimizationProblem problem, int popSize) { AbstractOptimizationProblem problem, int popSize) {
return makeParams(new HillClimbing(), popSize, problem, randSeed, getTerminator()); return makeParams(new HillClimbing(), popSize, problem, randSeed, getTerminator());
} }
public static final GOParameters monteCarlo( public static GOParameters monteCarlo(
AbstractOptimizationProblem problem) { AbstractOptimizationProblem problem) {
return makeParams(new MonteCarloSearch(), 50, problem, randSeed, getTerminator()); return makeParams(new MonteCarloSearch(), 50, problem, randSeed, getTerminator());
} }
/** /**
* Create a generic Clustering-based Niching EA with given parameters. Uses ClusteringDensityBased as * Create a generic Clustering-based Niching EA with given parameters. Uses
* a default clustering algorithm. * ClusteringDensityBased as a default clustering algorithm.
* *
* @param problem * @param problem
* @param opt * @param opt
@ -1191,24 +1203,25 @@ public class OptimizerFactory {
* @param popSize * @param popSize
* @return * @return
*/ */
public static final GOParameters createCbn(AbstractOptimizationProblem problem, InterfaceOptimizer opt, public static GOParameters createCbn(AbstractOptimizationProblem problem, InterfaceOptimizer opt,
double clusterSigma, int minClustSize, int maxSpecSize, int haltingWindowLength, double haltingWindowEpsilon, int popSize) { double clusterSigma, int minClustSize, int maxSpecSize, int haltingWindowLength, double haltingWindowEpsilon, int popSize) {
return createCbn(problem, opt, new ClusteringDensityBased(clusterSigma, minClustSize), maxSpecSize, return createCbn(problem, opt, new ClusteringDensityBased(clusterSigma, minClustSize), maxSpecSize,
new ClusteringDensityBased(clusterSigma, minClustSize), haltingWindowLength, haltingWindowEpsilon, popSize); new ClusteringDensityBased(clusterSigma, minClustSize), haltingWindowLength, haltingWindowEpsilon, popSize);
} }
/** /**
* A standard CBNPSO with density based clustering working on personal best positions. * A standard CBNPSO with density based clustering working on personal best
* positions.
* *
* @param problem * @param problem
* @return * @return
*/ */
public static final GOParameters standardCbnPSO(AbstractOptimizationProblem problem) { public static GOParameters standardCbnPSO(AbstractOptimizationProblem problem) {
return createCbnPSO(problem, cbnDefaultClusterSigma, cbnDefaultMinGroupSize, cbnDefaultMaxGroupSize, return createCbnPSO(problem, cbnDefaultClusterSigma, cbnDefaultMinGroupSize, cbnDefaultMaxGroupSize,
cbnDefaultHaltingWindowLength, cbnDefaultHaltingWindowEpsilon, 100); cbnDefaultHaltingWindowLength, cbnDefaultHaltingWindowEpsilon, 100);
} }
public static final GOParameters createCbnPSO(AbstractOptimizationProblem problem, double clusterSigma, int minClustSize, public static GOParameters createCbnPSO(AbstractOptimizationProblem problem, double clusterSigma, int minClustSize,
int maxSpecSize, int haltingWindowLength, double haltingWindowEpsilon, int popSize) { int maxSpecSize, int haltingWindowLength, double haltingWindowEpsilon, int popSize) {
GOParameters psoParams = standardPSO(problem); GOParameters psoParams = standardPSO(problem);
ParticleSwarmOptimization pso = (ParticleSwarmOptimization) psoParams.getOptimizer(); ParticleSwarmOptimization pso = (ParticleSwarmOptimization) psoParams.getOptimizer();
@ -1230,7 +1243,7 @@ public class OptimizerFactory {
* @param popSize * @param popSize
* @return * @return
*/ */
public static final GOParameters createCbn(AbstractOptimizationProblem problem, InterfaceOptimizer opt, public static GOParameters createCbn(AbstractOptimizationProblem problem, InterfaceOptimizer opt,
InterfaceClustering clustDifferentiate, int maxSpecSize, InterfaceClustering clustMerge, int haltingWindowLength, InterfaceClustering clustDifferentiate, int maxSpecSize, InterfaceClustering clustMerge, int haltingWindowLength,
double haltingWindowEpsilon, int popSize) { double haltingWindowEpsilon, int popSize) {
ClusterBasedNichingEA cbn = new ClusterBasedNichingEA(); ClusterBasedNichingEA cbn = new ClusterBasedNichingEA();
@ -1238,7 +1251,9 @@ public class OptimizerFactory {
cbn.setMergingCA(clustMerge); cbn.setMergingCA(clustMerge);
cbn.setMaxSpeciesSize(maxSpecSize); cbn.setMaxSpeciesSize(maxSpecSize);
cbn.setDifferentiationCA(clustDifferentiate); cbn.setDifferentiationCA(clustDifferentiate);
if (clustMerge!=null) cbn.setUseMerging(true); if (clustMerge != null) {
cbn.setUseMerging(true);
}
cbn.setShowCycle(0); // don't do graphical output cbn.setShowCycle(0); // don't do graphical output
cbn.setHaltingWindow(haltingWindowLength); cbn.setHaltingWindow(haltingWindowLength);
cbn.setEpsilonBound(haltingWindowEpsilon); cbn.setEpsilonBound(haltingWindowEpsilon);
@ -1246,12 +1261,13 @@ public class OptimizerFactory {
} }
/** /**
* A standard CBNES which employs a (15,50)-ES with further parameters as set by the EvA2 framework. * A standard CBNES which employs a (15,50)-ES with further parameters as
* set by the EvA2 framework.
* *
* @param problem * @param problem
* @return * @return
*/ */
public static final GOParameters standardCbnES(AbstractOptimizationProblem problem) { public static GOParameters standardCbnES(AbstractOptimizationProblem problem) {
EvolutionStrategies es = new EvolutionStrategies(); EvolutionStrategies es = new EvolutionStrategies();
es.setMu(15); es.setMu(15);
es.setLambda(50); es.setLambda(50);
@ -1260,28 +1276,36 @@ public class OptimizerFactory {
} }
/** /**
* A standard CBNES which employs a CMA-ES, see {@link #cmaES(AbstractOptimizationProblem)}. * A standard CBNES which employs a CMA-ES, see
* {@link #cmaES(AbstractOptimizationProblem)}.
* *
* @param problem * @param problem
* @return * @return
*/ */
public static final GOParameters standardCbnCmaES(AbstractOptimizationProblem problem) { public static GOParameters standardCbnCmaES(AbstractOptimizationProblem problem) {
GOParameters cmaEsParams = cmaES(problem); GOParameters cmaEsParams = cmaES(problem);
EvolutionStrategies cmaES = (EvolutionStrategies) cmaEsParams.getOptimizer(); EvolutionStrategies cmaES = (EvolutionStrategies) cmaEsParams.getOptimizer();
return createCbn(problem, cmaES, cbnDefaultClusterSigma, cbnDefaultMinGroupSize, cbnDefaultMaxGroupSize, cbnDefaultHaltingWindowLength, cbnDefaultHaltingWindowEpsilon, 100); return createCbn(problem, cmaES, cbnDefaultClusterSigma, cbnDefaultMinGroupSize, cbnDefaultMaxGroupSize, cbnDefaultHaltingWindowLength, cbnDefaultHaltingWindowEpsilon, 100);
} }
/** /**
* A standard CBNGA with a GA and further parameters as set by the EvA2 framework. * A standard CBNGA with a GA and further parameters as set by the EvA2
* framework.
*
* @param problem * @param problem
* @return * @return
*/ */
public static final GOParameters standardCbnGA(AbstractOptimizationProblem problem) { public static GOParameters standardCbnGA(AbstractOptimizationProblem problem) {
GeneticAlgorithm ga = new GeneticAlgorithm(); GeneticAlgorithm ga = new GeneticAlgorithm();
return createCbn(problem, ga, cbnDefaultClusterSigma, cbnDefaultMinGroupSize, cbnDefaultMaxGroupSize, cbnDefaultHaltingWindowLength, cbnDefaultHaltingWindowEpsilon, 100); return createCbn(problem, ga, cbnDefaultClusterSigma, cbnDefaultMinGroupSize, cbnDefaultMaxGroupSize, cbnDefaultHaltingWindowLength, cbnDefaultHaltingWindowEpsilon, 100);
} }
public static final GOParameters standardPBIL(AbstractOptimizationProblem problem) { /**
*
* @param problem
* @return
*/
public static GOParameters standardPBIL(AbstractOptimizationProblem problem) {
PopulationBasedIncrementalLearning pbil = createPBIL(0.04, 0.01, 0.5, 1, PopulationBasedIncrementalLearning pbil = createPBIL(0.04, 0.01, 0.5, 1,
new SelectBestIndividuals(), 50, problem, null); new SelectBestIndividuals(), 50, problem, null);
@ -1289,23 +1313,25 @@ public class OptimizerFactory {
} }
/** /**
* Create a standard clustering hill climbing employing simple ES mutation with adaptive * Create a standard clustering hill climbing employing simple ES mutation
* step size, starting in parallel 100 local searches and clustering intermediate populations * with adaptive step size, starting in parallel 100 local searches and
* to avoid optima being found several times by the same population (density based clustering with * clustering intermediate populations to avoid optima being found several
* sigma = 0.05). * times by the same population (density based clustering with sigma =
* The population is reinitialized if the average progress of one cycle does not exceed 1e-6. * 0.05). The population is reinitialized if the average progress of one
* cycle does not exceed 1e-6.
* *
* @param problem * @param problem
* @return * @return
*/ */
public static final GOParameters stdClusteringHillClimbing( public static GOParameters stdClusteringHillClimbing(
AbstractOptimizationProblem problem) { AbstractOptimizationProblem problem) {
return clusteringHillClimbing(problem, 1000, 100, 0.000001, return clusteringHillClimbing(problem, 1000, 100, 0.000001,
PostProcessMethod.hillClimber, 0.05, 0.000001, 0.05); PostProcessMethod.hillClimber, 0.05, 0.000001, 0.05);
} }
/** /**
* Create a clustering hillclimber using nelder mead and additional given parameters. * Create a clustering hillclimber using nelder mead and additional given
* parameters.
* *
* @param problem * @param problem
* @param evalCycle * @param evalCycle
@ -1315,16 +1341,16 @@ public class OptimizerFactory {
* @param sigmaClust * @param sigmaClust
* @return * @return
*/ */
public static final GOParameters clusteringHillClimbingNM(AbstractOptimizationProblem problem, public static GOParameters clusteringHillClimbingNM(AbstractOptimizationProblem problem,
int evalCycle, int popSize, double minImprovement, double sigmaClust) { int evalCycle, int popSize, double minImprovement, double sigmaClust) {
return clusteringHillClimbing(problem, evalCycle, popSize, minImprovement, return clusteringHillClimbing(problem, evalCycle, popSize, minImprovement,
PostProcessMethod.nelderMead, 0.01, 0.00000001, sigmaClust); PostProcessMethod.nelderMead, 0.01, 0.00000001, sigmaClust);
} }
/** /**
* Create a custom clustering hillclimber using ES mutation (simple or CMA) or nelder mead. * Create a custom clustering hillclimber using ES mutation (simple or CMA)
* The parameters hcInitialStep and hcStepThresh are * or nelder mead. The parameters hcInitialStep and hcStepThresh are only
* only relevant for the simple mutation based hc method. * relevant for the simple mutation based hc method.
* *
* @param problem * @param problem
* @param evalCycle * @param evalCycle
@ -1336,7 +1362,7 @@ public class OptimizerFactory {
* @param sigmaClust * @param sigmaClust
* @return * @return
*/ */
public static final GOParameters clusteringHillClimbing( public static GOParameters clusteringHillClimbing(
AbstractOptimizationProblem problem, int evalCycle, int popSize, double minImprovement, AbstractOptimizationProblem problem, int evalCycle, int popSize, double minImprovement,
PostProcessMethod method, double hcInitialStep, double hcStepThresh, double sigmaClust) { PostProcessMethod method, double hcInitialStep, double hcStepThresh, double sigmaClust) {
ClusteringHillClimbing chc = new ClusteringHillClimbing(); ClusteringHillClimbing chc = new ClusteringHillClimbing();
@ -1353,8 +1379,7 @@ public class OptimizerFactory {
return makeParams(chc, popSize, problem, randSeed, getTerminator()); return makeParams(chc, popSize, problem, randSeed, getTerminator());
} }
public static GOParameters cmaES(AbstractOptimizationProblem problem) {
public static final GOParameters cmaES(AbstractOptimizationProblem problem) {
EvolutionStrategies es = new EvolutionStrategies(); EvolutionStrategies es = new EvolutionStrategies();
es.setMu(15); es.setMu(15);
es.setLambda(50); es.setLambda(50);
@ -1371,29 +1396,32 @@ public class OptimizerFactory {
} }
/** /**
* Create a new IPOP-CMA-ES strategy with Rank-mu-CMA. The population size is set to * Create a new IPOP-CMA-ES strategy with Rank-mu-CMA. The population size
* lambda = (int) (4.0 + 3.0 * Math.log(dim)) and mu = Math.floor(lambda/2.), but * is set to lambda = (int) (4.0 + 3.0 * Math.log(dim)) and mu =
* lambda may grow during optimization due to restarts with increased lambda. * Math.floor(lambda/2.), but lambda may grow during optimization due to
* Operator probabilities are set to p_mut = 1 and p_c = 0. * restarts with increased lambda. Operator probabilities are set to p_mut =
* The given problem must work with an individual template which implements * 1 and p_c = 0. The given problem must work with an individual template
* InterfaceDataTypeDouble. * which implements InterfaceDataTypeDouble.
* *
* @param problem the optimization problem * @param problem the optimization problem
* @return * @return
*/ */
public static final GOParameters cmaESIPOP(AbstractOptimizationProblem problem) { public static GOParameters cmaESIPOP(AbstractOptimizationProblem problem) {
return createCmaEsIPop(problem, 2.); return createCmaEsIPop(problem, 2.);
} }
public static final GOParameters createCmaEsIPop(AbstractOptimizationProblem problem, double incLambdaFact) { public static GOParameters createCmaEsIPop(AbstractOptimizationProblem problem, double incLambdaFact) {
EvolutionStrategies es = new EvolutionStrategyIPOP(); EvolutionStrategies es = new EvolutionStrategyIPOP();
AbstractEAIndividual indyTemplate = problem.getIndividualTemplate(); AbstractEAIndividual indyTemplate = problem.getIndividualTemplate();
if ((indyTemplate != null) && ((indyTemplate instanceof InterfaceESIndividual) || (indyTemplate instanceof InterfaceDataTypeDouble))) { if ((indyTemplate != null) && ((indyTemplate instanceof InterfaceESIndividual) || (indyTemplate instanceof InterfaceDataTypeDouble))) {
// set selection strategy // set selection strategy
int dim; int dim;
if (indyTemplate instanceof InterfaceESIndividual) dim=((InterfaceESIndividual)indyTemplate).getDGenotype().length; if (indyTemplate instanceof InterfaceESIndividual) {
else dim = ((InterfaceDataTypeDouble)indyTemplate).getDoubleData().length; dim = ((InterfaceESIndividual) indyTemplate).getDGenotype().length;
} else {
dim = ((InterfaceDataTypeDouble) indyTemplate).getDoubleData().length;
}
int lambda = (int) (4.0 + 3.0 * Math.log(dim)); int lambda = (int) (4.0 + 3.0 * Math.log(dim));
es.setGenerationStrategy((int) Math.floor(lambda / 2.), lambda, false); es.setGenerationStrategy((int) Math.floor(lambda / 2.), lambda, false);
es.setForceOrigPopSize(false); es.setForceOrigPopSize(false);
@ -1410,18 +1438,19 @@ public class OptimizerFactory {
return makeESParams(es, problem); return makeESParams(es, problem);
} }
public static final GOParameters standardNMS(AbstractOptimizationProblem problem) { public static GOParameters standardNMS(AbstractOptimizationProblem problem) {
NelderMeadSimplex nms = NelderMeadSimplex.createNelderMeadSimplex(problem, null); NelderMeadSimplex nms = NelderMeadSimplex.createNelderMeadSimplex(problem, null);
return makeParams(nms, 50, problem, randSeed, getTerminator()); return makeParams(nms, 50, problem, randSeed, getTerminator());
} }
/** /**
* This constructs a standard DE variant with current-to-best/1 scheme, F=0.8, * This constructs a standard DE variant with current-to-best/1 scheme,
* k=0.6, lambda=0.6. The population size is 50 by default. * F=0.8, k=0.6, lambda=0.6. The population size is 50 by default.
*
* @param problem * @param problem
* @return * @return
*/ */
public static final GOParameters standardDE( public static GOParameters standardDE(
AbstractOptimizationProblem problem) { AbstractOptimizationProblem problem) {
DifferentialEvolution de = new DifferentialEvolution(); DifferentialEvolution de = new DifferentialEvolution();
de.setDEType(DETypeEnum.DE2_CurrentToBest); // this sets current-to-best de.setDEType(DETypeEnum.DE2_CurrentToBest); // this sets current-to-best
@ -1432,7 +1461,7 @@ public class OptimizerFactory {
return makeParams(de, 50, problem, randSeed, getTerminator()); return makeParams(de, 50, problem, randSeed, getTerminator());
} }
public static final GOParameters standardES( public static GOParameters standardES(
AbstractOptimizationProblem problem) { AbstractOptimizationProblem problem) {
EvolutionStrategies es = new EvolutionStrategies(); EvolutionStrategies es = new EvolutionStrategies();
es.setMu(15); es.setMu(15);
@ -1448,7 +1477,7 @@ public class OptimizerFactory {
return makeESParams(es, problem); return makeESParams(es, problem);
} }
public static final GOParameters standardGA( public static GOParameters standardGA(
AbstractOptimizationProblem problem) { AbstractOptimizationProblem problem) {
GeneticAlgorithm ga = new GeneticAlgorithm(); GeneticAlgorithm ga = new GeneticAlgorithm();
ga.setElitism(true); ga.setElitism(true);
@ -1457,32 +1486,34 @@ public class OptimizerFactory {
} }
/** /**
* A standard constricted PSO instance with phi1=phi2=2.05, grid topology of range 1 and * A standard constricted PSO instance with phi1=phi2=2.05, grid topology of
* a population size of 30. The chi parameter is set to approx. 0.73 automatically. * range 1 and a population size of 30. The chi parameter is set to approx.
* 0.73 automatically.
*
* @param problem * @param problem
* @return * @return
*/ */
public static final GOParameters standardPSO( public static GOParameters standardPSO(
AbstractOptimizationProblem problem) { AbstractOptimizationProblem problem) {
ParticleSwarmOptimization pso = new ParticleSwarmOptimization(); ParticleSwarmOptimization pso = new ParticleSwarmOptimization();
pso.setPhiValues(2.05, 2.05); pso.setPhiValues(2.05, 2.05);
// pso.getTopology().setSelectedTag("Grid");
pso.setTopology(PSOTopologyEnum.grid); pso.setTopology(PSOTopologyEnum.grid);
pso.setTopologyRange(1); pso.setTopologyRange(1);
return makeParams(pso, 30, problem, randSeed, getTerminator()); return makeParams(pso, 30, problem, randSeed, getTerminator());
} }
public static final GOParameters tribes(AbstractOptimizationProblem problem) { public static GOParameters tribes(AbstractOptimizationProblem problem) {
return makeParams(new Tribes(), 1, problem, randSeed, getTerminator()); return makeParams(new Tribes(), 1, problem, randSeed, getTerminator());
} }
/** /**
* A standard niching ES which employs predefined values and standard ES variation operators. * A standard niching ES which employs predefined values and standard ES
* variation operators.
* *
* @param problem * @param problem
* @return * @return
*/ */
public static final GOParameters standardNichingEs(AbstractOptimizationProblem prob) { public static GOParameters standardNichingEs(AbstractOptimizationProblem prob) {
// nichingEs(AbstractOptimizationProblem prob, double nicheRadius, int muPerPeak, int lambdaPerPeak, // nichingEs(AbstractOptimizationProblem prob, double nicheRadius, int muPerPeak, int lambdaPerPeak,
return createNichingEs(prob, -1, 100, 100, return createNichingEs(prob, -1, 100, 100,
// int expectedPeaks, int rndImmigrants, int explorerPeaks, int resetExplInterval, int etaPresel) { // int expectedPeaks, int rndImmigrants, int explorerPeaks, int resetExplInterval, int etaPresel) {
@ -1495,7 +1526,7 @@ public class OptimizerFactory {
* @param problem * @param problem
* @return * @return
*/ */
public static final GOParameters createNichingEs(AbstractOptimizationProblem prob, double nicheRadius, int muPerPeak, int lambdaPerPeak, int expectedPeaks, int rndImmigrants, int explorerPeaks, int resetExplInterval, int etaPresel) { public static GOParameters createNichingEs(AbstractOptimizationProblem prob, double nicheRadius, int muPerPeak, int lambdaPerPeak, int expectedPeaks, int rndImmigrants, int explorerPeaks, int resetExplInterval, int etaPresel) {
EsDpiNiching nes = new EsDpiNiching(nicheRadius, muPerPeak, lambdaPerPeak, expectedPeaks, rndImmigrants, explorerPeaks, resetExplInterval, etaPresel); EsDpiNiching nes = new EsDpiNiching(nicheRadius, muPerPeak, lambdaPerPeak, expectedPeaks, rndImmigrants, explorerPeaks, resetExplInterval, etaPresel);
if (assertIndyType(prob, InterfaceESIndividual.class)) { if (assertIndyType(prob, InterfaceESIndividual.class)) {
@ -1550,6 +1581,7 @@ public class OptimizerFactory {
/** /**
* A generic niching CMA-ES using the rank-mu CMA operator * A generic niching CMA-ES using the rank-mu CMA operator
*
* @param prob * @param prob
* @param nicheRadius * @param nicheRadius
* @param lambda * @param lambda
@ -1560,7 +1592,9 @@ public class OptimizerFactory {
*/ */
public static GOParameters createNichingCmaEs(AbstractOptimizationProblem prob, double nicheRadius, int lambda, int expectedPeaks, int explorerPeaks, int resetExplInterval, double stagnationEpsilon) { public static GOParameters createNichingCmaEs(AbstractOptimizationProblem prob, double nicheRadius, int lambda, int expectedPeaks, int explorerPeaks, int resetExplInterval, double stagnationEpsilon) {
EsDpiNiching nes = new EsDpiNichingCma(nicheRadius, lambda, expectedPeaks, explorerPeaks, resetExplInterval); EsDpiNiching nes = new EsDpiNichingCma(nicheRadius, lambda, expectedPeaks, explorerPeaks, resetExplInterval);
if (stagnationEpsilon>0) nes.setEpsilonBound(stagnationEpsilon); if (stagnationEpsilon > 0) {
nes.setEpsilonBound(stagnationEpsilon);
}
if (assertIndyType(prob, InterfaceESIndividual.class)) { if (assertIndyType(prob, InterfaceESIndividual.class)) {
setTemplateOperators(prob, new MutateESRankMuCMA(), 1., new CrossoverESDefault(), 0.); setTemplateOperators(prob, new MutateESRankMuCMA(), 1., new CrossoverESDefault(), 0.);
@ -1573,7 +1607,8 @@ public class OptimizerFactory {
} }
/** /**
* Check if a given problem instance has a template individual matching the given class. * Check if a given problem instance has a template individual matching the
* given class.
* *
* @param prob * @param prob
* @param cls * @param cls
@ -1585,7 +1620,9 @@ public class OptimizerFactory {
} }
/** /**
* Set the evolutionary operators of the individual template of the given problem instance. * Set the evolutionary operators of the individual template of the given
* problem instance.
*
* @param prob * @param prob
* @param mute * @param mute
* @param pMut * @param pMut

View File

@ -132,6 +132,7 @@ public class OptimizerRunnable implements Runnable {
doRestart = restart; doRestart = restart;
} }
@Override
public void run() { public void run() {
isFinished = false; isFinished = false;
try { try {

View File

@ -28,6 +28,7 @@ public class ClassPreloader implements Runnable {
/** /**
* Load classes via GenericObjectEditor in a thread. * Load classes via GenericObjectEditor in a thread.
*/ */
@Override
public void run() { public void run() {
if (classNames != null) { if (classNames != null) {
for (int i = 0; i < classNames.length; i++) { for (int i = 0; i < classNames.length; i++) {

View File

@ -252,6 +252,7 @@ public class EvAClient extends JFrame implements RemoteStateListener {
SwingUtilities.invokeLater(initRnbl = new Runnable() { SwingUtilities.invokeLater(initRnbl = new Runnable() {
@Override
public void run() { public void run() {
synchronized (this) { synchronized (this) {
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
@ -1177,6 +1178,7 @@ public class EvAClient extends JFrame implements RemoteStateListener {
comAdapter.killAllServers(); comAdapter.killAllServers();
} }
@Override
public void performedRestart(String infoString) { public void performedRestart(String infoString) {
if (superListenerList != null) { if (superListenerList != null) {
for (RemoteStateListener l : superListenerList) { for (RemoteStateListener l : superListenerList) {
@ -1187,6 +1189,7 @@ public class EvAClient extends JFrame implements RemoteStateListener {
startTime = System.currentTimeMillis(); startTime = System.currentTimeMillis();
} }
@Override
public void performedStart(String infoString) { public void performedStart(String infoString) {
if (superListenerList != null) { if (superListenerList != null) {
for (RemoteStateListener l : superListenerList) { for (RemoteStateListener l : superListenerList) {
@ -1197,6 +1200,7 @@ public class EvAClient extends JFrame implements RemoteStateListener {
startTime = System.currentTimeMillis(); startTime = System.currentTimeMillis();
} }
@Override
public void performedStop() { public void performedStop() {
if (superListenerList != null) { if (superListenerList != null) {
for (RemoteStateListener l : superListenerList) { for (RemoteStateListener l : superListenerList) {
@ -1215,6 +1219,7 @@ public class EvAClient extends JFrame implements RemoteStateListener {
* for the event dispatching thread with SwingUtilities.invokeLater(). In * for the event dispatching thread with SwingUtilities.invokeLater(). In
* this case we're just changing the progress bars value. * this case we're just changing the progress bars value.
*/ */
@Override
public void updateProgress(final int percent, String msg) { public void updateProgress(final int percent, String msg) {
if (superListenerList != null) { if (superListenerList != null) {
for (RemoteStateListener l : superListenerList) { for (RemoteStateListener l : superListenerList) {
@ -1227,6 +1232,7 @@ public class EvAClient extends JFrame implements RemoteStateListener {
if (this.progressBar != null) { if (this.progressBar != null) {
Runnable doSetProgressBarValue = new Runnable() { Runnable doSetProgressBarValue = new Runnable() {
@Override
public void run() { public void run() {
progressBar.setValue(percent); progressBar.setValue(percent);
} }

View File

@ -23,6 +23,7 @@ import java.rmi.RemoteException;
* *
*/ */
public class EvAComAdapter extends ComAdapter { public class EvAComAdapter extends ComAdapter {
private LoggingPanel loggingPanel; private LoggingPanel loggingPanel;
private EvAMainAdapterImpl localMainAdapter; private EvAMainAdapterImpl localMainAdapter;
private boolean runLocally = false; private boolean runLocally = false;
@ -33,6 +34,7 @@ public class EvAComAdapter extends ComAdapter {
public void setLogPanel(LoggingPanel loggingPanel) { public void setLogPanel(LoggingPanel loggingPanel) {
this.loggingPanel = loggingPanel; this.loggingPanel = loggingPanel;
} }
/** /**
* *
*/ */
@ -46,12 +48,12 @@ public class EvAComAdapter extends ComAdapter {
/** /**
* Creates the ModulAdapters RMI Object on the server * Creates the ModulAdapters RMI Object on the server
*
* @return * @return
*/ */
public ModuleAdapter getModuleAdapter(String selectedModuleName, InterfaceGOParameters goParams, String noGuiStatsFile) { public ModuleAdapter getModuleAdapter(String selectedModuleName, InterfaceGOParameters goParams, String noGuiStatsFile) {
ModuleAdapter newModuleAdapter; ModuleAdapter newModuleAdapter;
if ((m_RMIServer == null) && isRunLocally()) { if ((m_RMIServer == null) && isRunLocally()) {
//ret = evaAdapter.getModuleAdapter(Modul, hostAdd, this.m_MainAdapterClient);
newModuleAdapter = getLocalMainAdapter().getModuleAdapter(selectedModuleName, true, getHostName(), goParams, noGuiStatsFile, null); newModuleAdapter = getLocalMainAdapter().getModuleAdapter(selectedModuleName, true, getHostName(), goParams, noGuiStatsFile, null);
} else { } else {
newModuleAdapter = ((RMIConnectionEvA) getConnection(getHostName())).getModuleAdapter(selectedModuleName); newModuleAdapter = ((RMIConnectionEvA) getConnection(getHostName())).getModuleAdapter(selectedModuleName);
@ -67,12 +69,15 @@ public class EvAComAdapter extends ComAdapter {
} }
private EvAMainAdapter getLocalMainAdapter() { private EvAMainAdapter getLocalMainAdapter() {
if (localMainAdapter == null) localMainAdapter = new EvAMainAdapterImpl(); if (localMainAdapter == null) {
localMainAdapter = new EvAMainAdapterImpl();
}
return localMainAdapter; return localMainAdapter;
} }
/** /**
* Returns a list of modules available on the server. * Returns a list of modules available on the server.
*
* @return * @return
*/ */
public String[] getModuleNameList() { public String[] getModuleNameList() {
@ -88,16 +93,20 @@ public class EvAComAdapter extends ComAdapter {
} }
list = ((EvAMainAdapter) Connection.getMainAdapter()).getModuleNameList(); list = ((EvAMainAdapter) Connection.getMainAdapter()).getModuleNameList();
} }
if (loggingPanel != null) if (loggingPanel != null) {
loggingPanel.logMessage("List of modules on server:"); loggingPanel.logMessage("List of modules on server:");
if (list != null) }
if (list != null) {
for (int i = 0; i < list.length; i++) { for (int i = 0; i < list.length; i++) {
if ( (String) list[i] != null && loggingPanel != null) if ((String) list[i] != null && loggingPanel != null) {
loggingPanel.logMessage((String) list[i]); loggingPanel.logMessage((String) list[i]);
} }
}
}
return list; return list;
} }
@Override
protected MainAdapter getMainAdapter(RMIInvocationHandler invocHandler) throws RemoteException { protected MainAdapter getMainAdapter(RMIInvocationHandler invocHandler) throws RemoteException {
try { try {
return (EvAMainAdapter) invocHandler.getWrapper(); return (EvAMainAdapter) invocHandler.getWrapper();
@ -107,16 +116,18 @@ public class EvAComAdapter extends ComAdapter {
return (MainAdapter) invocHandler.getWrapper(); return (MainAdapter) invocHandler.getWrapper();
} }
@Override
protected RMIConnection createRMIConnection(String Host, MainAdapter mainRemoteObject, MainAdapterClient client) { protected RMIConnection createRMIConnection(String Host, MainAdapter mainRemoteObject, MainAdapterClient client) {
return new RMIConnectionEvA(Host, mainRemoteObject, client); return new RMIConnectionEvA(Host, mainRemoteObject, client);
} }
/** /**
* @return the runLocally * @return the runLocally
*/ */
public boolean isRunLocally() { public boolean isRunLocally() {
return runLocally; return runLocally;
} }
/** /**
* @param runLocally the runLocally to set * @param runLocally the runLocally to set
*/ */

View File

@ -63,6 +63,7 @@ public class AboutDialog extends JDialog {
infoEditorPane.setOpaque(false); infoEditorPane.setOpaque(false);
infoEditorPane.addHyperlinkListener(new HyperlinkListener() { infoEditorPane.addHyperlinkListener(new HyperlinkListener() {
@Override
public void hyperlinkUpdate(HyperlinkEvent hle) { public void hyperlinkUpdate(HyperlinkEvent hle) {
if (HyperlinkEvent.EventType.ACTIVATED.equals(hle.getEventType())) { if (HyperlinkEvent.EventType.ACTIVATED.equals(hle.getEventType())) {
java.awt.Desktop desktop = java.awt.Desktop.getDesktop(); java.awt.Desktop desktop = java.awt.Desktop.getDesktop();

View File

@ -97,6 +97,7 @@ public abstract class AbstractListSelectionEditor extends JPanel implements Prop
this.m_BlackCheck[i] = new JCheckBox(getElementName(i), isElementSelected(i)); this.m_BlackCheck[i] = new JCheckBox(getElementName(i), isElementSelected(i));
this.m_BlackCheck[i].setToolTipText(getElementToolTip(i)); this.m_BlackCheck[i].setToolTipText(getElementToolTip(i));
this.m_BlackCheck[i].addActionListener(new ActionListener() { this.m_BlackCheck[i].addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ev) { public void actionPerformed(ActionEvent ev) {
if (actionOnSelect()) m_Support.firePropertyChange("AbstractListSelectionEditor", null, this); if (actionOnSelect()) m_Support.firePropertyChange("AbstractListSelectionEditor", null, this);
} }
@ -123,6 +124,7 @@ public abstract class AbstractListSelectionEditor extends JPanel implements Prop
/** This method will set the value of object that is to be edited. /** This method will set the value of object that is to be edited.
* @param o an object that must be an array. * @param o an object that must be an array.
*/ */
@Override
public void setValue(Object o) { public void setValue(Object o) {
if (setObject(o)) updateEditor(); if (setObject(o)) updateEditor();
} }
@ -131,29 +133,36 @@ public abstract class AbstractListSelectionEditor extends JPanel implements Prop
* Returns the current object. * Returns the current object.
* @return the current object * @return the current object
*/ */
@Override
public abstract Object getValue(); public abstract Object getValue();
@Override
public String getJavaInitializationString() { public String getJavaInitializationString() {
return ""; return "";
} }
@Override
public String getAsText() { public String getAsText() {
return null; return null;
} }
@Override
public void setAsText(String text) throws IllegalArgumentException { public void setAsText(String text) throws IllegalArgumentException {
throw new IllegalArgumentException(text); throw new IllegalArgumentException(text);
} }
@Override
public String[] getTags() { public String[] getTags() {
return null; return null;
} }
@Override
public void addPropertyChangeListener(PropertyChangeListener l) { public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this); if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.addPropertyChangeListener(l); m_Support.addPropertyChangeListener(l);
} }
@Override
public void removePropertyChangeListener(PropertyChangeListener l) { public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this); if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.removePropertyChangeListener(l); m_Support.removePropertyChangeListener(l);
@ -162,6 +171,7 @@ public abstract class AbstractListSelectionEditor extends JPanel implements Prop
/** Returns true since the Object can be shown /** Returns true since the Object can be shown
* @return true * @return true
*/ */
@Override
public boolean isPaintable() { public boolean isPaintable() {
return true; return true;
} }
@ -171,6 +181,7 @@ public abstract class AbstractListSelectionEditor extends JPanel implements Prop
* @param gfx the graphics context to use * @param gfx the graphics context to use
* @param box the area we are allowed to paint into * @param box the area we are allowed to paint into
*/ */
@Override
public void paintValue(Graphics gfx, Rectangle box) { public void paintValue(Graphics gfx, Rectangle box) {
FontMetrics fm = gfx.getFontMetrics(); FontMetrics fm = gfx.getFontMetrics();
int vpad = (box.height - fm.getAscent()) / 2; int vpad = (box.height - fm.getAscent()) / 2;
@ -182,6 +193,7 @@ public abstract class AbstractListSelectionEditor extends JPanel implements Prop
* Returns true because we do support a custom editor. * Returns true because we do support a custom editor.
* @return true * @return true
*/ */
@Override
public boolean supportsCustomEditor() { public boolean supportsCustomEditor() {
return true; return true;
} }
@ -189,11 +201,13 @@ public abstract class AbstractListSelectionEditor extends JPanel implements Prop
/** Returns the array editing component. /** Returns the array editing component.
* @return a value of type 'java.awt.Component' * @return a value of type 'java.awt.Component'
*/ */
@Override
public Component getCustomEditor() { public Component getCustomEditor() {
if (this.m_CustomEditor == null) this.initCustomEditor(); if (this.m_CustomEditor == null) this.initCustomEditor();
return m_CustomEditor; return m_CustomEditor;
} }
@Override
public void propertyChange(PropertyChangeEvent evt) { public void propertyChange(PropertyChangeEvent evt) {
m_Support.firePropertyChange("AbstractListSelectionEditor", null, this); m_Support.firePropertyChange("AbstractListSelectionEditor", null, this);
} }

View File

@ -109,6 +109,7 @@ public class BigStringEditor implements PropertyEditor {
m_Panel.setLayout(new BorderLayout()); m_Panel.setLayout(new BorderLayout());
m_SetButton = new JButton("SET"); m_SetButton = new JButton("SET");
m_SetButton.addActionListener(new ActionListener() { m_SetButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
setValue(m_TextArea.getText()); setValue(m_TextArea.getText());
} }
@ -119,6 +120,7 @@ public class BigStringEditor implements PropertyEditor {
/** /**
* *
*/ */
@Override
public void setValue (Object value) { public void setValue (Object value) {
m_ElementEditor = null; m_ElementEditor = null;
if (value instanceof String) { if (value instanceof String) {
@ -135,6 +137,7 @@ public class BigStringEditor implements PropertyEditor {
/** /**
* *
*/ */
@Override
public Object getValue () { public Object getValue () {
// m_Source.setString(m_TextArea.getText()); // m_Source.setString(m_TextArea.getText());
return null; return null;
@ -142,6 +145,7 @@ public class BigStringEditor implements PropertyEditor {
/** /**
* *
*/ */
@Override
public String getJavaInitializationString () { public String getJavaInitializationString () {
return "null"; return "null";
} }
@ -152,6 +156,7 @@ public class BigStringEditor implements PropertyEditor {
* *
* @return true * @return true
*/ */
@Override
public boolean isPaintable () { public boolean isPaintable () {
return true; return true;
} }
@ -162,6 +167,7 @@ public class BigStringEditor implements PropertyEditor {
* @param gfx the graphics context to use * @param gfx the graphics context to use
* @param box the area we are allowed to paint into * @param box the area we are allowed to paint into
*/ */
@Override
public void paintValue (Graphics gfx, Rectangle box) { public void paintValue (Graphics gfx, Rectangle box) {
FontMetrics fm = gfx.getFontMetrics(); FontMetrics fm = gfx.getFontMetrics();
int vpad = (box.height - fm.getAscent())/2; int vpad = (box.height - fm.getAscent())/2;
@ -172,6 +178,7 @@ public class BigStringEditor implements PropertyEditor {
/** /**
* *
*/ */
@Override
public String getAsText () { public String getAsText () {
return null; return null;
} }
@ -179,6 +186,7 @@ public class BigStringEditor implements PropertyEditor {
/** /**
* *
*/ */
@Override
public void setAsText (String text) throws IllegalArgumentException { public void setAsText (String text) throws IllegalArgumentException {
throw new IllegalArgumentException(text); throw new IllegalArgumentException(text);
} }
@ -186,6 +194,7 @@ public class BigStringEditor implements PropertyEditor {
/** /**
* *
*/ */
@Override
public String[] getTags () { public String[] getTags () {
return null; return null;
} }
@ -193,21 +202,25 @@ public class BigStringEditor implements PropertyEditor {
/** /**
* *
*/ */
@Override
public boolean supportsCustomEditor () { public boolean supportsCustomEditor () {
return true; return true;
} }
/** /**
* *
*/ */
@Override
public Component getCustomEditor () { public Component getCustomEditor () {
return m_Panel; return m_Panel;
} }
@Override
public void addPropertyChangeListener(PropertyChangeListener l) { public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this); if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.addPropertyChangeListener(l); m_Support.addPropertyChangeListener(l);
} }
@Override
public void removePropertyChangeListener(PropertyChangeListener l) { public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this); if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.removePropertyChangeListener(l); m_Support.removePropertyChangeListener(l);

View File

@ -269,6 +269,7 @@ public class DPointSetMultiIcon extends DComponent
jumperMI.addJump(); jumperMI.addJump();
} }
@Override
public void paint(DMeasures m) public void paint(DMeasures m)
{ {
try try
@ -490,6 +491,7 @@ public class DPointSetMultiIcon extends DComponent
//~ Inner Classes ////////////////////////////////////////////////////////// //~ Inner Classes //////////////////////////////////////////////////////////
@Override
public String toString() public String toString()
{ {
String text = "eva2.tools.chart2d.DPointSet[size:" + getSize(); String text = "eva2.tools.chart2d.DPointSet[size:" + getSize();

View File

@ -91,6 +91,7 @@ public class DataViewer implements DataViewerInterface {
/** /**
* *
*/ */
@Override
public Graph getNewGraph(String InfoString) { public Graph getNewGraph(String InfoString) {
m_GraphCounter++; m_GraphCounter++;
if (TRACE) System.out.println("Graph.getNewGraph No:"+m_GraphCounter); if (TRACE) System.out.println("Graph.getNewGraph No:"+m_GraphCounter);
@ -99,6 +100,7 @@ public class DataViewer implements DataViewerInterface {
/** /**
* *
*/ */
@Override
public void init() { public void init() {
m_Plot = new Plot(m_Name,"x","y", true); m_Plot = new Plot(m_Name,"x","y", true);
} }

View File

@ -18,10 +18,12 @@ public class EnumEditor extends PropertyEditorSupport {
/** The Enum values that may be chosen */ /** The Enum values that may be chosen */
private Enum[] enumConstants; private Enum[] enumConstants;
@Override
public String getAsText() { public String getAsText() {
return getValue().toString(); return getValue().toString();
} }
@Override
public void setValue(Object value) { public void setValue(Object value) {
if (value instanceof Enum) { if (value instanceof Enum) {
enumConstants = ((Enum)value).getClass().getEnumConstants(); enumConstants = ((Enum)value).getClass().getEnumConstants();
@ -67,6 +69,7 @@ public class EnumEditor extends PropertyEditorSupport {
PropertyValueSelector ps = new PropertyValueSelector(ed); PropertyValueSelector ps = new PropertyValueSelector(ed);
JFrame f = new JFrame(); JFrame f = new JFrame();
f.addWindowListener(new WindowAdapter() { f.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) { public void windowClosing(WindowEvent e) {
System.exit(0); System.exit(0);
} }

View File

@ -52,6 +52,7 @@ public class EvAModuleButtonPanelMaker implements RemoteStateListener, Serializa
moduleAdapter = adapter; moduleAdapter = adapter;
} }
@Override
public JToolBar makePanel() { public JToolBar makePanel() {
toolBar = new JToolBar(); toolBar = new JToolBar();
toolBar.setFloatable(false); toolBar.setFloatable(false);
@ -165,6 +166,7 @@ public class EvAModuleButtonPanelMaker implements RemoteStateListener, Serializa
helpButton.setToolTipText("Description of the current optimization algorithm."); helpButton.setToolTipText("Description of the current optimization algorithm.");
helpButton.addActionListener(new ActionListener() { helpButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
//System.out.println("Run Opt pressed !!!!!!!!!!!!!!!!======================!!"); //System.out.println("Run Opt pressed !!!!!!!!!!!!!!!!======================!!");
try { try {
@ -186,6 +188,7 @@ public class EvAModuleButtonPanelMaker implements RemoteStateListener, Serializa
/** /**
* *
*/ */
@Override
public void performedStop() { public void performedStop() {
runButton.setEnabled(true); runButton.setEnabled(true);
postProcessButton.setEnabled(true); postProcessButton.setEnabled(true);

View File

@ -40,6 +40,7 @@ public class EvATabbedFrameMaker implements Serializable, PanelMaker, InterfaceN
pmContainer.add(pm); pmContainer.add(pm);
} }
@Override
public JPanel makePanel() { public JPanel makePanel() {
JPanel tabControlPanel = new JPanel(new GridBagLayout()); JPanel tabControlPanel = new JPanel(new GridBagLayout());
@ -111,6 +112,7 @@ public class EvATabbedFrameMaker implements Serializable, PanelMaker, InterfaceN
} }
} }
@Override
public void setInformers(List<InterfaceAdditionalPopulationInformer> informers) { public void setInformers(List<InterfaceAdditionalPopulationInformer> informers) {
// if the informers have changed, update the GUI element which displays them // if the informers have changed, update the GUI element which displays them
try { try {
@ -169,6 +171,7 @@ class ClosableTabComponent extends JPanel {
//make JLabel read titles from JTabbedPane //make JLabel read titles from JTabbedPane
JLabel label = new JLabel() { JLabel label = new JLabel() {
@Override
public String getText() { public String getText() {
int index = pane.indexOfTabComponent(ClosableTabComponent.this); int index = pane.indexOfTabComponent(ClosableTabComponent.this);
if (index != -1) { if (index != -1) {
@ -210,6 +213,7 @@ class ClosableTabComponent extends JPanel {
addActionListener(this); addActionListener(this);
} }
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
int i = pane.indexOfTabComponent(ClosableTabComponent.this); int i = pane.indexOfTabComponent(ClosableTabComponent.this);
if (i != -1) { if (i != -1) {
@ -252,10 +256,12 @@ class ClosableTabComponent extends JPanel {
} }
//we don't want to update UI for this button //we don't want to update UI for this button
@Override
public void updateUI() { public void updateUI() {
} }
//paint the cross //paint the cross
@Override
protected void paintComponent(Graphics g) { protected void paintComponent(Graphics g) {
super.paintComponent(g); super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g.create(); Graphics2D g2 = (Graphics2D) g.create();
@ -273,6 +279,7 @@ class ClosableTabComponent extends JPanel {
} }
private final static MouseListener buttonMouseListener = new MouseAdapter() { private final static MouseListener buttonMouseListener = new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) { public void mouseEntered(MouseEvent e) {
Component component = e.getComponent(); Component component = e.getComponent();
if (component instanceof AbstractButton) { if (component instanceof AbstractButton) {
@ -281,6 +288,7 @@ class ClosableTabComponent extends JPanel {
} }
} }
@Override
public void mouseExited(MouseEvent e) { public void mouseExited(MouseEvent e) {
Component component = e.getComponent(); Component component = e.getComponent();
if (component instanceof AbstractButton) { if (component instanceof AbstractButton) {

View File

@ -42,6 +42,7 @@ public class EvATreeSelectionListener implements TreeSelectionListener, Property
if (goEditor!=null) goEditor.addPropertyChangeListener(this); // listen to changes to the parameters if (goEditor!=null) goEditor.addPropertyChangeListener(this); // listen to changes to the parameters
} }
@Override
public void valueChanged(TreeSelectionEvent e) { public void valueChanged(TreeSelectionEvent e) {
if (TRACE) System.out.println("valueChanged to " + BeanInspector.toString(e.getPath())); if (TRACE) System.out.println("valueChanged to " + BeanInspector.toString(e.getPath()));
TreePath tp = e.getPath(); TreePath tp = e.getPath();
@ -59,6 +60,7 @@ public class EvATreeSelectionListener implements TreeSelectionListener, Property
} }
} }
@Override
public void propertyChange(PropertyChangeEvent evt) { public void propertyChange(PropertyChangeEvent evt) {
if (TRACE) System.out.println("EvATreeNode received change event " + evt); if (TRACE) System.out.println("EvATreeNode received change event " + evt);
root.setObject(evt.getNewValue(), true); root.setObject(evt.getNewValue(), true);

View File

@ -19,6 +19,7 @@ public class Exp extends DFunction {
* (non-Javadoc) * (non-Javadoc)
* @see eva2.tools.chart2d.DFunction#isDefinedAt(double) * @see eva2.tools.chart2d.DFunction#isDefinedAt(double)
*/ */
@Override
public boolean isDefinedAt(double source) { public boolean isDefinedAt(double source) {
return true; return true;
} }
@ -27,6 +28,7 @@ public class Exp extends DFunction {
* (non-Javadoc) * (non-Javadoc)
* @see eva2.tools.chart2d.DFunction#isInvertibleAt(double) * @see eva2.tools.chart2d.DFunction#isInvertibleAt(double)
*/ */
@Override
public boolean isInvertibleAt(double image) { public boolean isInvertibleAt(double image) {
return image > 0; return image > 0;
} }
@ -35,6 +37,7 @@ public class Exp extends DFunction {
* (non-Javadoc) * (non-Javadoc)
* @see eva2.tools.chart2d.DFunction#getImageOf(double) * @see eva2.tools.chart2d.DFunction#getImageOf(double)
*/ */
@Override
public double getImageOf(double source) { public double getImageOf(double source) {
return Math.exp(source); return Math.exp(source);
} }
@ -43,6 +46,7 @@ public class Exp extends DFunction {
* (non-Javadoc) * (non-Javadoc)
* @see eva2.tools.chart2d.DFunction#getSourceOf(double) * @see eva2.tools.chart2d.DFunction#getSourceOf(double)
*/ */
@Override
public double getSourceOf(double target) { public double getSourceOf(double target) {
if (target <= 0) { if (target <= 0) {
return Math.log(minValue); // think of a minimal value we want to show in case invalid values are requested return Math.log(minValue); // think of a minimal value we want to show in case invalid values are requested

View File

@ -30,6 +30,7 @@ public abstract class ExtActionChangedListener implements PropertyChangeListener
/** /**
* *
*/ */
@Override
public abstract void propertyChange(PropertyChangeEvent e); public abstract void propertyChange(PropertyChangeEvent e);
/** /**
* *

View File

@ -35,11 +35,13 @@ public class ExtDesktopManager extends DefaultDesktopManager {
this.desktop = desktop; this.desktop = desktop;
} }
@Override
public void activateFrame(JInternalFrame f) { public void activateFrame(JInternalFrame f) {
super.activateFrame(f); super.activateFrame(f);
activeFrame = f; activeFrame = f;
} }
@Override
public void deactivateFrame(JInternalFrame f) { public void deactivateFrame(JInternalFrame f) {
super.deactivateFrame(f); super.deactivateFrame(f);
if (activeFrame == f) { if (activeFrame == f) {
@ -51,6 +53,7 @@ public class ExtDesktopManager extends DefaultDesktopManager {
return activeFrame; return activeFrame;
} }
@Override
public void closeFrame(JInternalFrame internalFrame) { public void closeFrame(JInternalFrame internalFrame) {
LOGGER.log(Level.FINE, "Closing Internal Frame: {0}", internalFrame.getTitle()); LOGGER.log(Level.FINE, "Closing Internal Frame: {0}", internalFrame.getTitle());
super.closeFrame(internalFrame); super.closeFrame(internalFrame);

View File

@ -191,6 +191,7 @@ public class FunctionArea extends DArea implements Serializable {
private void addPopup() { private void addPopup() {
addMouseListener(new MouseAdapter() { addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if ((e.getModifiers() & InputEvent.BUTTON1_MASK) == InputEvent.BUTTON1_MASK) { if ((e.getModifiers() & InputEvent.BUTTON1_MASK) == InputEvent.BUTTON1_MASK) {
// do nothing // do nothing
@ -201,6 +202,7 @@ public class FunctionArea extends DArea implements Serializable {
addMenuItem(graphPopupMenu, "Rename graph", new ActionListener() { addMenuItem(graphPopupMenu, "Rename graph", new ActionListener() {
@Override
public void actionPerformed(ActionEvent ee) { public void actionPerformed(ActionEvent ee) {
renameGraph(getNearestGraphIndex(FunctionArea.this.xPos, FunctionArea.this.yPos)); renameGraph(getNearestGraphIndex(FunctionArea.this.xPos, FunctionArea.this.yPos));
} }
@ -212,6 +214,7 @@ public class FunctionArea extends DArea implements Serializable {
addMenuItem(graphPopupMenu, togGTTName, addMenuItem(graphPopupMenu, togGTTName,
new ActionListener() { new ActionListener() {
@Override
public void actionPerformed(ActionEvent ee) { public void actionPerformed(ActionEvent ee) {
setShowGraphToolTips(!isShowGraphToolTips()); setShowGraphToolTips(!isShowGraphToolTips());
} }
@ -221,6 +224,7 @@ public class FunctionArea extends DArea implements Serializable {
+ " legend"; + " legend";
addMenuItem(graphPopupMenu, togLName, new ActionListener() { addMenuItem(graphPopupMenu, togLName, new ActionListener() {
@Override
public void actionPerformed(ActionEvent ee) { public void actionPerformed(ActionEvent ee) {
toggleLegend(); toggleLegend();
} }
@ -228,6 +232,7 @@ public class FunctionArea extends DArea implements Serializable {
addMenuItem(graphPopupMenu, "Toggle scientific format", new ActionListener() { addMenuItem(graphPopupMenu, "Toggle scientific format", new ActionListener() {
@Override
public void actionPerformed(ActionEvent ee) { public void actionPerformed(ActionEvent ee) {
toggleScientificY(true); toggleScientificY(true);
} }
@ -237,6 +242,7 @@ public class FunctionArea extends DArea implements Serializable {
addMenuItem(graphPopupMenu, "Recolor all graphs", addMenuItem(graphPopupMenu, "Recolor all graphs",
new ActionListener() { new ActionListener() {
@Override
public void actionPerformed(ActionEvent ee) { public void actionPerformed(ActionEvent ee) {
recolorAllGraphsByIndex(); recolorAllGraphsByIndex();
} }
@ -249,6 +255,7 @@ public class FunctionArea extends DArea implements Serializable {
+ temp.x + "/" + temp.y + ")", + temp.x + "/" + temp.y + ")",
new ActionListener() { new ActionListener() {
@Override
public void actionPerformed(ActionEvent ee) { public void actionPerformed(ActionEvent ee) {
DPoint temp = getDMeasures().getDPoint( DPoint temp = getDMeasures().getDPoint(
xPos, yPos); xPos, yPos);
@ -268,6 +275,7 @@ public class FunctionArea extends DArea implements Serializable {
+ point.x + "/" + point.y + ")", + point.x + "/" + point.y + ")",
new ActionListener() { new ActionListener() {
@Override
public void actionPerformed(ActionEvent ee) { public void actionPerformed(ActionEvent ee) {
} }
}, false); }, false);
@ -275,6 +283,7 @@ public class FunctionArea extends DArea implements Serializable {
addMenuItem(graphPopupMenu, " Remove point", addMenuItem(graphPopupMenu, " Remove point",
new ActionListener() { new ActionListener() {
@Override
public void actionPerformed(ActionEvent ee) { public void actionPerformed(ActionEvent ee) {
removePoint(FunctionArea.this.xPos, removePoint(FunctionArea.this.xPos,
FunctionArea.this.yPos); FunctionArea.this.yPos);
@ -290,6 +299,7 @@ public class FunctionArea extends DArea implements Serializable {
addMenuItem(graphPopupMenu, selectTitle, addMenuItem(graphPopupMenu, selectTitle,
new ActionListener() { new ActionListener() {
@Override
public void actionPerformed( public void actionPerformed(
ActionEvent ee) { ActionEvent ee) {
((InterfaceSelectablePointIcon) currentPointIcon).getSelectionListener().individualSelected( ((InterfaceSelectablePointIcon) currentPointIcon).getSelectionListener().individualSelected(
@ -304,6 +314,7 @@ public class FunctionArea extends DArea implements Serializable {
addMenuItem(graphPopupMenu, " Show individual", addMenuItem(graphPopupMenu, " Show individual",
new ActionListener() { new ActionListener() {
@Override
public void actionPerformed( public void actionPerformed(
ActionEvent ee) { ActionEvent ee) {
((InterfaceDPointWithContent) currentPointIcon).showIndividual(); ((InterfaceDPointWithContent) currentPointIcon).showIndividual();
@ -325,16 +336,19 @@ public class FunctionArea extends DArea implements Serializable {
+ getGraphInfo(e.getX(), e.getY()), + getGraphInfo(e.getX(), e.getY()),
new ActionListener() { new ActionListener() {
@Override
public void actionPerformed(ActionEvent ee) { public void actionPerformed(ActionEvent ee) {
DPoint temp = FunctionArea.this.getDMeasures().getDPoint( DPoint temp = FunctionArea.this.getDMeasures().getDPoint(
FunctionArea.this.xPos, FunctionArea.this.xPos,
FunctionArea.this.yPos); FunctionArea.this.yPos);
DPointIcon icon1 = new DPointIcon() { DPointIcon icon1 = new DPointIcon() {
@Override
public DBorder getDBorder() { public DBorder getDBorder() {
return new DBorder(4, 4, 4, 4); return new DBorder(4, 4, 4, 4);
} }
@Override
public void paint(Graphics g) { public void paint(Graphics g) {
g.drawLine(-2, 0, 2, 0); g.drawLine(-2, 0, 2, 0);
g.drawLine(0, 0, 0, 4); g.drawLine(0, 0, 0, 4);
@ -348,6 +362,7 @@ public class FunctionArea extends DArea implements Serializable {
addMenuItem(graphPopupMenu, " Remove graph", addMenuItem(graphPopupMenu, " Remove graph",
new ActionListener() { new ActionListener() {
@Override
public void actionPerformed(ActionEvent ee) { public void actionPerformed(ActionEvent ee) {
clearGraph(FunctionArea.this.xPos, clearGraph(FunctionArea.this.xPos,
FunctionArea.this.yPos); FunctionArea.this.yPos);
@ -357,6 +372,7 @@ public class FunctionArea extends DArea implements Serializable {
addMenuItem(graphPopupMenu, " Change graph color", addMenuItem(graphPopupMenu, " Change graph color",
new ActionListener() { new ActionListener() {
@Override
public void actionPerformed(ActionEvent ee) { public void actionPerformed(ActionEvent ee) {
changeColorGraph(FunctionArea.this.xPos, changeColorGraph(FunctionArea.this.xPos,
FunctionArea.this.yPos); FunctionArea.this.yPos);

View File

@ -100,6 +100,7 @@ public class GOEPanel extends JPanel implements ItemListener {
propertySheetPanel.addPropertyChangeListener( propertySheetPanel.addPropertyChangeListener(
new PropertyChangeListener() { new PropertyChangeListener() {
@Override
public void propertyChange(final PropertyChangeEvent event) { public void propertyChange(final PropertyChangeEvent event) {
propChangeSupport.firePropertyChange("", backupObject, genericObjectEditor.getValue()); propChangeSupport.firePropertyChange("", backupObject, genericObjectEditor.getValue());
} }

View File

@ -75,6 +75,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
private ActionListener innerActionListener = new ActionListener() { private ActionListener innerActionListener = new ActionListener() {
// //
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
boolean consistentView = true; // be optimistic... boolean consistentView = true; // be optimistic...
if (view instanceof PropertyText) { // check consistency! if (view instanceof PropertyText) { // check consistency!
@ -171,6 +172,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
new ListSelectionListener() { new ListSelectionListener() {
// //
@Override
public void valueChanged(ListSelectionEvent e) { public void valueChanged(ListSelectionEvent e) {
if (e.getSource() == elementList) { if (e.getSource() == elementList) {
@ -216,6 +218,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
gae = genAE; gae = genAE;
} }
@Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) { if (e.getClickCount() == 2) {
int index = list.locationToIndex(e.getPoint()); int index = list.locationToIndex(e.getPoint());
@ -274,6 +277,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
* @param boolean true if the cell has the focus * @param boolean true if the cell has the focus
* @return the rendering component * @return the rendering component
*/ */
@Override
public Component getListCellRendererComponent(final JList list, public Component getListCellRendererComponent(final JList list,
final Object value, final Object value,
final int index, final int index,
@ -526,6 +530,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
private ActionListener makeSelectionKnownAL(final ActionListener al) { private ActionListener makeSelectionKnownAL(final ActionListener al) {
return new ActionListener() { return new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (selectableList != null) { if (selectableList != null) {
selectableList.setSelectionByIndices(elementList.getSelectedIndices()); selectableList.setSelectionByIndices(elementList.getSelectedIndices());
@ -550,6 +555,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
* *
* @param o an object that must be an array. * @param o an object that must be an array.
*/ */
@Override
public void setValue(Object o) { public void setValue(Object o) {
// Create a new list model, put it in the list and resize? // Create a new list model, put it in the list and resize?
updateEditorType(o); updateEditorType(o);
@ -580,6 +586,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
* *
* @return the current object array * @return the current object array
*/ */
@Override
public Object getValue() { public Object getValue() {
if (listModel == null) { if (listModel == null) {
return null; return null;
@ -606,6 +613,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
if (m_popupItemList.size() > 0) { if (m_popupItemList.size() > 0) {
elementList.addMouseListener(new MouseAdapter() { elementList.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if (selectableList != null) { if (selectableList != null) {
selectableList.setSelectionByIndices(elementList.getSelectedIndices()); selectableList.setSelectionByIndices(elementList.getSelectedIndices());
@ -650,6 +658,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
* *
* @return the java source code initialisation string * @return the java source code initialisation string
*/ */
@Override
public String getJavaInitializationString() { public String getJavaInitializationString() {
return "null"; return "null";
} }
@ -659,6 +668,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
* *
* @return true * @return true
*/ */
@Override
public boolean isPaintable() { public boolean isPaintable() {
return true; return true;
} }
@ -669,6 +679,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
* @param gfx the graphics context to use * @param gfx the graphics context to use
* @param box the area we are allowed to paint into * @param box the area we are allowed to paint into
*/ */
@Override
public void paintValue(Graphics gfx, Rectangle box) { public void paintValue(Graphics gfx, Rectangle box) {
FontMetrics fm = gfx.getFontMetrics(); FontMetrics fm = gfx.getFontMetrics();
int vpad = (box.height - fm.getAscent()) / 2; int vpad = (box.height - fm.getAscent()) / 2;
@ -689,6 +700,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
/** /**
* *
*/ */
@Override
public String getAsText() { public String getAsText() {
return null; return null;
} }
@ -696,6 +708,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
/** /**
* *
*/ */
@Override
public void setAsText(String text) throws IllegalArgumentException { public void setAsText(String text) throws IllegalArgumentException {
throw new IllegalArgumentException(text); throw new IllegalArgumentException(text);
} }
@ -703,6 +716,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
/** /**
* *
*/ */
@Override
public String[] getTags() { public String[] getTags() {
return null; return null;
} }
@ -710,6 +724,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
/** /**
* *
*/ */
@Override
public boolean supportsCustomEditor() { public boolean supportsCustomEditor() {
return true; return true;
} }
@ -717,10 +732,12 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
/** /**
* *
*/ */
@Override
public Component getCustomEditor() { public Component getCustomEditor() {
return this; return this;
} }
@Override
public void addPropertyChangeListener(PropertyChangeListener l) { public void addPropertyChangeListener(PropertyChangeListener l) {
if (propChangeSupport == null) { if (propChangeSupport == null) {
propChangeSupport = new PropertyChangeSupport(this); propChangeSupport = new PropertyChangeSupport(this);
@ -728,6 +745,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
propChangeSupport.addPropertyChangeListener(l); propChangeSupport.addPropertyChangeListener(l);
} }
@Override
public void removePropertyChangeListener(PropertyChangeListener l) { public void removePropertyChangeListener(PropertyChangeListener l) {
if (propChangeSupport == null) { if (propChangeSupport == null) {
propChangeSupport = new PropertyChangeSupport(this); propChangeSupport = new PropertyChangeSupport(this);
@ -759,6 +777,7 @@ public class GenericArrayEditor extends JPanel implements PropertyEditor {
this.withDeleteButton = wB; this.withDeleteButton = wB;
} }
@Override
public void removeNotify() { public void removeNotify() {
super.removeNotify(); super.removeNotify();
} }

View File

@ -42,12 +42,14 @@ class MyFocusListener implements FocusListener {
* (non-Javadoc) * (non-Javadoc)
* @see java.awt.event.FocusListener#focusLost(java.awt.event.FocusEvent) * @see java.awt.event.FocusListener#focusLost(java.awt.event.FocusEvent)
*/ */
@Override
public void focusLost(FocusEvent e) { } public void focusLost(FocusEvent e) { }
/* /*
* (non-Javadoc) * (non-Javadoc)
* @see java.awt.event.FocusListener#focusGained(java.awt.event.FocusEvent) * @see java.awt.event.FocusListener#focusGained(java.awt.event.FocusEvent)
*/ */
@Override
public void focusGained(FocusEvent e) { arrEditor.notifyFocusID(myID);}; public void focusGained(FocusEvent e) { arrEditor.notifyFocusID(myID);};
}; };
@ -100,6 +102,7 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
this.m_OKButton = new JButton("OK"); this.m_OKButton = new JButton("OK");
this.m_OKButton.setEnabled(true); this.m_OKButton.setEnabled(true);
this.m_OKButton.addActionListener(new ActionListener() { this.m_OKButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
//m_Backup = copyObject(m_Object); //m_Backup = copyObject(m_Object);
if ((m_CustomEditor.getTopLevelAncestor() != null) && (m_CustomEditor.getTopLevelAncestor() instanceof Window)) { if ((m_CustomEditor.getTopLevelAncestor() != null) && (m_CustomEditor.getTopLevelAncestor() instanceof Window)) {
@ -119,6 +122,7 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
/** This action listener adds an element to DoubleArray /** This action listener adds an element to DoubleArray
*/ */
ActionListener addAction = new ActionListener() { ActionListener addAction = new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
m_DoubleArray.addRowCopy(lastFocussedRow); // copy the last focussed row m_DoubleArray.addRowCopy(lastFocussedRow); // copy the last focussed row
updateEditor(); updateEditor();
@ -128,6 +132,7 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
/** This action listener removes an element from the DoubleArray. /** This action listener removes an element from the DoubleArray.
*/ */
ActionListener deleteAction = new ActionListener() { ActionListener deleteAction = new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
if (!m_DoubleArray.isValidRow(lastFocussedRow)) { if (!m_DoubleArray.isValidRow(lastFocussedRow)) {
m_DoubleArray.deleteRow(m_DoubleArray.getNumRows()-1); m_DoubleArray.deleteRow(m_DoubleArray.getNumRows()-1);
@ -142,6 +147,7 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
* This action listener nomalizes each columng of the values of the DoubleArray. * This action listener nomalizes each columng of the values of the DoubleArray.
*/ */
ActionListener normalizeAction = new ActionListener() { ActionListener normalizeAction = new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
m_DoubleArray.normalizeColumns(); m_DoubleArray.normalizeColumns();
updateEditor(); updateEditor();
@ -151,11 +157,14 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
/** This action listener reads all values /** This action listener reads all values
*/ */
KeyListener readDoubleArrayAction = new KeyListener() { KeyListener readDoubleArrayAction = new KeyListener() {
@Override
public void keyPressed(KeyEvent event) { public void keyPressed(KeyEvent event) {
} }
@Override
public void keyTyped(KeyEvent event) { public void keyTyped(KeyEvent event) {
} }
@Override
public void keyReleased(KeyEvent event) { public void keyReleased(KeyEvent event) {
double[][] tmpDD = new double[m_InputTextFields.length][m_InputTextFields[0].length]; double[][] tmpDD = new double[m_InputTextFields.length][m_InputTextFields[0].length];
@ -235,6 +244,7 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
/** This method will set the value of object that is to be edited. /** This method will set the value of object that is to be edited.
* @param o an object that must be an array. * @param o an object that must be an array.
*/ */
@Override
public void setValue(Object o) { public void setValue(Object o) {
if (o instanceof PropertyDoubleArray) { if (o instanceof PropertyDoubleArray) {
this.m_DoubleArray = (PropertyDoubleArray) o; this.m_DoubleArray = (PropertyDoubleArray) o;
@ -245,10 +255,12 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
/** Returns the current object. /** Returns the current object.
* @return the current object * @return the current object
*/ */
@Override
public Object getValue() { public Object getValue() {
return this.m_DoubleArray; return this.m_DoubleArray;
} }
@Override
public String getJavaInitializationString() { public String getJavaInitializationString() {
return "TEST"; return "TEST";
} }
@ -256,6 +268,7 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
/** /**
* *
*/ */
@Override
public String getAsText() { public String getAsText() {
return null; return null;
} }
@ -263,6 +276,7 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
/** /**
* *
*/ */
@Override
public void setAsText(String text) throws IllegalArgumentException { public void setAsText(String text) throws IllegalArgumentException {
throw new IllegalArgumentException(text); throw new IllegalArgumentException(text);
} }
@ -270,15 +284,18 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
/** /**
* *
*/ */
@Override
public String[] getTags() { public String[] getTags() {
return null; return null;
} }
@Override
public void addPropertyChangeListener(PropertyChangeListener l) { public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this); if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.addPropertyChangeListener(l); m_Support.addPropertyChangeListener(l);
} }
@Override
public void removePropertyChangeListener(PropertyChangeListener l) { public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this); if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.removePropertyChangeListener(l); m_Support.removePropertyChangeListener(l);
@ -301,6 +318,7 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
/** Returns true since the Object can be shown /** Returns true since the Object can be shown
* @return true * @return true
*/ */
@Override
public boolean isPaintable() { public boolean isPaintable() {
return true; return true;
} }
@ -310,6 +328,7 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
* @param gfx the graphics context to use * @param gfx the graphics context to use
* @param box the area we are allowed to paint into * @param box the area we are allowed to paint into
*/ */
@Override
public void paintValue(Graphics gfx, Rectangle box) { public void paintValue(Graphics gfx, Rectangle box) {
FontMetrics fm = gfx.getFontMetrics(); FontMetrics fm = gfx.getFontMetrics();
int vpad = (box.height - fm.getAscent()) / 2; int vpad = (box.height - fm.getAscent()) / 2;
@ -320,6 +339,7 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
/** Returns true because we do support a custom editor. /** Returns true because we do support a custom editor.
* @return true * @return true
*/ */
@Override
public boolean supportsCustomEditor() { public boolean supportsCustomEditor() {
return true; return true;
} }
@ -327,6 +347,7 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
/** Returns the array editing component. /** Returns the array editing component.
* @return a value of type 'java.awt.Component' * @return a value of type 'java.awt.Component'
*/ */
@Override
public Component getCustomEditor() { public Component getCustomEditor() {
if (this.m_CustomEditor == null) this.initCustomEditor(); if (this.m_CustomEditor == null) this.initCustomEditor();
return m_CustomEditor; return m_CustomEditor;

View File

@ -59,6 +59,7 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
this.m_OKButton = new JButton("OK"); this.m_OKButton = new JButton("OK");
this.m_OKButton.setEnabled(true); this.m_OKButton.setEnabled(true);
this.m_OKButton.addActionListener(new ActionListener() { this.m_OKButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
//m_Backup = copyObject(m_Object); //m_Backup = copyObject(m_Object);
if ((m_CustomEditor.getTopLevelAncestor() != null) && (m_CustomEditor.getTopLevelAncestor() instanceof Window)) { if ((m_CustomEditor.getTopLevelAncestor() != null) && (m_CustomEditor.getTopLevelAncestor() instanceof Window)) {
@ -75,6 +76,7 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
/** This action listener adds an element to DoubleArray /** This action listener adds an element to DoubleArray
*/ */
ItemListener objectiveAction = new ItemListener() { ItemListener objectiveAction = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent event) { public void itemStateChanged(ItemEvent event) {
m_EpsilonConstraint.m_OptimizeObjective = m_Objective.getSelectedIndex(); m_EpsilonConstraint.m_OptimizeObjective = m_Objective.getSelectedIndex();
updateEditor(); updateEditor();
@ -84,11 +86,14 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
/** This action listener reads all values /** This action listener reads all values
*/ */
KeyListener readDoubleArrayAction = new KeyListener() { KeyListener readDoubleArrayAction = new KeyListener() {
@Override
public void keyPressed(KeyEvent event) { public void keyPressed(KeyEvent event) {
} }
@Override
public void keyTyped(KeyEvent event) { public void keyTyped(KeyEvent event) {
} }
@Override
public void keyReleased(KeyEvent event) { public void keyReleased(KeyEvent event) {
double[] tmpT = m_EpsilonConstraint.m_TargetValue; double[] tmpT = m_EpsilonConstraint.m_TargetValue;
@ -143,6 +148,7 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
/** This method will set the value of object that is to be edited. /** This method will set the value of object that is to be edited.
* @param o an object that must be an array. * @param o an object that must be an array.
*/ */
@Override
public void setValue(Object o) { public void setValue(Object o) {
if (o instanceof PropertyEpsilonConstraint) { if (o instanceof PropertyEpsilonConstraint) {
this.m_EpsilonConstraint = (PropertyEpsilonConstraint) o; this.m_EpsilonConstraint = (PropertyEpsilonConstraint) o;
@ -153,10 +159,12 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
/** Returns the current object. /** Returns the current object.
* @return the current object * @return the current object
*/ */
@Override
public Object getValue() { public Object getValue() {
return this.m_EpsilonConstraint; return this.m_EpsilonConstraint;
} }
@Override
public String getJavaInitializationString() { public String getJavaInitializationString() {
return "TEST"; return "TEST";
} }
@ -164,6 +172,7 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
/** /**
* *
*/ */
@Override
public String getAsText() { public String getAsText() {
return null; return null;
} }
@ -171,6 +180,7 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
/** /**
* *
*/ */
@Override
public void setAsText(String text) throws IllegalArgumentException { public void setAsText(String text) throws IllegalArgumentException {
throw new IllegalArgumentException(text); throw new IllegalArgumentException(text);
} }
@ -178,15 +188,18 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
/** /**
* *
*/ */
@Override
public String[] getTags() { public String[] getTags() {
return null; return null;
} }
@Override
public void addPropertyChangeListener(PropertyChangeListener l) { public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this); if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.addPropertyChangeListener(l); m_Support.addPropertyChangeListener(l);
} }
@Override
public void removePropertyChangeListener(PropertyChangeListener l) { public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this); if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.removePropertyChangeListener(l); m_Support.removePropertyChangeListener(l);
@ -209,6 +222,7 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
/** Returns true since the Object can be shown /** Returns true since the Object can be shown
* @return true * @return true
*/ */
@Override
public boolean isPaintable() { public boolean isPaintable() {
return true; return true;
} }
@ -218,6 +232,7 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
* @param gfx the graphics context to use * @param gfx the graphics context to use
* @param box the area we are allowed to paint into * @param box the area we are allowed to paint into
*/ */
@Override
public void paintValue(Graphics gfx, Rectangle box) { public void paintValue(Graphics gfx, Rectangle box) {
FontMetrics fm = gfx.getFontMetrics(); FontMetrics fm = gfx.getFontMetrics();
int vpad = (box.height - fm.getAscent()) / 2; int vpad = (box.height - fm.getAscent()) / 2;
@ -228,6 +243,7 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
/** Returns true because we do support a custom editor. /** Returns true because we do support a custom editor.
* @return true * @return true
*/ */
@Override
public boolean supportsCustomEditor() { public boolean supportsCustomEditor() {
return true; return true;
} }
@ -235,6 +251,7 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
/** Returns the array editing component. /** Returns the array editing component.
* @return a value of type 'java.awt.Component' * @return a value of type 'java.awt.Component'
*/ */
@Override
public Component getCustomEditor() { public Component getCustomEditor() {
if (this.m_CustomEditor == null) this.initCustomEditor(); if (this.m_CustomEditor == null) this.initCustomEditor();
return m_CustomEditor; return m_CustomEditor;

View File

@ -59,6 +59,7 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
this.m_OKButton = new JButton("OK"); this.m_OKButton = new JButton("OK");
this.m_OKButton.setEnabled(true); this.m_OKButton.setEnabled(true);
this.m_OKButton.addActionListener(new ActionListener() { this.m_OKButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
//m_Backup = copyObject(m_Object); //m_Backup = copyObject(m_Object);
if ((m_CustomEditor.getTopLevelAncestor() != null) && (m_CustomEditor.getTopLevelAncestor() instanceof Window)) { if ((m_CustomEditor.getTopLevelAncestor() != null) && (m_CustomEditor.getTopLevelAncestor() instanceof Window)) {
@ -75,6 +76,7 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
/** This action listener adds an element to DoubleArray /** This action listener adds an element to DoubleArray
*/ */
ItemListener objectiveAction = new ItemListener() { ItemListener objectiveAction = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent event) { public void itemStateChanged(ItemEvent event) {
m_EpsilonThreshhold.m_OptimizeObjective = m_Objective.getSelectedIndex(); m_EpsilonThreshhold.m_OptimizeObjective = m_Objective.getSelectedIndex();
updateEditor(); updateEditor();
@ -84,11 +86,14 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
/** This action listener reads all values /** This action listener reads all values
*/ */
KeyListener readDoubleArrayAction = new KeyListener() { KeyListener readDoubleArrayAction = new KeyListener() {
@Override
public void keyPressed(KeyEvent event) { public void keyPressed(KeyEvent event) {
} }
@Override
public void keyTyped(KeyEvent event) { public void keyTyped(KeyEvent event) {
} }
@Override
public void keyReleased(KeyEvent event) { public void keyReleased(KeyEvent event) {
double[] tmpT = m_EpsilonThreshhold.m_TargetValue; double[] tmpT = m_EpsilonThreshhold.m_TargetValue;
double[] tmpP = m_EpsilonThreshhold.m_Punishment; double[] tmpP = m_EpsilonThreshhold.m_Punishment;
@ -160,6 +165,7 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
/** This method will set the value of object that is to be edited. /** This method will set the value of object that is to be edited.
* @param o an object that must be an array. * @param o an object that must be an array.
*/ */
@Override
public void setValue(Object o) { public void setValue(Object o) {
if (o instanceof PropertyEpsilonThreshold) { if (o instanceof PropertyEpsilonThreshold) {
this.m_EpsilonThreshhold = (PropertyEpsilonThreshold) o; this.m_EpsilonThreshhold = (PropertyEpsilonThreshold) o;
@ -170,10 +176,12 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
/** Returns the current object. /** Returns the current object.
* @return the current object * @return the current object
*/ */
@Override
public Object getValue() { public Object getValue() {
return this.m_EpsilonThreshhold; return this.m_EpsilonThreshhold;
} }
@Override
public String getJavaInitializationString() { public String getJavaInitializationString() {
return "TEST"; return "TEST";
} }
@ -181,6 +189,7 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
/** /**
* *
*/ */
@Override
public String getAsText() { public String getAsText() {
return null; return null;
} }
@ -188,6 +197,7 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
/** /**
* *
*/ */
@Override
public void setAsText(String text) throws IllegalArgumentException { public void setAsText(String text) throws IllegalArgumentException {
throw new IllegalArgumentException(text); throw new IllegalArgumentException(text);
} }
@ -195,15 +205,18 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
/** /**
* *
*/ */
@Override
public String[] getTags() { public String[] getTags() {
return null; return null;
} }
@Override
public void addPropertyChangeListener(PropertyChangeListener l) { public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this); if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.addPropertyChangeListener(l); m_Support.addPropertyChangeListener(l);
} }
@Override
public void removePropertyChangeListener(PropertyChangeListener l) { public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this); if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.removePropertyChangeListener(l); m_Support.removePropertyChangeListener(l);
@ -226,6 +239,7 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
/** Returns true since the Object can be shown /** Returns true since the Object can be shown
* @return true * @return true
*/ */
@Override
public boolean isPaintable() { public boolean isPaintable() {
return true; return true;
} }
@ -235,6 +249,7 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
* @param gfx the graphics context to use * @param gfx the graphics context to use
* @param box the area we are allowed to paint into * @param box the area we are allowed to paint into
*/ */
@Override
public void paintValue(Graphics gfx, Rectangle box) { public void paintValue(Graphics gfx, Rectangle box) {
FontMetrics fm = gfx.getFontMetrics(); FontMetrics fm = gfx.getFontMetrics();
int vpad = (box.height - fm.getAscent()) / 2; int vpad = (box.height - fm.getAscent()) / 2;
@ -245,6 +260,7 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
/** Returns true because we do support a custom editor. /** Returns true because we do support a custom editor.
* @return true * @return true
*/ */
@Override
public boolean supportsCustomEditor() { public boolean supportsCustomEditor() {
return true; return true;
} }
@ -252,6 +268,7 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
/** Returns the array editing component. /** Returns the array editing component.
* @return a value of type 'java.awt.Component' * @return a value of type 'java.awt.Component'
*/ */
@Override
public Component getCustomEditor() { public Component getCustomEditor() {
if (this.m_CustomEditor == null) this.initCustomEditor(); if (this.m_CustomEditor == null) this.initCustomEditor();
return m_CustomEditor; return m_CustomEditor;

View File

@ -39,6 +39,7 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor {
/** This method will set the value of object that is to be edited. /** This method will set the value of object that is to be edited.
* @param o an object that must be an array. * @param o an object that must be an array.
*/ */
@Override
public void setValue(Object o) { public void setValue(Object o) {
if (o instanceof PropertyFilePath) { if (o instanceof PropertyFilePath) {
this.m_FilePath = (PropertyFilePath) o; this.m_FilePath = (PropertyFilePath) o;
@ -48,10 +49,12 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor {
/** Returns the current object. /** Returns the current object.
* @return the current object * @return the current object
*/ */
@Override
public Object getValue() { public Object getValue() {
return this.m_FilePath; return this.m_FilePath;
} }
@Override
public String getJavaInitializationString() { public String getJavaInitializationString() {
return "TEST"; return "TEST";
} }
@ -59,6 +62,7 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor {
/** /**
* *
*/ */
@Override
public String getAsText() { public String getAsText() {
return null; return null;
} }
@ -66,6 +70,7 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor {
/** /**
* *
*/ */
@Override
public void setAsText(String text) throws IllegalArgumentException { public void setAsText(String text) throws IllegalArgumentException {
throw new IllegalArgumentException(text); throw new IllegalArgumentException(text);
} }
@ -73,15 +78,18 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor {
/** /**
* *
*/ */
@Override
public String[] getTags() { public String[] getTags() {
return null; return null;
} }
@Override
public void addPropertyChangeListener(PropertyChangeListener l) { public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this); if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.addPropertyChangeListener(l); m_Support.addPropertyChangeListener(l);
} }
@Override
public void removePropertyChangeListener(PropertyChangeListener l) { public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this); if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.removePropertyChangeListener(l); m_Support.removePropertyChangeListener(l);
@ -90,6 +98,7 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor {
/** Returns true since the Object can be shown /** Returns true since the Object can be shown
* @return true * @return true
*/ */
@Override
public boolean isPaintable() { public boolean isPaintable() {
return true; return true;
} }
@ -99,6 +108,7 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor {
* @param gfx the graphics context to use * @param gfx the graphics context to use
* @param box the area we are allowed to paint into * @param box the area we are allowed to paint into
*/ */
@Override
public void paintValue(Graphics gfx, Rectangle box) { public void paintValue(Graphics gfx, Rectangle box) {
FontMetrics fm = gfx.getFontMetrics(); FontMetrics fm = gfx.getFontMetrics();
int vpad = (box.height - fm.getAscent()) / 2; int vpad = (box.height - fm.getAscent()) / 2;
@ -109,6 +119,7 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor {
/** Returns true because we do support a custom editor. /** Returns true because we do support a custom editor.
* @return true * @return true
*/ */
@Override
public boolean supportsCustomEditor() { public boolean supportsCustomEditor() {
return true; return true;
} }
@ -116,6 +127,7 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor {
/** Returns the array editing component. /** Returns the array editing component.
* @return a value of type 'java.awt.Component' * @return a value of type 'java.awt.Component'
*/ */
@Override
public Component getCustomEditor() { public Component getCustomEditor() {
this.m_Panel = new JPanel(); this.m_Panel = new JPanel();
this.m_FileChooser = new JFileChooser(); this.m_FileChooser = new JFileChooser();
@ -131,6 +143,7 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor {
* the SOM to recalculate the mapping. * the SOM to recalculate the mapping.
*/ */
ActionListener fileChooserAction = new ActionListener() { ActionListener fileChooserAction = new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
if (event.getActionCommand() == "ApproveSelection") { if (event.getActionCommand() == "ApproveSelection") {
m_FilePath.setCompleteFilePath(m_FileChooser.getSelectedFile().getAbsolutePath()); m_FilePath.setCompleteFilePath(m_FileChooser.getSelectedFile().getAbsolutePath());

View File

@ -53,6 +53,7 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
this.m_OKButton = new JButton("OK"); this.m_OKButton = new JButton("OK");
this.m_OKButton.setEnabled(true); this.m_OKButton.setEnabled(true);
this.m_OKButton.addActionListener(new ActionListener() { this.m_OKButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
//m_Backup = copyObject(m_Object); //m_Backup = copyObject(m_Object);
if ((m_CustomEditor.getTopLevelAncestor() != null) && (m_CustomEditor.getTopLevelAncestor() instanceof Window)) { if ((m_CustomEditor.getTopLevelAncestor() != null) && (m_CustomEditor.getTopLevelAncestor() instanceof Window)) {
@ -69,11 +70,14 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
/** This action listener reads all values /** This action listener reads all values
*/ */
KeyListener readIntArrayAction = new KeyListener() { KeyListener readIntArrayAction = new KeyListener() {
@Override
public void keyPressed(KeyEvent event) { public void keyPressed(KeyEvent event) {
} }
@Override
public void keyTyped(KeyEvent event) { public void keyTyped(KeyEvent event) {
} }
@Override
public void keyReleased(KeyEvent event) { public void keyReleased(KeyEvent event) {
int[] tmpD = new int[m_InputTextField.length]; int[] tmpD = new int[m_InputTextField.length];
@ -122,6 +126,7 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
/** This method will set the value of object that is to be edited. /** This method will set the value of object that is to be edited.
* @param o an object that must be an array. * @param o an object that must be an array.
*/ */
@Override
public void setValue(Object o) { public void setValue(Object o) {
if (o instanceof PropertyIntArray) { if (o instanceof PropertyIntArray) {
this.m_IntArray = (PropertyIntArray) o; this.m_IntArray = (PropertyIntArray) o;
@ -132,10 +137,12 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
/** Returns the current object. /** Returns the current object.
* @return the current object * @return the current object
*/ */
@Override
public Object getValue() { public Object getValue() {
return this.m_IntArray; return this.m_IntArray;
} }
@Override
public String getJavaInitializationString() { public String getJavaInitializationString() {
return "TEST"; return "TEST";
} }
@ -143,6 +150,7 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
/** /**
* *
*/ */
@Override
public String getAsText() { public String getAsText() {
return null; return null;
} }
@ -150,6 +158,7 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
/** /**
* *
*/ */
@Override
public void setAsText(String text) throws IllegalArgumentException { public void setAsText(String text) throws IllegalArgumentException {
throw new IllegalArgumentException(text); throw new IllegalArgumentException(text);
} }
@ -157,15 +166,18 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
/** /**
* *
*/ */
@Override
public String[] getTags() { public String[] getTags() {
return null; return null;
} }
@Override
public void addPropertyChangeListener(PropertyChangeListener l) { public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this); if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.addPropertyChangeListener(l); m_Support.addPropertyChangeListener(l);
} }
@Override
public void removePropertyChangeListener(PropertyChangeListener l) { public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this); if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.removePropertyChangeListener(l); m_Support.removePropertyChangeListener(l);
@ -188,6 +200,7 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
/** Returns true since the Object can be shown /** Returns true since the Object can be shown
* @return true * @return true
*/ */
@Override
public boolean isPaintable() { public boolean isPaintable() {
return true; return true;
} }
@ -197,6 +210,7 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
* @param gfx the graphics context to use * @param gfx the graphics context to use
* @param box the area we are allowed to paint into * @param box the area we are allowed to paint into
*/ */
@Override
public void paintValue(Graphics gfx, Rectangle box) { public void paintValue(Graphics gfx, Rectangle box) {
FontMetrics fm = gfx.getFontMetrics(); FontMetrics fm = gfx.getFontMetrics();
int vpad = (box.height - fm.getAscent()) / 2; int vpad = (box.height - fm.getAscent()) / 2;
@ -207,6 +221,7 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
/** Returns true because we do support a custom editor. /** Returns true because we do support a custom editor.
* @return true * @return true
*/ */
@Override
public boolean supportsCustomEditor() { public boolean supportsCustomEditor() {
return true; return true;
} }
@ -214,6 +229,7 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
/** Returns the array editing component. /** Returns the array editing component.
* @return a value of type 'java.awt.Component' * @return a value of type 'java.awt.Component'
*/ */
@Override
public Component getCustomEditor() { public Component getCustomEditor() {
if (this.m_CustomEditor == null) this.initCustomEditor(); if (this.m_CustomEditor == null) this.initCustomEditor();
return m_CustomEditor; return m_CustomEditor;

View File

@ -311,6 +311,7 @@ public class GenericObjectEditor implements PropertyEditor {
* *
* @param o an object that must be a Object. * @param o an object that must be a Object.
*/ */
@Override
public void setValue(Object o) { public void setValue(Object o) {
//System.err.println("setValue()" + m_ClassType.toString()); //System.err.println("setValue()" + m_ClassType.toString());
@ -363,6 +364,7 @@ public class GenericObjectEditor implements PropertyEditor {
* *
* @return the current Object * @return the current Object
*/ */
@Override
public Object getValue() { public Object getValue() {
return m_Object; return m_Object;
} }
@ -374,6 +376,7 @@ public class GenericObjectEditor implements PropertyEditor {
* *
* @return the java source code initialization string * @return the java source code initialization string
*/ */
@Override
public String getJavaInitializationString() { public String getJavaInitializationString() {
return "new " + m_Object.getClass().getName() + "()"; return "new " + m_Object.getClass().getName() + "()";
} }
@ -383,6 +386,7 @@ public class GenericObjectEditor implements PropertyEditor {
* *
* @return true * @return true
*/ */
@Override
public boolean isPaintable() { public boolean isPaintable() {
return true; return true;
} }
@ -393,6 +397,7 @@ public class GenericObjectEditor implements PropertyEditor {
* @param gfx the graphics context to use * @param gfx the graphics context to use
* @param box the area we are allowed to paint into * @param box the area we are allowed to paint into
*/ */
@Override
public void paintValue(Graphics gfx, Rectangle box) { public void paintValue(Graphics gfx, Rectangle box) {
if (isEnabled && m_Object != null) { if (isEnabled && m_Object != null) {
int getNameMethod = -1; int getNameMethod = -1;
@ -435,6 +440,7 @@ public class GenericObjectEditor implements PropertyEditor {
* *
* @return null * @return null
*/ */
@Override
public String getAsText() { public String getAsText() {
return null; return null;
} }
@ -445,6 +451,7 @@ public class GenericObjectEditor implements PropertyEditor {
* @param text the text value * @param text the text value
* @exception IllegalArgumentException as we don't support getting/setting values as text. * @exception IllegalArgumentException as we don't support getting/setting values as text.
*/ */
@Override
public void setAsText(String text) throws IllegalArgumentException { public void setAsText(String text) throws IllegalArgumentException {
throw new IllegalArgumentException(text); throw new IllegalArgumentException(text);
} }
@ -454,6 +461,7 @@ public class GenericObjectEditor implements PropertyEditor {
* *
* @return null * @return null
*/ */
@Override
public String[] getTags() { public String[] getTags() {
return null; return null;
} }
@ -463,6 +471,7 @@ public class GenericObjectEditor implements PropertyEditor {
* *
* @return true * @return true
*/ */
@Override
public boolean supportsCustomEditor() { public boolean supportsCustomEditor() {
return true; return true;
} }
@ -472,6 +481,7 @@ public class GenericObjectEditor implements PropertyEditor {
* *
* @return a value of type 'java.awt.Component' * @return a value of type 'java.awt.Component'
*/ */
@Override
public Component getCustomEditor() { public Component getCustomEditor() {
if (editorComponent == null) { if (editorComponent == null) {
editorComponent = new GOEPanel(m_Object, m_Backup, propertyChangeSupport, this); editorComponent = new GOEPanel(m_Object, m_Backup, propertyChangeSupport, this);
@ -490,6 +500,7 @@ public class GenericObjectEditor implements PropertyEditor {
editorComponent.setEnabledOkCancelButtons(false); editorComponent.setEnabledOkCancelButtons(false);
} }
@Override
public void addPropertyChangeListener(PropertyChangeListener l) { public void addPropertyChangeListener(PropertyChangeListener l) {
if (propertyChangeSupport == null) { if (propertyChangeSupport == null) {
propertyChangeSupport = new PropertyChangeSupport(this); propertyChangeSupport = new PropertyChangeSupport(this);
@ -497,6 +508,7 @@ public class GenericObjectEditor implements PropertyEditor {
propertyChangeSupport.addPropertyChangeListener(l); propertyChangeSupport.addPropertyChangeListener(l);
} }
@Override
public void removePropertyChangeListener(PropertyChangeListener l) { public void removePropertyChangeListener(PropertyChangeListener l) {
if (propertyChangeSupport == null) { if (propertyChangeSupport == null) {
propertyChangeSupport = new PropertyChangeSupport(this); propertyChangeSupport = new PropertyChangeSupport(this);

View File

@ -48,6 +48,7 @@ public class GenericObjectListSelectionEditor extends AbstractListSelectionEdito
/** Retruns the current object. /** Retruns the current object.
* @return the current object * @return the current object
*/ */
@Override
public Object getValue() { public Object getValue() {
return objList; return objList;
} }

View File

@ -194,6 +194,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
/** This action listener,... /** This action listener,...
*/ */
ActionListener updateTargets = new ActionListener() { ActionListener updateTargets = new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
updateTargetList(); updateTargetList();
} }
@ -202,6 +203,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
/** This action listener,... /** This action listener,...
*/ */
ActionListener addTarget = new ActionListener() { ActionListener addTarget = new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
m_OptimizationObjectives.addTarget((InterfaceOptimizationObjective)m_OptimizationObjectives.getAvailableTargets()[0].clone()); m_OptimizationObjectives.addTarget((InterfaceOptimizationObjective)m_OptimizationObjectives.getAvailableTargets()[0].clone());
int l = m_OptimizationObjectives.getSelectedTargets().length; int l = m_OptimizationObjectives.getSelectedTargets().length;
@ -234,6 +236,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
/** This action listener,... /** This action listener,...
*/ */
ActionListener deleteTarget = new ActionListener() { ActionListener deleteTarget = new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
int l = m_OptimizationObjectives.getSelectedTargets().length, j = 0; int l = m_OptimizationObjectives.getSelectedTargets().length, j = 0;
GeneralGOEProperty[] newEdit = new GeneralGOEProperty[l-1]; GeneralGOEProperty[] newEdit = new GeneralGOEProperty[l-1];
@ -266,6 +269,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
/** This method will set the value of object that is to be edited. /** This method will set the value of object that is to be edited.
* @param o an object that must be an array. * @param o an object that must be an array.
*/ */
@Override
public void setValue(Object o) { public void setValue(Object o) {
if (o instanceof PropertyOptimizationObjectives) { if (o instanceof PropertyOptimizationObjectives) {
this.m_OptimizationObjectives= (PropertyOptimizationObjectives) o; this.m_OptimizationObjectives= (PropertyOptimizationObjectives) o;
@ -276,10 +280,12 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
/** Returns the current object. /** Returns the current object.
* @return the current object * @return the current object
*/ */
@Override
public Object getValue() { public Object getValue() {
return this.m_OptimizationObjectives; return this.m_OptimizationObjectives;
} }
@Override
public String getJavaInitializationString() { public String getJavaInitializationString() {
return "TEST"; return "TEST";
} }
@ -287,6 +293,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
/** /**
* *
*/ */
@Override
public String getAsText() { public String getAsText() {
return null; return null;
} }
@ -294,6 +301,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
/** /**
* *
*/ */
@Override
public void setAsText(String text) throws IllegalArgumentException { public void setAsText(String text) throws IllegalArgumentException {
throw new IllegalArgumentException(text); throw new IllegalArgumentException(text);
} }
@ -301,6 +309,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
/** /**
* *
*/ */
@Override
public String[] getTags() { public String[] getTags() {
return null; return null;
} }
@ -322,6 +331,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
/** Returns true since the Object can be shown /** Returns true since the Object can be shown
* @return true * @return true
*/ */
@Override
public boolean isPaintable() { public boolean isPaintable() {
return true; return true;
} }
@ -331,6 +341,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
* @param gfx the graphics context to use * @param gfx the graphics context to use
* @param box the area we are allowed to paint into * @param box the area we are allowed to paint into
*/ */
@Override
public void paintValue(Graphics gfx, Rectangle box) { public void paintValue(Graphics gfx, Rectangle box) {
FontMetrics fm = gfx.getFontMetrics(); FontMetrics fm = gfx.getFontMetrics();
int vpad = (box.height - fm.getAscent()) / 2; int vpad = (box.height - fm.getAscent()) / 2;
@ -341,6 +352,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
/** Returns true because we do support a custom editor. /** Returns true because we do support a custom editor.
* @return true * @return true
*/ */
@Override
public boolean supportsCustomEditor() { public boolean supportsCustomEditor() {
return true; return true;
} }
@ -348,6 +360,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
/** Returns the array editing component. /** Returns the array editing component.
* @return a value of type 'java.awt.Component' * @return a value of type 'java.awt.Component'
*/ */
@Override
public Component getCustomEditor() { public Component getCustomEditor() {
if (this.m_Editor == null) this.initCustomEditor(); if (this.m_Editor == null) this.initCustomEditor();
return m_Editor; return m_Editor;
@ -363,11 +376,13 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
/********************************* java.beans.PropertyChangeListener *************************/ /********************************* java.beans.PropertyChangeListener *************************/
@Override
public void addPropertyChangeListener(PropertyChangeListener l) { public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this); if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.addPropertyChangeListener(l); m_Support.addPropertyChangeListener(l);
} }
@Override
public void removePropertyChangeListener(PropertyChangeListener l) { public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this); if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.removePropertyChangeListener(l); m_Support.removePropertyChangeListener(l);
@ -376,6 +391,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
* editing an object. * editing an object.
* @param evt * @param evt
*/ */
@Override
public void propertyChange(PropertyChangeEvent evt) { public void propertyChange(PropertyChangeEvent evt) {
Object newVal = evt.getNewValue(); Object newVal = evt.getNewValue();
Object oldVal = evt.getOldValue(); Object oldVal = evt.getOldValue();

View File

@ -218,6 +218,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
/** This action listener,... /** This action listener,...
*/ */
ActionListener updateTargets = new ActionListener() { ActionListener updateTargets = new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
updateTargetList(); updateTargetList();
} }
@ -226,6 +227,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
/** This action listener,... /** This action listener,...
*/ */
ActionListener addTarget = new ActionListener() { ActionListener addTarget = new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
m_OptimizationObjectivesWithWeights.addTarget((InterfaceOptimizationObjective)m_OptimizationObjectivesWithWeights.getAvailableTargets()[0].clone()); m_OptimizationObjectivesWithWeights.addTarget((InterfaceOptimizationObjective)m_OptimizationObjectivesWithWeights.getAvailableTargets()[0].clone());
int l = m_OptimizationObjectivesWithWeights.getSelectedTargets().length; int l = m_OptimizationObjectivesWithWeights.getSelectedTargets().length;
@ -258,6 +260,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
/** This action listener,... /** This action listener,...
*/ */
ActionListener deleteTarget = new ActionListener() { ActionListener deleteTarget = new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
int l = m_OptimizationObjectivesWithWeights.getSelectedTargets().length, j = 0; int l = m_OptimizationObjectivesWithWeights.getSelectedTargets().length, j = 0;
GeneralGOEProperty[] newEdit = new GeneralGOEProperty[l-1]; GeneralGOEProperty[] newEdit = new GeneralGOEProperty[l-1];
@ -276,6 +279,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
/** This action listener,... /** This action listener,...
*/ */
ActionListener normalizeWeights = new ActionListener() { ActionListener normalizeWeights = new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
double[] newW = m_OptimizationObjectivesWithWeights.getWeights(); double[] newW = m_OptimizationObjectivesWithWeights.getWeights();
double sum = 0; double sum = 0;
@ -295,11 +299,14 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
/** This action listener reads all values /** This action listener reads all values
*/ */
KeyListener readDoubleArrayAction = new KeyListener() { KeyListener readDoubleArrayAction = new KeyListener() {
@Override
public void keyPressed(KeyEvent event) { public void keyPressed(KeyEvent event) {
} }
@Override
public void keyTyped(KeyEvent event) { public void keyTyped(KeyEvent event) {
} }
@Override
public void keyReleased(KeyEvent event) { public void keyReleased(KeyEvent event) {
double[] newW = m_OptimizationObjectivesWithWeights.getWeights(); double[] newW = m_OptimizationObjectivesWithWeights.getWeights();
@ -332,6 +339,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
/** This method will set the value of object that is to be edited. /** This method will set the value of object that is to be edited.
* @param o an object that must be an array. * @param o an object that must be an array.
*/ */
@Override
public void setValue(Object o) { public void setValue(Object o) {
if (o instanceof PropertyOptimizationObjectivesWithParam) { if (o instanceof PropertyOptimizationObjectivesWithParam) {
this.m_OptimizationObjectivesWithWeights= (PropertyOptimizationObjectivesWithParam) o; this.m_OptimizationObjectivesWithWeights= (PropertyOptimizationObjectivesWithParam) o;
@ -342,10 +350,12 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
/** Returns the current object. /** Returns the current object.
* @return the current object * @return the current object
*/ */
@Override
public Object getValue() { public Object getValue() {
return this.m_OptimizationObjectivesWithWeights; return this.m_OptimizationObjectivesWithWeights;
} }
@Override
public String getJavaInitializationString() { public String getJavaInitializationString() {
return "TEST"; return "TEST";
} }
@ -353,6 +363,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
/** /**
* *
*/ */
@Override
public String getAsText() { public String getAsText() {
return null; return null;
} }
@ -360,6 +371,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
/** /**
* *
*/ */
@Override
public void setAsText(String text) throws IllegalArgumentException { public void setAsText(String text) throws IllegalArgumentException {
throw new IllegalArgumentException(text); throw new IllegalArgumentException(text);
} }
@ -367,6 +379,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
/** /**
* *
*/ */
@Override
public String[] getTags() { public String[] getTags() {
return null; return null;
} }
@ -388,6 +401,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
/** Returns true since the Object can be shown /** Returns true since the Object can be shown
* @return true * @return true
*/ */
@Override
public boolean isPaintable() { public boolean isPaintable() {
return true; return true;
} }
@ -397,6 +411,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
* @param gfx the graphics context to use * @param gfx the graphics context to use
* @param box the area we are allowed to paint into * @param box the area we are allowed to paint into
*/ */
@Override
public void paintValue(Graphics gfx, Rectangle box) { public void paintValue(Graphics gfx, Rectangle box) {
FontMetrics fm = gfx.getFontMetrics(); FontMetrics fm = gfx.getFontMetrics();
int vpad = (box.height - fm.getAscent()) / 2; int vpad = (box.height - fm.getAscent()) / 2;
@ -407,6 +422,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
/** Returns true because we do support a custom editor. /** Returns true because we do support a custom editor.
* @return true * @return true
*/ */
@Override
public boolean supportsCustomEditor() { public boolean supportsCustomEditor() {
return true; return true;
} }
@ -414,6 +430,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
/** Returns the array editing component. /** Returns the array editing component.
* @return a value of type 'java.awt.Component' * @return a value of type 'java.awt.Component'
*/ */
@Override
public Component getCustomEditor() { public Component getCustomEditor() {
if (this.m_Editor == null) this.initCustomEditor(); if (this.m_Editor == null) this.initCustomEditor();
return m_Editor; return m_Editor;
@ -429,11 +446,13 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
/********************************* java.beans.PropertyChangeListener *************************/ /********************************* java.beans.PropertyChangeListener *************************/
@Override
public void addPropertyChangeListener(PropertyChangeListener l) { public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this); if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.addPropertyChangeListener(l); m_Support.addPropertyChangeListener(l);
} }
@Override
public void removePropertyChangeListener(PropertyChangeListener l) { public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this); if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.removePropertyChangeListener(l); m_Support.removePropertyChangeListener(l);
@ -442,6 +461,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
* editing an object. * editing an object.
* @param evt * @param evt
*/ */
@Override
public void propertyChange(PropertyChangeEvent evt) { public void propertyChange(PropertyChangeEvent evt) {
Object newVal = evt.getNewValue(); Object newVal = evt.getNewValue();
Object oldVal = evt.getOldValue(); Object oldVal = evt.getOldValue();

View File

@ -198,6 +198,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor
/** This action listener,... /** This action listener,...
*/ */
ActionListener saveServers = new ActionListener() { ActionListener saveServers = new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
String text = m_RemoteServers.writeToText(); String text = m_RemoteServers.writeToText();
JFileChooser saver = new JFileChooser(); JFileChooser saver = new JFileChooser();
@ -222,6 +223,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor
/** This action listener,... /** This action listener,...
*/ */
ActionListener killServers = new ActionListener() { ActionListener killServers = new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
m_RemoteServers.killServers(); m_RemoteServers.killServers();
updateServerList(); updateServerList();
@ -231,6 +233,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor
/** This action listener,... /** This action listener,...
*/ */
ActionListener startServers = new ActionListener() { ActionListener startServers = new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
m_RemoteServers.startServers(); m_RemoteServers.startServers();
updateServerList(); updateServerList();
@ -240,6 +243,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor
/** This action listener,... /** This action listener,...
*/ */
ActionListener updateServers = new ActionListener() { ActionListener updateServers = new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
updateServerList(); updateServerList();
} }
@ -248,6 +252,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor
/** This action listener,... /** This action listener,...
*/ */
ActionListener addServer = new ActionListener() { ActionListener addServer = new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
m_RemoteServers.addServerNode("noname-"+m_RemoteServers.size(), 1); m_RemoteServers.addServerNode("noname-"+m_RemoteServers.size(), 1);
updateServerList(); updateServerList();
@ -258,6 +263,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor
/** This action listener,... /** This action listener,...
*/ */
ActionListener deleteServer = new ActionListener() { ActionListener deleteServer = new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
for (int i = 0; i < m_Delete.length; i++) { for (int i = 0; i < m_Delete.length; i++) {
if (event.getSource().equals(m_Delete[i])) m_RemoteServers.removeServerNode(m_RemoteServers.get(i).m_ServerName); if (event.getSource().equals(m_Delete[i])) m_RemoteServers.removeServerNode(m_RemoteServers.get(i).m_ServerName);
@ -270,6 +276,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor
/** This action listener,... /** This action listener,...
*/ */
ActionListener loadServers = new ActionListener() { ActionListener loadServers = new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
String text = ""; String text = "";
JFileChooser reader = new JFileChooser(); JFileChooser reader = new JFileChooser();
@ -300,10 +307,13 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor
/** This action listener reads all values /** This action listener reads all values
*/ */
KeyListener loginListener = new KeyListener() { KeyListener loginListener = new KeyListener() {
@Override
public void keyPressed(KeyEvent event) { public void keyPressed(KeyEvent event) {
} }
@Override
public void keyTyped(KeyEvent event) { public void keyTyped(KeyEvent event) {
} }
@Override
public void keyReleased(KeyEvent event) { public void keyReleased(KeyEvent event) {
m_RemoteServers.setLogin(m_Login.getText()); m_RemoteServers.setLogin(m_Login.getText());
} }
@ -312,10 +322,13 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor
/** This action listener reads all values /** This action listener reads all values
*/ */
KeyListener passwordListener = new KeyListener() { KeyListener passwordListener = new KeyListener() {
@Override
public void keyPressed(KeyEvent event) { public void keyPressed(KeyEvent event) {
} }
@Override
public void keyTyped(KeyEvent event) { public void keyTyped(KeyEvent event) {
} }
@Override
public void keyReleased(KeyEvent event) { public void keyReleased(KeyEvent event) {
m_RemoteServers.setPassword(m_Password.getPassword()); m_RemoteServers.setPassword(m_Password.getPassword());
} }
@ -324,10 +337,13 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor
/** This action listener reads all values /** This action listener reads all values
*/ */
KeyListener serverNameListener = new KeyListener() { KeyListener serverNameListener = new KeyListener() {
@Override
public void keyPressed(KeyEvent event) { public void keyPressed(KeyEvent event) {
} }
@Override
public void keyTyped(KeyEvent event) { public void keyTyped(KeyEvent event) {
} }
@Override
public void keyReleased(KeyEvent event) { public void keyReleased(KeyEvent event) {
for (int i = 0; i < m_Names.length; i++) { for (int i = 0; i < m_Names.length; i++) {
if (event.getSource().equals(m_Names[i])) m_RemoteServers.setNameFor(i, m_Names[i].getText()); if (event.getSource().equals(m_Names[i])) m_RemoteServers.setNameFor(i, m_Names[i].getText());
@ -338,6 +354,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor
/** This action listener adds an element to DoubleArray /** This action listener adds an element to DoubleArray
*/ */
ItemListener cpuStateListener = new ItemListener() { ItemListener cpuStateListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent event) { public void itemStateChanged(ItemEvent event) {
for (int i = 0; i < m_CPUs.length; i++) { for (int i = 0; i < m_CPUs.length; i++) {
if (event.getSource().equals(m_CPUs[i])) m_RemoteServers.setCPUsFor(i, m_CPUs[i].getSelectedIndex()+1); if (event.getSource().equals(m_CPUs[i])) m_RemoteServers.setCPUsFor(i, m_CPUs[i].getSelectedIndex()+1);
@ -358,6 +375,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor
/** This method will set the value of object that is to be edited. /** This method will set the value of object that is to be edited.
* @param o an object that must be an array. * @param o an object that must be an array.
*/ */
@Override
public void setValue(Object o) { public void setValue(Object o) {
if (o instanceof PropertyRemoteServers) { if (o instanceof PropertyRemoteServers) {
this.m_RemoteServers = (PropertyRemoteServers) o; this.m_RemoteServers = (PropertyRemoteServers) o;
@ -368,10 +386,12 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor
/** Returns the current object. /** Returns the current object.
* @return the current object * @return the current object
*/ */
@Override
public Object getValue() { public Object getValue() {
return this.m_RemoteServers; return this.m_RemoteServers;
} }
@Override
public String getJavaInitializationString() { public String getJavaInitializationString() {
return "TEST"; return "TEST";
} }
@ -379,6 +399,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor
/** /**
* *
*/ */
@Override
public String getAsText() { public String getAsText() {
return null; return null;
} }
@ -386,6 +407,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor
/** /**
* *
*/ */
@Override
public void setAsText(String text) throws IllegalArgumentException { public void setAsText(String text) throws IllegalArgumentException {
throw new IllegalArgumentException(text); throw new IllegalArgumentException(text);
} }
@ -393,15 +415,18 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor
/** /**
* *
*/ */
@Override
public String[] getTags() { public String[] getTags() {
return null; return null;
} }
@Override
public void addPropertyChangeListener(PropertyChangeListener l) { public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this); if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.addPropertyChangeListener(l); m_Support.addPropertyChangeListener(l);
} }
@Override
public void removePropertyChangeListener(PropertyChangeListener l) { public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this); if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.removePropertyChangeListener(l); m_Support.removePropertyChangeListener(l);
@ -424,6 +449,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor
/** Returns true since the Object can be shown /** Returns true since the Object can be shown
* @return true * @return true
*/ */
@Override
public boolean isPaintable() { public boolean isPaintable() {
return true; return true;
} }
@ -433,6 +459,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor
* @param gfx the graphics context to use * @param gfx the graphics context to use
* @param box the area we are allowed to paint into * @param box the area we are allowed to paint into
*/ */
@Override
public void paintValue(Graphics gfx, Rectangle box) { public void paintValue(Graphics gfx, Rectangle box) {
FontMetrics fm = gfx.getFontMetrics(); FontMetrics fm = gfx.getFontMetrics();
int vpad = (box.height - fm.getAscent()) / 2; int vpad = (box.height - fm.getAscent()) / 2;
@ -443,6 +470,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor
/** Returns true because we do support a custom editor. /** Returns true because we do support a custom editor.
* @return true * @return true
*/ */
@Override
public boolean supportsCustomEditor() { public boolean supportsCustomEditor() {
return true; return true;
} }
@ -450,6 +478,7 @@ public class GenericRemoteServersEditor extends JPanel implements PropertyEditor
/** Returns the array editing component. /** Returns the array editing component.
* @return a value of type 'java.awt.Component' * @return a value of type 'java.awt.Component'
*/ */
@Override
public Component getCustomEditor() { public Component getCustomEditor() {
if (this.m_Editor == null) this.initCustomEditor(); if (this.m_Editor == null) this.initCustomEditor();
return m_Editor; return m_Editor;

View File

@ -58,6 +58,7 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
this.m_OKButton = new JButton("OK"); this.m_OKButton = new JButton("OK");
this.m_OKButton.setEnabled(true); this.m_OKButton.setEnabled(true);
this.m_OKButton.addActionListener(new ActionListener() { this.m_OKButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
//m_Backup = copyObject(m_Object); //m_Backup = copyObject(m_Object);
if ((m_CustomEditor.getTopLevelAncestor() != null) && (m_CustomEditor.getTopLevelAncestor() instanceof Window)) { if ((m_CustomEditor.getTopLevelAncestor() != null) && (m_CustomEditor.getTopLevelAncestor() instanceof Window)) {
@ -74,11 +75,14 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
/** This action listener reads all values /** This action listener reads all values
*/ */
KeyListener readDoubleAction = new KeyListener() { KeyListener readDoubleAction = new KeyListener() {
@Override
public void keyPressed(KeyEvent event) { public void keyPressed(KeyEvent event) {
} }
@Override
public void keyTyped(KeyEvent event) { public void keyTyped(KeyEvent event) {
} }
@Override
public void keyReleased(KeyEvent event) { public void keyReleased(KeyEvent event) {
try { try {
int d = new Integer(m_PValue.getText()).intValue(); int d = new Integer(m_PValue.getText()).intValue();
@ -92,11 +96,14 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
/** This action listener reads all values /** This action listener reads all values
*/ */
KeyListener readDoubleArrayAction = new KeyListener() { KeyListener readDoubleArrayAction = new KeyListener() {
@Override
public void keyPressed(KeyEvent event) { public void keyPressed(KeyEvent event) {
} }
@Override
public void keyTyped(KeyEvent event) { public void keyTyped(KeyEvent event) {
} }
@Override
public void keyReleased(KeyEvent event) { public void keyReleased(KeyEvent event) {
double[] tmpT = m_WLPT.m_IdealValue; double[] tmpT = m_WLPT.m_IdealValue;
double[] tmpP = m_WLPT.m_Weights; double[] tmpP = m_WLPT.m_Weights;
@ -167,6 +174,7 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
/** This method will set the value of object that is to be edited. /** This method will set the value of object that is to be edited.
* @param o an object that must be an array. * @param o an object that must be an array.
*/ */
@Override
public void setValue(Object o) { public void setValue(Object o) {
if (o instanceof PropertyWeightedLPTchebycheff) { if (o instanceof PropertyWeightedLPTchebycheff) {
this.m_WLPT = (PropertyWeightedLPTchebycheff) o; this.m_WLPT = (PropertyWeightedLPTchebycheff) o;
@ -177,10 +185,12 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
/** Returns the current object. /** Returns the current object.
* @return the current object * @return the current object
*/ */
@Override
public Object getValue() { public Object getValue() {
return this.m_WLPT; return this.m_WLPT;
} }
@Override
public String getJavaInitializationString() { public String getJavaInitializationString() {
return "TEST"; return "TEST";
} }
@ -188,6 +198,7 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
/** /**
* *
*/ */
@Override
public String getAsText() { public String getAsText() {
return null; return null;
} }
@ -195,6 +206,7 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
/** /**
* *
*/ */
@Override
public void setAsText(String text) throws IllegalArgumentException { public void setAsText(String text) throws IllegalArgumentException {
throw new IllegalArgumentException(text); throw new IllegalArgumentException(text);
} }
@ -202,15 +214,18 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
/** /**
* *
*/ */
@Override
public String[] getTags() { public String[] getTags() {
return null; return null;
} }
@Override
public void addPropertyChangeListener(PropertyChangeListener l) { public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this); if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.addPropertyChangeListener(l); m_Support.addPropertyChangeListener(l);
} }
@Override
public void removePropertyChangeListener(PropertyChangeListener l) { public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) m_Support = new PropertyChangeSupport(this); if (m_Support == null) m_Support = new PropertyChangeSupport(this);
m_Support.removePropertyChangeListener(l); m_Support.removePropertyChangeListener(l);
@ -233,6 +248,7 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
/** Returns true since the Object can be shown /** Returns true since the Object can be shown
* @return true * @return true
*/ */
@Override
public boolean isPaintable() { public boolean isPaintable() {
return true; return true;
} }
@ -242,6 +258,7 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
* @param gfx the graphics context to use * @param gfx the graphics context to use
* @param box the area we are allowed to paint into * @param box the area we are allowed to paint into
*/ */
@Override
public void paintValue(Graphics gfx, Rectangle box) { public void paintValue(Graphics gfx, Rectangle box) {
FontMetrics fm = gfx.getFontMetrics(); FontMetrics fm = gfx.getFontMetrics();
int vpad = (box.height - fm.getAscent()) / 2; int vpad = (box.height - fm.getAscent()) / 2;
@ -252,6 +269,7 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
/** Returns true because we do support a custom editor. /** Returns true because we do support a custom editor.
* @return true * @return true
*/ */
@Override
public boolean supportsCustomEditor() { public boolean supportsCustomEditor() {
return true; return true;
} }
@ -259,6 +277,7 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
/** Returns the array editing component. /** Returns the array editing component.
* @return a value of type 'java.awt.Component' * @return a value of type 'java.awt.Component'
*/ */
@Override
public Component getCustomEditor() { public Component getCustomEditor() {
if (this.m_CustomEditor == null) this.initCustomEditor(); if (this.m_CustomEditor == null) this.initCustomEditor();
return m_CustomEditor; return m_CustomEditor;

View File

@ -43,6 +43,7 @@ public class GraphPointSetLegend {
* *
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
*/ */
@Override
public int compare(Pair<String, Color> o1, Pair<String, Color> o2) { public int compare(Pair<String, Color> o1, Pair<String, Color> o2) {
int comp = o1.car().compareTo(o2.car()); int comp = o1.car().compareTo(o2.car());
// Same text; let us see if the color is also identical. // Same text; let us see if the color is also identical.

View File

@ -104,6 +104,7 @@ public class HtmlDemo {
*/ */
public HyperlinkListener createHyperLinkListener() { public HyperlinkListener createHyperLinkListener() {
return new HyperlinkListener() { return new HyperlinkListener() {
@Override
public void hyperlinkUpdate(HyperlinkEvent e) { public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
if (e instanceof HTMLFrameHyperlinkEvent) { if (e instanceof HTMLFrameHyperlinkEvent) {

View File

@ -81,6 +81,7 @@ public class JEFrame extends JInternalFrame {
this.getRootPane().getActionMap().put( this.getRootPane().getActionMap().put(
"ctrlFpressed", "ctrlFpressed",
new AbstractAction("ctrlFpressed") { new AbstractAction("ctrlFpressed") {
@Override
public void actionPerformed(ActionEvent actionEvent) { public void actionPerformed(ActionEvent actionEvent) {
JEFrameRegister.getInstance().getFrameList().get(0).toFront(); JEFrameRegister.getInstance().getFrameList().get(0).toFront();
} }
@ -93,6 +94,7 @@ public class JEFrame extends JInternalFrame {
this.getRootPane().getActionMap().put( this.getRootPane().getActionMap().put(
"ctrlOpressed", "ctrlOpressed",
new AbstractAction("ctrlOpressed") { new AbstractAction("ctrlOpressed") {
@Override
public void actionPerformed(ActionEvent actionEvent) { public void actionPerformed(ActionEvent actionEvent) {
java.util.List<JEFrame> frameList = JEFrameRegister.getInstance().getFrameList(); java.util.List<JEFrame> frameList = JEFrameRegister.getInstance().getFrameList();
for (JEFrame frame : frameList) { for (JEFrame frame : frameList) {
@ -109,6 +111,7 @@ public class JEFrame extends JInternalFrame {
this.getRootPane().getActionMap().put( this.getRootPane().getActionMap().put(
"ctrlSmallerpressed", "ctrlSmallerpressed",
new AbstractAction("ctrlSmallerpressed") { new AbstractAction("ctrlSmallerpressed") {
@Override
public void actionPerformed(ActionEvent actionEvent) { public void actionPerformed(ActionEvent actionEvent) {
JEFrameRegister.getInstance().setFocusToNext(self); JEFrameRegister.getInstance().setFocusToNext(self);
} }

View File

@ -206,6 +206,7 @@ public class JExtDesktopPane extends JDesktopPane {
public int getFrameCount() { public int getFrameCount() {
return getComponentCount(new ComponentFilter() { return getComponentCount(new ComponentFilter() {
@Override
public boolean accept(Component c) { public boolean accept(Component c) {
return c instanceof JInternalFrame return c instanceof JInternalFrame
|| (c instanceof JInternalFrame.JDesktopIcon || (c instanceof JInternalFrame.JDesktopIcon
@ -237,6 +238,7 @@ public class JExtDesktopPane extends JDesktopPane {
} }
} }
@Override
public void addImpl(Component comp, Object constraints, int index) { public void addImpl(Component comp, Object constraints, int index) {
super.addImpl(comp, constraints, index); super.addImpl(comp, constraints, index);
//System.out.println("JExtDesktopPane.addImpl"); //System.out.println("JExtDesktopPane.addImpl");

View File

@ -26,6 +26,7 @@ public class JExtFileChooser extends JFileChooser{
return overwriteWarning; return overwriteWarning;
} }
@Override
public void approveSelection(){ public void approveSelection(){
if(getDialogType() == JFileChooser.SAVE_DIALOG && overwriteWarning){ if(getDialogType() == JFileChooser.SAVE_DIALOG && overwriteWarning){
File f = getSelectedFile(); File f = getSelectedFile();

View File

@ -45,6 +45,7 @@ public class JExtMenu extends JMenu{
/** /**
* *
*/ */
@Override
public JMenuItem add(Action a){ public JMenuItem add(Action a){
JMenuItem item = super.add(a); JMenuItem item = super.add(a);
Object o; Object o;
@ -59,8 +60,10 @@ public class JExtMenu extends JMenu{
/** /**
* *
*/ */
@Override
protected PropertyChangeListener createActionChangeListener(JMenuItem b){ protected PropertyChangeListener createActionChangeListener(JMenuItem b){
return new ExtActionChangedListener(b){ return new ExtActionChangedListener(b){
@Override
public void propertyChange(PropertyChangeEvent e) { public void propertyChange(PropertyChangeEvent e) {
JMenuItem menuItem = (JMenuItem)component; JMenuItem menuItem = (JMenuItem)component;
if(menuItem == null) return; if(menuItem == null) return;

View File

@ -18,6 +18,7 @@ import javax.swing.*;
* *
*/ */
public class JExtToolBar extends JToolBar{ public class JExtToolBar extends JToolBar{
@Override
public JButton add(Action a){ public JButton add(Action a){
JButton button = super.add(a); JButton button = super.add(a);
button.setText(null); button.setText(null);
@ -49,8 +50,10 @@ public class JExtToolBar extends JToolBar{
return result.toString(); return result.toString();
} }
@Override
protected PropertyChangeListener createActionChangeListener(JButton b){ protected PropertyChangeListener createActionChangeListener(JButton b){
return new ExtActionChangedListener(b){ return new ExtActionChangedListener(b){
@Override
public void propertyChange(PropertyChangeEvent e){ public void propertyChange(PropertyChangeEvent e){
JButton button = (JButton)component; JButton button = (JButton)component;

View File

@ -39,6 +39,7 @@ public class JParaPanel implements Serializable, PanelMaker {
/** /**
*/ */
@Override
public JComponent makePanel() { public JComponent makePanel() {
PropertyEditorProvider.installEditors(); PropertyEditorProvider.installEditors();

View File

@ -34,6 +34,7 @@ public class JTextEditorInternalFrame extends JDocFrame{
setEnabled(false); setEnabled(false);
} }
@Override
public void actionPerformed(ActionEvent e){ public void actionPerformed(ActionEvent e){
try{ try{
undo.undo(); undo.undo();
@ -64,6 +65,7 @@ public class JTextEditorInternalFrame extends JDocFrame{
setEnabled(false); setEnabled(false);
} }
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
try{ try{
undo.redo(); undo.redo();
@ -93,16 +95,19 @@ public class JTextEditorInternalFrame extends JDocFrame{
/////////////////////////////////////////// ///////////////////////////////////////////
// //
///////////////////////////////////////// /////////////////////////////////////////
@Override
public String[] getActionGroups(){ public String[] getActionGroups(){
return actionGroups; return actionGroups;
} }
private JMenu mnuEdit; private JMenu mnuEdit;
private JToolBar barEdit; private JToolBar barEdit;
@Override
public JMenu getMenu(String group){ public JMenu getMenu(String group){
if(GROUP_EDIT.equals(group)) return mnuEdit; if(GROUP_EDIT.equals(group)) return mnuEdit;
else return null; else return null;
} }
@Override
public JToolBar getToolBar(String group){ public JToolBar getToolBar(String group){
if(GROUP_EDIT.equals(group)) return barEdit; if(GROUP_EDIT.equals(group)) return barEdit;
return null; return null;
@ -203,20 +208,24 @@ public class JTextEditorInternalFrame extends JDocFrame{
setChanged(true); setChanged(true);
} }
@Override
public void changedUpdate(DocumentEvent e){ public void changedUpdate(DocumentEvent e){
changed(); changed();
} }
@Override
public void insertUpdate(DocumentEvent e){ public void insertUpdate(DocumentEvent e){
changed(); changed();
} }
@Override
public void removeUpdate(DocumentEvent e){ public void removeUpdate(DocumentEvent e){
changed(); changed();
} }
}); });
textArea.getDocument().addUndoableEditListener(new UndoableEditListener(){ textArea.getDocument().addUndoableEditListener(new UndoableEditListener(){
@Override
public void undoableEditHappened(UndoableEditEvent e){ public void undoableEditHappened(UndoableEditEvent e){
undo.addEdit(e.getEdit()); undo.addEdit(e.getEdit());
actUndo.update(); actUndo.update();
@ -259,6 +268,7 @@ public class JTextEditorInternalFrame extends JDocFrame{
createActions(); createActions();
} }
@Override
public void save(File f){ public void save(File f){
FileWriter out = null; FileWriter out = null;
try{ try{
@ -276,6 +286,7 @@ public class JTextEditorInternalFrame extends JDocFrame{
super.save(f); super.save(f);
} }
@Override
public void setSelected(boolean value) throws java.beans.PropertyVetoException{ public void setSelected(boolean value) throws java.beans.PropertyVetoException{
super.setSelected(value); super.setSelected(value);

View File

@ -41,6 +41,7 @@ public class JTextoutputFrame implements JTextoutputFrameInterface, ActionListen
/** /**
* *
*/ */
@Override
public void print(String text) { public void print(String text) {
if (textArea == null) { if (textArea == null) {
createFrame(); createFrame();
@ -49,10 +50,12 @@ public class JTextoutputFrame implements JTextoutputFrameInterface, ActionListen
textArea.repaint(); textArea.repaint();
} }
@Override
public void println(String txt) { public void println(String txt) {
print(txt + '\n'); print(txt + '\n');
} }
@Override
public void setShow(boolean bShow) { public void setShow(boolean bShow) {
if (frame.isVisible() != bShow) { if (frame.isVisible() != bShow) {
if (frame.isVisible()) { if (frame.isVisible()) {
@ -100,6 +103,7 @@ public class JTextoutputFrame implements JTextoutputFrameInterface, ActionListen
private int lastHeight; private int lastHeight;
// //
@Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
JViewport viewport = (JViewport) e.getSource(); JViewport viewport = (JViewport) e.getSource();
int Height = viewport.getViewSize().height; int Height = viewport.getViewSize().height;
@ -131,6 +135,7 @@ public class JTextoutputFrame implements JTextoutputFrameInterface, ActionListen
textArea.addMouseListener(popupListener); textArea.addMouseListener(popupListener);
} }
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
JMenuItem src = (JMenuItem) e.getSource(); JMenuItem src = (JMenuItem) e.getSource();
if (src == clearItem) { if (src == clearItem) {
@ -157,10 +162,12 @@ class PopupListener extends MouseAdapter {
popup = pm; popup = pm;
} }
@Override
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
maybeShowPopup(e); maybeShowPopup(e);
} }
@Override
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
maybeShowPopup(e); maybeShowPopup(e);
} }

View File

@ -70,6 +70,7 @@ public class LoggingPanel extends JPanel {
scrollpane.getViewport().addChangeListener(new ChangeListener() { scrollpane.getViewport().addChangeListener(new ChangeListener() {
private int lastHeight; private int lastHeight;
// //
@Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
JViewport viewport = (JViewport)e.getSource(); JViewport viewport = (JViewport)e.getSource();
int height = viewport.getViewSize().height; int height = viewport.getViewSize().height;

View File

@ -17,23 +17,31 @@ import java.awt.event.*;
public class MultiLineStringEditor implements PropertyEditor { public class MultiLineStringEditor implements PropertyEditor {
protected MultiLineString value; // The value we will be editing. protected MultiLineString value; // The value we will be editing.
@Override
public void setValue(Object o) { value=(MultiLineString) o;} public void setValue(Object o) { value=(MultiLineString) o;}
@Override
public Object getValue() { return value; } public Object getValue() { return value; }
@Override
public void setAsText(String s) { value.setString(s); } public void setAsText(String s) { value.setString(s); }
@Override
public String getAsText() { return value.getString(); } public String getAsText() { return value.getString(); }
@Override
public String[] getTags() { return null; } // not enumerated; no tags public String[] getTags() { return null; } // not enumerated; no tags
// Say that we allow custom editing. // Say that we allow custom editing.
@Override
public boolean supportsCustomEditor() { return true; } public boolean supportsCustomEditor() { return true; }
// Return the custom editor. This just creates and returns a TextArea // Return the custom editor. This just creates and returns a TextArea
// to edit the multi-line text. But it also registers a listener on the // to edit the multi-line text. But it also registers a listener on the
// text area to update the value as the user types and to fire the // text area to update the value as the user types and to fire the
// property change events that property editors are required to fire. // property change events that property editors are required to fire.
@Override
public Component getCustomEditor() { public Component getCustomEditor() {
final TextArea t = new TextArea(value.string); final TextArea t = new TextArea(value.string);
t.setSize(300, 150); // TextArea doesn't have a preferred size, so set one t.setSize(300, 150); // TextArea doesn't have a preferred size, so set one
t.addTextListener(new TextListener() { t.addTextListener(new TextListener() {
@Override
public void textValueChanged(TextEvent e) { public void textValueChanged(TextEvent e) {
value.setString(t.getText()); value.setString(t.getText());
listeners.firePropertyChange(null, null, null); listeners.firePropertyChange(null, null, null);
@ -45,8 +53,10 @@ public class MultiLineStringEditor implements PropertyEditor {
// Visual display of the value, for use with the custom editor. // Visual display of the value, for use with the custom editor.
// Just print some instructions and hope they fit in the in the box. // Just print some instructions and hope they fit in the in the box.
// This could be more sophisticated. // This could be more sophisticated.
@Override
public boolean isPaintable() { return true; } public boolean isPaintable() { return true; }
@Override
public void paintValue(Graphics g, Rectangle r) { public void paintValue(Graphics g, Rectangle r) {
g.setClip(r); g.setClip(r);
g.drawString("Click to edit...", r.x+5, r.y+15); g.drawString("Click to edit...", r.x+5, r.y+15);
@ -54,17 +64,20 @@ public class MultiLineStringEditor implements PropertyEditor {
// Important method for code generators. Note that it // Important method for code generators. Note that it
// ought to add any necessary escape sequences. // ought to add any necessary escape sequences.
@Override
public String getJavaInitializationString() { return "\"" + value + "\""; } public String getJavaInitializationString() { return "\"" + value + "\""; }
// This code uses the PropertyChangeSupport class to maintain a list of // This code uses the PropertyChangeSupport class to maintain a list of
// listeners interested in the edits we make to the value. // listeners interested in the edits we make to the value.
protected PropertyChangeSupport listeners = new PropertyChangeSupport(this); protected PropertyChangeSupport listeners = new PropertyChangeSupport(this);
@Override
public void addPropertyChangeListener(PropertyChangeListener l) { public void addPropertyChangeListener(PropertyChangeListener l) {
if (listeners == null) listeners = new PropertyChangeSupport(this); if (listeners == null) listeners = new PropertyChangeSupport(this);
listeners.addPropertyChangeListener(l); listeners.addPropertyChangeListener(l);
} }
@Override
public void removePropertyChangeListener(PropertyChangeListener l) { public void removePropertyChangeListener(PropertyChangeListener l) {
if (listeners == null) listeners = new PropertyChangeSupport(this); if (listeners == null) listeners = new PropertyChangeSupport(this);
listeners.removePropertyChangeListener(l); listeners.removePropertyChangeListener(l);

View File

@ -109,6 +109,7 @@ public class Plot implements PlotInterface, Serializable {
JButton ClearButton = new JButton("Clear"); JButton ClearButton = new JButton("Clear");
ClearButton.addActionListener(new ActionListener() { ClearButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
clearAll(); clearAll();
} }
@ -117,6 +118,7 @@ public class Plot implements PlotInterface, Serializable {
LOGButton.setToolTipText("Toggle between a linear and a log scale on the y-axis."); LOGButton.setToolTipText("Toggle between a linear and a log scale on the y-axis.");
LOGButton.addActionListener(new ActionListener() { LOGButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
m_PlotArea.toggleLog(); m_PlotArea.toggleLog();
} }
@ -125,6 +127,7 @@ public class Plot implements PlotInterface, Serializable {
ExportButton.setToolTipText("Exports the graph data to a simple TSV file."); ExportButton.setToolTipText("Exports the graph data to a simple TSV file.");
ExportButton.addActionListener(new ActionListener() { ExportButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
exportPlot(); exportPlot();
} }
@ -133,6 +136,7 @@ public class Plot implements PlotInterface, Serializable {
DumpButton.setToolTipText("Dump the graph data to standard output"); DumpButton.setToolTipText("Dump the graph data to standard output");
DumpButton.addActionListener(new ActionListener() { DumpButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
m_PlotArea.exportToAscii(); m_PlotArea.exportToAscii();
} }
@ -141,6 +145,7 @@ public class Plot implements PlotInterface, Serializable {
JButton saveImageButton = new JButton("Save as PNG..."); JButton saveImageButton = new JButton("Save as PNG...");
saveImageButton.addActionListener(new ActionListener() { saveImageButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
try { try {
Robot robot = new Robot(); Robot robot = new Robot();
@ -211,6 +216,7 @@ public class Plot implements PlotInterface, Serializable {
/** /**
* *
*/ */
@Override
public void init() { public void init() {
m_Frame = new JEFrame("Plot: " + plotName); m_Frame = new JEFrame("Plot: " + plotName);
BasicResourceLoader loader = BasicResourceLoader.instance(); BasicResourceLoader loader = BasicResourceLoader.instance();
@ -315,6 +321,7 @@ public class Plot implements PlotInterface, Serializable {
* *
* @return true if the Plot object is valid * @return true if the Plot object is valid
*/ */
@Override
public boolean isValid() { public boolean isValid() {
return (m_Frame != null) && (m_PlotArea != null); return (m_Frame != null) && (m_PlotArea != null);
} }
@ -322,10 +329,12 @@ public class Plot implements PlotInterface, Serializable {
/** /**
* *
*/ */
@Override
public void setConnectedPoint(double x, double y, int func) { public void setConnectedPoint(double x, double y, int func) {
m_PlotArea.setConnectedPoint(x, y, func); m_PlotArea.setConnectedPoint(x, y, func);
} }
@Override
public int getPointCount(int graphLabel) { public int getPointCount(int graphLabel) {
return m_PlotArea.getPointCount(graphLabel); return m_PlotArea.getPointCount(graphLabel);
} }
@ -333,6 +342,7 @@ public class Plot implements PlotInterface, Serializable {
/** /**
* *
*/ */
@Override
public void addGraph(int g1, int g2, boolean forceAdd) { public void addGraph(int g1, int g2, boolean forceAdd) {
m_PlotArea.addGraph(g1, g2, forceAdd); m_PlotArea.addGraph(g1, g2, forceAdd);
} }
@ -340,6 +350,7 @@ public class Plot implements PlotInterface, Serializable {
/** /**
* *
*/ */
@Override
public void setUnconnectedPoint(double x, double y, int GraphLabel) { public void setUnconnectedPoint(double x, double y, int GraphLabel) {
m_PlotArea.setUnconnectedPoint(x, y, GraphLabel); m_PlotArea.setUnconnectedPoint(x, y, GraphLabel);
} }
@ -347,6 +358,7 @@ public class Plot implements PlotInterface, Serializable {
/** /**
* *
*/ */
@Override
public void clearAll() { public void clearAll() {
m_PlotArea.clearAll(); m_PlotArea.clearAll();
m_PlotArea.removeAllDElements(); m_PlotArea.removeAllDElements();
@ -357,6 +369,7 @@ public class Plot implements PlotInterface, Serializable {
/** /**
* *
*/ */
@Override
public void clearGraph(int GraphNumber) { public void clearGraph(int GraphNumber) {
m_PlotArea.clearGraph(GraphNumber); m_PlotArea.clearGraph(GraphNumber);
} }
@ -364,6 +377,7 @@ public class Plot implements PlotInterface, Serializable {
/** /**
* *
*/ */
@Override
public void setInfoString(int GraphLabel, String Info, float stroke) { public void setInfoString(int GraphLabel, String Info, float stroke) {
m_PlotArea.setInfoString(GraphLabel, Info, stroke); m_PlotArea.setInfoString(GraphLabel, Info, stroke);
} }
@ -371,6 +385,7 @@ public class Plot implements PlotInterface, Serializable {
/** /**
* *
*/ */
@Override
public void jump() { public void jump() {
m_PlotArea.jump(); m_PlotArea.jump();
} }
@ -471,6 +486,7 @@ public class Plot implements PlotInterface, Serializable {
/** /**
* *
*/ */
@Override
public String getName() { public String getName() {
return this.plotName; return this.plotName;
} }

View File

@ -22,6 +22,7 @@ public class PropertyBoolSelector extends JCheckBox {
setSelected(false); setSelected(false);
addItemListener(new ItemListener () { addItemListener(new ItemListener () {
@Override
public void itemStateChanged (ItemEvent evt) { public void itemStateChanged (ItemEvent evt) {
if (evt.getStateChange() == ItemEvent.SELECTED) { if (evt.getStateChange() == ItemEvent.SELECTED) {
m_Editor.setValue(Boolean.TRUE); m_Editor.setValue(Boolean.TRUE);

View File

@ -42,6 +42,7 @@ public class PropertyDoubleArray implements java.io.Serializable {
} }
} }
@Override
public Object clone() { public Object clone() {
return (Object) new PropertyDoubleArray(this); return (Object) new PropertyDoubleArray(this);
} }
@ -165,6 +166,7 @@ public class PropertyDoubleArray implements java.io.Serializable {
return (k>=0) && (k<getNumRows()); return (k>=0) && (k<getNumRows());
} }
@Override
public String toString() { public String toString() {
return BeanInspector.toString(m_DoubleArray); return BeanInspector.toString(m_DoubleArray);
} }

View File

@ -23,6 +23,7 @@ public class PropertyEpsilonConstraint implements java.io.Serializable {
this.m_OptimizeObjective = e.m_OptimizeObjective; this.m_OptimizeObjective = e.m_OptimizeObjective;
} }
@Override
public Object clone() { public Object clone() {
return (Object) new PropertyEpsilonConstraint(this); return (Object) new PropertyEpsilonConstraint(this);
} }

View File

@ -28,6 +28,7 @@ public class PropertyEpsilonThreshold implements java.io.Serializable {
this.m_OptimizeObjective = e.m_OptimizeObjective; this.m_OptimizeObjective = e.m_OptimizeObjective;
} }
@Override
public Object clone() { public Object clone() {
return (Object) new PropertyEpsilonThreshold(this); return (Object) new PropertyEpsilonThreshold(this);
} }

View File

@ -52,6 +52,7 @@ public class PropertyFilePath implements java.io.Serializable {
else return new PropertyFilePath(fName); else return new PropertyFilePath(fName);
} }
@Override
public Object clone() { public Object clone() {
return (Object) new PropertyFilePath(this); return (Object) new PropertyFilePath(this);
} }

View File

@ -19,6 +19,7 @@ public class PropertyIntArray implements java.io.Serializable {
System.arraycopy(d.m_IntArray, 0, this.m_IntArray, 0, this.m_IntArray.length); System.arraycopy(d.m_IntArray, 0, this.m_IntArray, 0, this.m_IntArray.length);
} }
@Override
public Object clone() { public Object clone() {
return (Object) new PropertyIntArray(this); return (Object) new PropertyIntArray(this);
} }

View File

@ -28,6 +28,7 @@ public class PropertyOptimizationObjectives implements java.io.Serializable {
} }
} }
@Override
public Object clone() { public Object clone() {
return (Object) new PropertyOptimizationObjectives(this); return (Object) new PropertyOptimizationObjectives(this);
} }

View File

@ -40,6 +40,7 @@ public class PropertyOptimizationObjectivesWithParam implements java.io.Serializ
} }
} }
@Override
public Object clone() { public Object clone() {
return (Object) new PropertyOptimizationObjectivesWithParam(this); return (Object) new PropertyOptimizationObjectivesWithParam(this);
} }

View File

@ -80,6 +80,7 @@ public class PropertyPanel extends JPanel {
/** /**
* *
*/ */
@Override
public void removeNotify() { public void removeNotify() {
if (propertyDialog != null) { if (propertyDialog != null) {
propertyDialog = null; propertyDialog = null;
@ -89,6 +90,7 @@ public class PropertyPanel extends JPanel {
/** /**
* *
*/ */
@Override
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
Insets i = textLabel.getInsets(); Insets i = textLabel.getInsets();
Rectangle box = new Rectangle(i.left, i.top, Rectangle box = new Rectangle(i.left, i.top,

View File

@ -26,6 +26,7 @@ class ServerNode implements java.io.Serializable {
this.m_CPUs = a.m_CPUs; this.m_CPUs = a.m_CPUs;
this.m_ServerName = a.m_ServerName; this.m_ServerName = a.m_ServerName;
} }
@Override
public Object clone() { public Object clone() {
return (Object) new ServerNode(this); return (Object) new ServerNode(this);
} }
@ -57,6 +58,7 @@ public class PropertyRemoteServers implements java.io.Serializable {
} }
} }
@Override
public Object clone() { public Object clone() {
return (Object) new PropertyRemoteServers(this); return (Object) new PropertyRemoteServers(this);
} }

View File

@ -34,6 +34,7 @@ public class PropertySelectableList<T> implements java.io.Serializable {
} }
} }
@Override
public Object clone() { public Object clone() {
return (Object) new PropertySelectableList<T>(this); return (Object) new PropertySelectableList<T>(this);
} }

View File

@ -108,6 +108,7 @@ public class PropertySheetPanel extends JPanel implements PropertyChangeListener
* *
* @param evt a value of type 'PropertyChangeEvent' * @param evt a value of type 'PropertyChangeEvent'
*/ */
@Override
public void propertyChange(PropertyChangeEvent evt) { public void propertyChange(PropertyChangeEvent evt) {
wasModified(evt); // Let our panel update before guys downstream wasModified(evt); // Let our panel update before guys downstream
propertyChangeSupport.removePropertyChangeListener(this); propertyChangeSupport.removePropertyChangeListener(this);
@ -115,6 +116,7 @@ public class PropertySheetPanel extends JPanel implements PropertyChangeListener
propertyChangeSupport.addPropertyChangeListener(this); propertyChangeSupport.addPropertyChangeListener(this);
} }
@Override
public void addPropertyChangeListener(PropertyChangeListener l) { public void addPropertyChangeListener(PropertyChangeListener l) {
if (propertyChangeSupport == null) { if (propertyChangeSupport == null) {
propertyChangeSupport = new PropertyChangeSupport(this); propertyChangeSupport = new PropertyChangeSupport(this);
@ -122,6 +124,7 @@ public class PropertySheetPanel extends JPanel implements PropertyChangeListener
propertyChangeSupport.addPropertyChangeListener(l); propertyChangeSupport.addPropertyChangeListener(l);
} }
@Override
public void removePropertyChangeListener(PropertyChangeListener l) { public void removePropertyChangeListener(PropertyChangeListener l) {
if (propertyChangeSupport == null) { if (propertyChangeSupport == null) {
propertyChangeSupport = new PropertyChangeSupport(this); propertyChangeSupport = new PropertyChangeSupport(this);

View File

@ -117,6 +117,7 @@ class JCheckBoxFlag extends JCheckBox {
m_Flag = flag; m_Flag = flag;
addItemListener(new ItemListener() { addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent evt) { public void itemStateChanged(ItemEvent evt) {
if (evt.getStateChange() == evt.SELECTED) { if (evt.getStateChange() == evt.SELECTED) {
m_Flag = true; m_Flag = true;

View File

@ -44,12 +44,14 @@ class PropertySlider extends JPanel {
this.add(slider); this.add(slider);
propertyEditor.addPropertyChangeListener(new PropertyChangeListener() { propertyEditor.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) { public void propertyChange(PropertyChangeEvent evt) {
updateUs(); updateUs();
} }
}); });
addKeyListener(new KeyAdapter() { addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) { public void keyReleased(KeyEvent e) {
// if (e.getKeyCode() == KeyEvent.VK_ENTER) // if (e.getKeyCode() == KeyEvent.VK_ENTER)
updateEditor(); updateEditor();
@ -57,6 +59,7 @@ class PropertySlider extends JPanel {
}); });
addFocusListener(new FocusAdapter() { addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) { public void focusLost(FocusEvent e) {
updateEditor(); updateEditor();
} }
@ -95,6 +98,7 @@ class PropertySlider extends JPanel {
public SliderListener() { public SliderListener() {
} }
@Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
JSlider s1 = (JSlider) e.getSource(); JSlider s1 = (JSlider) e.getSource();
System.out.println("slider" + s1.getValue()); System.out.println("slider" + s1.getValue());

View File

@ -31,6 +31,7 @@ public class PropertyValueSelector extends JComboBox {
/** /**
* *
*/ */
@Override
public Object getSelectedItem() { public Object getSelectedItem() {
return propertyEditor.getAsText(); return propertyEditor.getAsText();
} }
@ -38,6 +39,7 @@ public class PropertyValueSelector extends JComboBox {
/** /**
* *
*/ */
@Override
public void setSelectedItem(Object o) { public void setSelectedItem(Object o) {
propertyEditor.setAsText((String) o); propertyEditor.setAsText((String) o);
} }

View File

@ -28,6 +28,7 @@ public class PropertyWeightedLPTchebycheff implements java.io.Serializable {
this.m_P = e.m_P; this.m_P = e.m_P;
} }
@Override
public Object clone() { public Object clone() {
return (Object) new PropertyWeightedLPTchebycheff(this); return (Object) new PropertyWeightedLPTchebycheff(this);
} }

View File

@ -32,6 +32,7 @@ public class StatisticsEditor implements PropertyEditor {
m_StatPanel.addPropertyChangeListener( m_StatPanel.addPropertyChangeListener(
new PropertyChangeListener() { new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) { public void propertyChange(PropertyChangeEvent evt) {
m_Support.firePropertyChange("", null, null); m_Support.firePropertyChange("", null, null);
} }
@ -47,6 +48,7 @@ public class StatisticsEditor implements PropertyEditor {
/** /**
* *
*/ */
@Override
public void setValue(Object value) { public void setValue(Object value) {
if (value instanceof GenericStatistics) { if (value instanceof GenericStatistics) {
m_Value = (GenericStatistics) value; m_Value = (GenericStatistics) value;
@ -58,6 +60,7 @@ public class StatisticsEditor implements PropertyEditor {
/** /**
* *
*/ */
@Override
public Object getValue() { public Object getValue() {
System.out.println("getValue !!!!!!!!!!!!"); System.out.println("getValue !!!!!!!!!!!!");
m_Value.setState(m_StatPanel.getState()); m_Value.setState(m_StatPanel.getState());
@ -67,6 +70,7 @@ public class StatisticsEditor implements PropertyEditor {
/** /**
* *
*/ */
@Override
public String getJavaInitializationString() { public String getJavaInitializationString() {
return "null"; return "null";
} }
@ -74,6 +78,7 @@ public class StatisticsEditor implements PropertyEditor {
/** /**
* *
*/ */
@Override
public boolean isPaintable() { public boolean isPaintable() {
return true; return true;
} }
@ -81,6 +86,7 @@ public class StatisticsEditor implements PropertyEditor {
/** /**
* *
*/ */
@Override
public void paintValue(Graphics gfx, Rectangle box) { public void paintValue(Graphics gfx, Rectangle box) {
FontMetrics fm = gfx.getFontMetrics(); FontMetrics fm = gfx.getFontMetrics();
int vpad = (box.height - fm.getAscent()) / 2; int vpad = (box.height - fm.getAscent()) / 2;
@ -91,6 +97,7 @@ public class StatisticsEditor implements PropertyEditor {
/** /**
* *
*/ */
@Override
public String getAsText() { public String getAsText() {
return null; return null;
} }
@ -98,6 +105,7 @@ public class StatisticsEditor implements PropertyEditor {
/** /**
* *
*/ */
@Override
public void setAsText(String text) throws IllegalArgumentException { public void setAsText(String text) throws IllegalArgumentException {
throw new IllegalArgumentException(text); throw new IllegalArgumentException(text);
} }
@ -105,6 +113,7 @@ public class StatisticsEditor implements PropertyEditor {
/** /**
* *
*/ */
@Override
public String[] getTags() { public String[] getTags() {
return null; return null;
} }
@ -112,6 +121,7 @@ public class StatisticsEditor implements PropertyEditor {
/** /**
* *
*/ */
@Override
public boolean supportsCustomEditor() { public boolean supportsCustomEditor() {
return true; return true;
} }
@ -119,10 +129,12 @@ public class StatisticsEditor implements PropertyEditor {
/** /**
* *
*/ */
@Override
public Component getCustomEditor() { public Component getCustomEditor() {
return m_Panel; return m_Panel;
} }
@Override
public void addPropertyChangeListener(PropertyChangeListener l) { public void addPropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) { if (m_Support == null) {
m_Support = new PropertyChangeSupport(this); m_Support = new PropertyChangeSupport(this);
@ -130,6 +142,7 @@ public class StatisticsEditor implements PropertyEditor {
m_Support.addPropertyChangeListener(l); m_Support.addPropertyChangeListener(l);
} }
@Override
public void removePropertyChangeListener(PropertyChangeListener l) { public void removePropertyChangeListener(PropertyChangeListener l) {
if (m_Support == null) { if (m_Support == null) {
m_Support = new PropertyChangeSupport(this); m_Support = new PropertyChangeSupport(this);

View File

@ -32,6 +32,7 @@ public class TagEditor extends PropertyEditorSupport {
* *
* @return a value of type 'String' * @return a value of type 'String'
*/ */
@Override
public String getJavaInitializationString() { public String getJavaInitializationString() {
SelectedTag s = (SelectedTag)getValue(); SelectedTag s = (SelectedTag)getValue();
@ -56,6 +57,7 @@ public class TagEditor extends PropertyEditorSupport {
* *
* @return a value of type 'String' * @return a value of type 'String'
*/ */
@Override
public String getAsText() { public String getAsText() {
SelectedTag s = (SelectedTag)getValue(); SelectedTag s = (SelectedTag)getValue();
return s.getSelectedTag().getString(); return s.getSelectedTag().getString();
@ -67,6 +69,7 @@ public class TagEditor extends PropertyEditorSupport {
* @param text the text of the selected tag. * @param text the text of the selected tag.
* @exception java.lang.IllegalArgumentException if an error occurs * @exception java.lang.IllegalArgumentException if an error occurs
*/ */
@Override
public void setAsText(String text) throws java.lang.IllegalArgumentException { public void setAsText(String text) throws java.lang.IllegalArgumentException {
SelectedTag s = (SelectedTag)getValue(); SelectedTag s = (SelectedTag)getValue();
Tag [] tags = s.getTags(); Tag [] tags = s.getTags();
@ -87,6 +90,7 @@ public class TagEditor extends PropertyEditorSupport {
* *
* @return an array of string tags. * @return an array of string tags.
*/ */
@Override
public String[] getTags() { public String[] getTags() {
SelectedTag s = (SelectedTag)getValue(); SelectedTag s = (SelectedTag)getValue();
@ -123,6 +127,7 @@ public class TagEditor extends PropertyEditorSupport {
byte[] bytes = loader.getBytesFromResourceLocation(EvAInfo.iconLocation, true); byte[] bytes = loader.getBytesFromResourceLocation(EvAInfo.iconLocation, true);
f.setIconImage(Toolkit.getDefaultToolkit().createImage(bytes)); f.setIconImage(Toolkit.getDefaultToolkit().createImage(bytes));
f.addWindowListener(new WindowAdapter() { f.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) { public void windowClosing(WindowEvent e) {
System.exit(0); System.exit(0);
} }

View File

@ -68,10 +68,12 @@ public class CustomTabbedPaneUI extends BasicTabbedPaneUI {
contentInsets = new Insets(i, i, i, i); contentInsets = new Insets(i, i, i, i);
} }
@Override
public int getTabRunCount(JTabbedPane pane) { public int getTabRunCount(JTabbedPane pane) {
return 1; return 1;
} }
@Override
protected void installDefaults() { protected void installDefaults() {
super.installDefaults(); super.installDefaults();
@ -87,15 +89,18 @@ public class CustomTabbedPaneUI extends BasicTabbedPaneUI {
return false; return false;
} }
@Override
protected Insets getContentBorderInsets(int tabPlacement) { protected Insets getContentBorderInsets(int tabPlacement) {
return contentInsets; return contentInsets;
} }
@Override
protected int calculateTabHeight(int tabPlacement, int tabIndex, protected int calculateTabHeight(int tabPlacement, int tabIndex,
int fontHeight) { int fontHeight) {
return 21; return 21;
} }
@Override
protected int calculateTabWidth(int tabPlacement, int tabIndex, protected int calculateTabWidth(int tabPlacement, int tabIndex,
FontMetrics metrics) { FontMetrics metrics) {
int w = super.calculateTabWidth(tabPlacement, tabIndex, metrics); int w = super.calculateTabWidth(tabPlacement, tabIndex, metrics);
@ -104,10 +109,12 @@ public class CustomTabbedPaneUI extends BasicTabbedPaneUI {
return w; return w;
} }
@Override
protected int calculateMaxTabHeight(int tabPlacement) { protected int calculateMaxTabHeight(int tabPlacement) {
return 21; return 21;
} }
@Override
protected void paintTabArea(Graphics g, int tabPlacement, int selectedIndex) { protected void paintTabArea(Graphics g, int tabPlacement, int selectedIndex) {
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
g2d.setPaint(new GradientPaint(0, 0, defaultColorSet.topGradColor1, 0, g2d.setPaint(new GradientPaint(0, 0, defaultColorSet.topGradColor1, 0,
@ -125,6 +132,7 @@ public class CustomTabbedPaneUI extends BasicTabbedPaneUI {
} }
} }
@Override
protected void paintTabBackground(Graphics g, int tabPlacement, protected void paintTabBackground(Graphics g, int tabPlacement,
int tabIndex, int x, int y, int w, int h, boolean isSelected) { int tabIndex, int x, int y, int w, int h, boolean isSelected) {
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
@ -164,6 +172,7 @@ public class CustomTabbedPaneUI extends BasicTabbedPaneUI {
} }
} }
@Override
protected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex, protected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex,
int x, int y, int w, int h, boolean isSelected) { int x, int y, int w, int h, boolean isSelected) {
Rectangle rect = getTabBounds(tabIndex, new Rectangle(x, y, w, h)); Rectangle rect = getTabBounds(tabIndex, new Rectangle(x, y, w, h));
@ -171,31 +180,37 @@ public class CustomTabbedPaneUI extends BasicTabbedPaneUI {
g.drawLine(rect.x + rect.width, 0, rect.x + rect.width, 20); g.drawLine(rect.x + rect.width, 0, rect.x + rect.width, 20);
} }
@Override
protected void paintContentBorderTopEdge(Graphics g, int tabPlacement, protected void paintContentBorderTopEdge(Graphics g, int tabPlacement,
int selectedIndex, int x, int y, int w, int h) { int selectedIndex, int x, int y, int w, int h) {
} }
@Override
protected void paintContentBorderRightEdge(Graphics g, int tabPlacement, protected void paintContentBorderRightEdge(Graphics g, int tabPlacement,
int selectedIndex, int x, int y, int w, int h) { int selectedIndex, int x, int y, int w, int h) {
// Do nothing // Do nothing
} }
@Override
protected void paintContentBorderLeftEdge(Graphics g, int tabPlacement, protected void paintContentBorderLeftEdge(Graphics g, int tabPlacement,
int selectedIndex, int x, int y, int w, int h) { int selectedIndex, int x, int y, int w, int h) {
// Do nothing // Do nothing
} }
@Override
protected void paintContentBorderBottomEdge(Graphics g, int tabPlacement, protected void paintContentBorderBottomEdge(Graphics g, int tabPlacement,
int selectedIndex, int x, int y, int w, int h) { int selectedIndex, int x, int y, int w, int h) {
// Do nothing // Do nothing
} }
@Override
protected void paintFocusIndicator(Graphics g, int tabPlacement, protected void paintFocusIndicator(Graphics g, int tabPlacement,
Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle[] rects, int tabIndex, Rectangle iconRect,
Rectangle textRect, boolean isSelected) { Rectangle textRect, boolean isSelected) {
// Do nothing // Do nothing
} }
@Override
protected int getTabLabelShiftY(int tabPlacement, int tabIndex, protected int getTabLabelShiftY(int tabPlacement, int tabIndex,
boolean isSelected) { boolean isSelected) {
return 0; return 0;
@ -212,26 +227,33 @@ public class CustomTabbedPaneUI extends BasicTabbedPaneUI {
private class RollOverListener implements MouseMotionListener, private class RollOverListener implements MouseMotionListener,
MouseListener { MouseListener {
@Override
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
} }
@Override
public void mouseMoved(MouseEvent e) { public void mouseMoved(MouseEvent e) {
checkRollOver(); checkRollOver();
} }
@Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
} }
@Override
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
} }
@Override
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
} }
@Override
public void mouseEntered(MouseEvent e) { public void mouseEntered(MouseEvent e) {
checkRollOver(); checkRollOver();
} }
@Override
public void mouseExited(MouseEvent e) { public void mouseExited(MouseEvent e) {
tabPane.repaint(); tabPane.repaint();
} }

View File

@ -26,14 +26,17 @@ public class EvAMainAdapterImpl extends MainAdapterImpl implements EvAMainAdapte
moduleServer = new ModuleServer(EvAInfo.getProperties()); moduleServer = new ModuleServer(EvAInfo.getProperties());
} }
@Override
public String[] getModuleNameList() { public String[] getModuleNameList() {
return moduleServer.getModuleNameList(); return moduleServer.getModuleNameList();
} }
@Override
public ModuleAdapter getModuleAdapter(String selectedModule, boolean withoutRMI, String hostAddress, MainAdapterClient client) { public ModuleAdapter getModuleAdapter(String selectedModule, boolean withoutRMI, String hostAddress, MainAdapterClient client) {
return getModuleAdapter(selectedModule, withoutRMI, hostAddress, null, null, client); return getModuleAdapter(selectedModule, withoutRMI, hostAddress, null, null, client);
} }
@Override
public ModuleAdapter getModuleAdapter(String selectedModule, boolean withoutRMI, String hostAddress, InterfaceGOParameters goParams, String noGuiStatsFile, MainAdapterClient client) { public ModuleAdapter getModuleAdapter(String selectedModule, boolean withoutRMI, String hostAddress, InterfaceGOParameters goParams, String noGuiStatsFile, MainAdapterClient client) {
return moduleServer.createModuleAdapter(selectedModule, client, withoutRMI, hostAddress, goParams, noGuiStatsFile); return moduleServer.createModuleAdapter(selectedModule, client, withoutRMI, hostAddress, goParams, noGuiStatsFile);
} }

View File

@ -27,6 +27,7 @@ public class RMIServerEvA extends RMIServer {
return (RMIServerEvA)instance; return (RMIServerEvA)instance;
} }
@Override
protected void createMainRemoteObject(String mainAdapterName) { protected void createMainRemoteObject(String mainAdapterName) {
try { try {
mainRemoteObject = new EvAMainAdapterImpl(); mainRemoteObject = new EvAMainAdapterImpl();

View File

@ -118,6 +118,7 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
this.m_Frame.setSize(500, 400); this.m_Frame.setSize(500, 400);
this.m_Frame.setLocation(530, 50); this.m_Frame.setLocation(530, 50);
this.m_Frame.addWindowListener(new WindowAdapter() { this.m_Frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent ev) { public void windowClosing(WindowEvent ev) {
System.exit(0); System.exit(0);
} }
@ -197,11 +198,14 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
/** This action listener, called by the "Run/Restart" button, will init the problem and start the computation. /** This action listener, called by the "Run/Restart" button, will init the problem and start the computation.
*/ */
ActionListener runListener = new ActionListener() { ActionListener runListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
worker = new SwingWorker() { worker = new SwingWorker() {
@Override
public Object construct() { public Object construct() {
return doWork(); return doWork();
} }
@Override
public void finished() { public void finished() {
m_RunButton.setEnabled(true); m_RunButton.setEnabled(true);
m_Continue.setEnabled(true); m_Continue.setEnabled(true);
@ -221,6 +225,7 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
* the doWork() method handles InterruptedExceptions cleanly. * the doWork() method handles InterruptedExceptions cleanly.
*/ */
ActionListener stopListener = new ActionListener() { ActionListener stopListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
m_RunButton.setEnabled(true); m_RunButton.setEnabled(true);
m_Continue.setEnabled(true); m_Continue.setEnabled(true);
@ -235,12 +240,15 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
* the doWork() method handles InterruptedExceptions cleanly. * the doWork() method handles InterruptedExceptions cleanly.
*/ */
ActionListener continueListener = new ActionListener() { ActionListener continueListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
// todo something need to be done here... // todo something need to be done here...
worker = new SwingWorker() { worker = new SwingWorker() {
@Override
public Object construct() { public Object construct() {
return doWork(); return doWork();
} }
@Override
public void finished() { public void finished() {
m_RunButton.setEnabled(true); m_RunButton.setEnabled(true);
m_Continue.setEnabled(true); m_Continue.setEnabled(true);
@ -264,6 +272,7 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
* currently best solution in a frame. * currently best solution in a frame.
*/ */
ActionListener showSolListener = new ActionListener() { ActionListener showSolListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
JFrame frame = new JFrame(); JFrame frame = new JFrame();
frame.setTitle("The current best solution for "+m_GO.getProblem().getName()); frame.setTitle("The current best solution for "+m_GO.getProblem().getName());
@ -278,6 +287,7 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
/** This method gives the experimental settings and starts the work. /** This method gives the experimental settings and starts the work.
*/ */
@Override
public void startExperiment() { public void startExperiment() {
// This is for the CBN-TEST RUNS // This is for the CBN-TEST RUNS
this.m_GO.setOptimizer(new EvolutionStrategies()); this.m_GO.setOptimizer(new EvolutionStrategies());
@ -508,6 +518,7 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
void updateStatus(final int i) { void updateStatus(final int i) {
if (this.m_ProgressBar != null) { if (this.m_ProgressBar != null) {
Runnable doSetProgressBarValue = new Runnable() { Runnable doSetProgressBarValue = new Runnable() {
@Override
public void run() { public void run() {
m_ProgressBar.setValue(i); m_ProgressBar.setValue(i);
} }
@ -533,6 +544,7 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
} }
} }
@Override
public void setShow(boolean t) { public void setShow(boolean t) {
this.show = t; this.show = t;
} }
@ -541,6 +553,7 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
* @param source The source of the event. * @param source The source of the event.
* @param name Could be used to indicate the nature of the event. * @param name Could be used to indicate the nature of the event.
*/ */
@Override
public void registerPopulationStateChanged(Object source, String name) { public void registerPopulationStateChanged(Object source, String name) {
if (name.equals(Population.nextGenerationPerformed)) { if (name.equals(Population.nextGenerationPerformed)) {
Population population = ((InterfaceOptimizer)source).getPopulation(); Population population = ((InterfaceOptimizer)source).getPopulation();

View File

@ -19,6 +19,7 @@ public interface InterfaceTerminator {
public boolean isTerminated(PopulationInterface pop); public boolean isTerminated(PopulationInterface pop);
public boolean isTerminated(InterfaceSolutionSet pop); public boolean isTerminated(InterfaceSolutionSet pop);
@Override
public String toString(); public String toString();
public String lastTerminationMessage(); public String lastTerminationMessage();
public void init(InterfaceOptimizationProblem prob); public void init(InterfaceOptimizationProblem prob);

View File

@ -58,6 +58,7 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati
this.m_JFrame.setSize(1200, 750); this.m_JFrame.setSize(1200, 750);
this.m_JFrame.setLocation(50, 50); this.m_JFrame.setLocation(50, 50);
this.m_JFrame.addWindowListener(new WindowAdapter() { this.m_JFrame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent ev) { public void windowClosing(WindowEvent ev) {
System.exit(0); System.exit(0);
} }
@ -359,6 +360,7 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati
/** This method starts the actual optimization procedure /** This method starts the actual optimization procedure
*/ */
@Override
public void startExperiment() { public void startExperiment() {
if (this.m_JFrame != null) { if (this.m_JFrame != null) {
} }
@ -370,9 +372,11 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati
if (this.m_State.m_Optimizer.getPopulation().size() == 0) this.m_State.m_Optimizer.init(); if (this.m_State.m_Optimizer.getPopulation().size() == 0) this.m_State.m_Optimizer.init();
this.m_State.m_Optimizer.addPopulationChangedEventListener(this); this.m_State.m_Optimizer.addPopulationChangedEventListener(this);
worker = new SwingWorker() { worker = new SwingWorker() {
@Override
public Object construct() { public Object construct() {
return doWork(); return doWork();
} }
@Override
public void finished() { public void finished() {
Population[] pop = null; Population[] pop = null;
if (m_State.m_Optimizer instanceof IslandModelEA) { if (m_State.m_Optimizer instanceof IslandModelEA) {
@ -406,6 +410,7 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati
void updateStatus(final String t, final int i) { void updateStatus(final String t, final int i) {
if (this.m_ProgressBar != null) { if (this.m_ProgressBar != null) {
Runnable doSetProgressBarValue = new Runnable() { Runnable doSetProgressBarValue = new Runnable() {
@Override
public void run() { public void run() {
m_ProgressBar.setValue(i); m_ProgressBar.setValue(i);
} }
@ -438,6 +443,7 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati
return "All Done"; return "All Done";
} }
@Override
public void setShow(boolean t) { public void setShow(boolean t) {
// i guess this is not necessary in this environment // i guess this is not necessary in this environment
} }
@ -449,6 +455,7 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati
* @param source The source of the event. * @param source The source of the event.
* @param name Could be used to indicate the nature of the event. * @param name Could be used to indicate the nature of the event.
*/ */
@Override
public void registerPopulationStateChanged(Object source, String name) { public void registerPopulationStateChanged(Object source, String name) {
int currentProgress; int currentProgress;
if (name.equals(Population.nextGenerationPerformed)) { if (name.equals(Population.nextGenerationPerformed)) {

View File

@ -89,10 +89,12 @@ public abstract class SwingWorker {
*/ */
public SwingWorker() { public SwingWorker() {
final Runnable doFinished = new Runnable() { final Runnable doFinished = new Runnable() {
@Override
public void run() { finished(); } public void run() { finished(); }
}; };
Runnable doConstruct = new Runnable() { Runnable doConstruct = new Runnable() {
@Override
public void run() { public void run() {
try { try {
setValue(construct()); setValue(construct());

View File

@ -81,6 +81,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
* *
* @return The clone * @return The clone
*/ */
@Override
public abstract Object clone(); public abstract Object clone();
/** /**
@ -595,6 +596,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
* *
* @return The complete fitness array * @return The complete fitness array
*/ */
@Override
public double[] getFitness() { public double[] getFitness() {
return this.m_Fitness; return this.m_Fitness;
} }
@ -620,6 +622,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
* @param fitness The new fitness array * @param fitness The new fitness array
* @deprecated * @deprecated
*/ */
@Override
public void setFitness(double[] fitness) { public void setFitness(double[] fitness) {
this.m_Fitness = fitness; this.m_Fitness = fitness;
} }

View File

@ -108,6 +108,7 @@ public class AbstractEAIndividualComparator implements Comparator<Object>, Seria
preferFeasible = other.preferFeasible; preferFeasible = other.preferFeasible;
} }
@Override
public Object clone() { public Object clone() {
return new AbstractEAIndividualComparator(this); return new AbstractEAIndividualComparator(this);
} }
@ -120,6 +121,7 @@ public class AbstractEAIndividualComparator implements Comparator<Object>, Seria
* @param o2 the second AbstractEAIndividual to compare * @param o2 the second AbstractEAIndividual to compare
* @return -1 if the first is dominant, 1 if the second is dominant, otherwise 0 * @return -1 if the first is dominant, 1 if the second is dominant, otherwise 0
*/ */
@Override
public int compare(Object o1, Object o2) { public int compare(Object o1, Object o2) {
boolean o1domO2, o2domO1; boolean o1domO2, o2domO1;

View File

@ -65,6 +65,7 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
cloneAEAObjects((AbstractEAIndividual) individual); cloneAEAObjects((AbstractEAIndividual) individual);
} }
@Override
public Object clone() { public Object clone() {
return (Object) new ESIndividualBinaryData(this); return (Object) new ESIndividualBinaryData(this);
} }
@ -73,6 +74,7 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
* @param individual The individual to compare to. * @param individual The individual to compare to.
* @return boolean if equal true else false. * @return boolean if equal true else false.
*/ */
@Override
public boolean equalGenotypes(AbstractEAIndividual individual) { public boolean equalGenotypes(AbstractEAIndividual individual) {
if (individual instanceof ESIndividualBinaryData) { if (individual instanceof ESIndividualBinaryData) {
ESIndividualBinaryData indy = (ESIndividualBinaryData) individual; ESIndividualBinaryData indy = (ESIndividualBinaryData) individual;
@ -95,6 +97,7 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
/** This method allows you to request a certain amount of binary data /** This method allows you to request a certain amount of binary data
* @param length The lenght of the BitSet that is to be optimized * @param length The lenght of the BitSet that is to be optimized
*/ */
@Override
public void setBinaryDataLength(int length) { public void setBinaryDataLength(int length) {
this.m_Genotype = new double[length]; this.m_Genotype = new double[length];
this.m_Range = new double[length][2]; this.m_Range = new double[length][2];
@ -107,6 +110,7 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
/** This method returns the length of the binary data set /** This method returns the length of the binary data set
* @return The number of bits stored * @return The number of bits stored
*/ */
@Override
public int size() { public int size() {
return this.m_Genotype.length; return this.m_Genotype.length;
} }
@ -114,6 +118,7 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
/** This method allows you to read the binary data /** This method allows you to read the binary data
* @return BitSet representing the binary data. * @return BitSet representing the binary data.
*/ */
@Override
public BitSet getBinaryData() { public BitSet getBinaryData() {
if (this.m_UseHardSwitch) { if (this.m_UseHardSwitch) {
// In this case it is only tested if the genotyp is bigger than 0.5 // In this case it is only tested if the genotyp is bigger than 0.5
@ -141,6 +146,7 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
* an update from the genotype * an update from the genotype
* @return BitSet representing the binary data. * @return BitSet representing the binary data.
*/ */
@Override
public BitSet getBinaryDataWithoutUpdate() { public BitSet getBinaryDataWithoutUpdate() {
return this.m_Phenotype; return this.m_Phenotype;
} }
@ -148,6 +154,7 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
/** This method allows you to set the binary data. /** This method allows you to set the binary data.
* @param binaryData The new binary data. * @param binaryData The new binary data.
*/ */
@Override
public void SetBinaryPhenotype(BitSet binaryData) { public void SetBinaryPhenotype(BitSet binaryData) {
this.m_Phenotype = binaryData; this.m_Phenotype = binaryData;
} }
@ -155,6 +162,7 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
* memetic algorithms. * memetic algorithms.
* @param binaryData The new binary data. * @param binaryData The new binary data.
*/ */
@Override
public void SetBinaryGenotype(BitSet binaryData) { public void SetBinaryGenotype(BitSet binaryData) {
this.SetBinaryPhenotype(binaryData); this.SetBinaryPhenotype(binaryData);
for (int i = 0; i < this.m_Genotype.length; i++) { for (int i = 0; i < this.m_Genotype.length; i++) {
@ -176,6 +184,7 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
* @param obj The initial value for the phenotype * @param obj The initial value for the phenotype
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@Override
public void initByValue(Object obj, InterfaceOptimizationProblem opt) { public void initByValue(Object obj, InterfaceOptimizationProblem opt) {
if (obj instanceof BitSet) { if (obj instanceof BitSet) {
BitSet bs = (BitSet) obj; BitSet bs = (BitSet) obj;
@ -192,6 +201,7 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
* noteably the Genotype. * noteably the Genotype.
* @return A descriptive string * @return A descriptive string
*/ */
@Override
public String getStringRepresentation() { public String getStringRepresentation() {
String result = ""; String result = "";
result += "ESIndividual coding double: ("; result += "ESIndividual coding double: (";
@ -215,6 +225,7 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
/** This method will allow the user to read the ES 'genotype' /** This method will allow the user to read the ES 'genotype'
* @return BitSet * @return BitSet
*/ */
@Override
public double[] getDGenotype() { public double[] getDGenotype() {
return this.m_Genotype; return this.m_Genotype;
} }
@ -222,6 +233,7 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
/** This method will allow the user to set the current ES 'genotype'. /** This method will allow the user to set the current ES 'genotype'.
* @param b The new genotype of the Individual * @param b The new genotype of the Individual
*/ */
@Override
public void SetDGenotype(double[] b) { public void SetDGenotype(double[] b) {
this.m_Genotype = b; this.m_Genotype = b;
for (int i = 0; i < this.m_Genotype.length; i++) { for (int i = 0; i < this.m_Genotype.length; i++) {
@ -242,16 +254,19 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
/** This method will return the range for all double attributes. /** This method will return the range for all double attributes.
* @return The range array. * @return The range array.
*/ */
@Override
public double[][] getDoubleRange() { public double[][] getDoubleRange() {
return this.m_Range; return this.m_Range;
} }
/** This method performs a simple one element mutation on the double vector /** This method performs a simple one element mutation on the double vector
*/ */
@Override
public void defaultMutate() { public void defaultMutate() {
ESIndividualDoubleData.defaultMutate(m_Genotype, m_Range); ESIndividualDoubleData.defaultMutate(m_Genotype, m_Range);
} }
@Override
public void defaultInit(InterfaceOptimizationProblem prob) { public void defaultInit(InterfaceOptimizationProblem prob) {
if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange)prob).getInitRange()!=null)) ESIndividualDoubleData.defaultInit(m_Genotype, (double[][])((InterfaceHasInitRange)prob).getInitRange()); if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange)prob).getInitRange()!=null)) ESIndividualDoubleData.defaultInit(m_Genotype, (double[][])((InterfaceHasInitRange)prob).getInitRange());
else ESIndividualDoubleData.defaultInit(m_Genotype, m_Range); else ESIndividualDoubleData.defaultInit(m_Genotype, m_Range);
@ -263,6 +278,7 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
* name to the current object. * name to the current object.
* @return The name. * @return The name.
*/ */
@Override
public String getName() { public String getName() {
return "ES individual"; return "ES individual";
} }

View File

@ -66,6 +66,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
cloneAEAObjects((AbstractEAIndividual) individual); cloneAEAObjects((AbstractEAIndividual) individual);
} }
@Override
public Object clone() { public Object clone() {
return (Object) new ESIndividualDoubleData(this); return (Object) new ESIndividualDoubleData(this);
} }
@ -74,6 +75,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
* @param individual The individual to compare to. * @param individual The individual to compare to.
* @return boolean if equal true else false. * @return boolean if equal true else false.
*/ */
@Override
public boolean equalGenotypes(AbstractEAIndividual individual) { public boolean equalGenotypes(AbstractEAIndividual individual) {
if (individual instanceof ESIndividualDoubleData) { if (individual instanceof ESIndividualDoubleData) {
ESIndividualDoubleData indy = (ESIndividualDoubleData) individual; ESIndividualDoubleData indy = (ESIndividualDoubleData) individual;
@ -98,6 +100,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
/** This method allows you to request a certain amount of double data /** This method allows you to request a certain amount of double data
* @param length The lenght of the double[] that is to be optimized * @param length The lenght of the double[] that is to be optimized
*/ */
@Override
public void setDoubleDataLength (int length) { public void setDoubleDataLength (int length) {
double[] newDesPa = new double[length]; double[] newDesPa = new double[length];
double[][] newRange = new double[length][2]; double[][] newRange = new double[length][2];
@ -131,6 +134,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
/** This method returns the length of the double data set /** This method returns the length of the double data set
* @return The number of bits stored * @return The number of bits stored
*/ */
@Override
public int size() { public int size() {
return this.m_Genotype.length; return this.m_Genotype.length;
} }
@ -140,6 +144,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
* ranges. * ranges.
* @param range The new range for the double data. * @param range The new range for the double data.
*/ */
@Override
public void SetDoubleRange(double[][] range) { public void SetDoubleRange(double[][] range) {
if (range.length != this.m_Range.length) { if (range.length != this.m_Range.length) {
System.out.println("Warning: Trying to set a range of length " + range.length + " to a vector of length " System.out.println("Warning: Trying to set a range of length " + range.length + " to a vector of length "
@ -154,6 +159,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
/** This method will return the range for all double attributes. /** This method will return the range for all double attributes.
* @return The range array. * @return The range array.
*/ */
@Override
public double[][] getDoubleRange() { public double[][] getDoubleRange() {
return this.m_Range; return this.m_Range;
} }
@ -162,6 +168,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
* and the genotype copied. * and the genotype copied.
* @return BitSet representing the double data. * @return BitSet representing the double data.
*/ */
@Override
public double[] getDoubleData() { public double[] getDoubleData() {
// since the phenotype is set to null if the genotype is changed, // since the phenotype is set to null if the genotype is changed,
// it should now be save to only perform the copy if the phenotype is null // it should now be save to only perform the copy if the phenotype is null
@ -178,6 +185,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
* an update from the genotype. * an update from the genotype.
* @return double[] representing the double data. * @return double[] representing the double data.
*/ */
@Override
public double[] getDoubleDataWithoutUpdate() { public double[] getDoubleDataWithoutUpdate() {
if (m_Phenotype==null) return getDoubleData(); if (m_Phenotype==null) return getDoubleData();
else return this.m_Phenotype; else return this.m_Phenotype;
@ -187,6 +195,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
* use SetDoubleDataLamarckian(). * use SetDoubleDataLamarckian().
* @param doubleData The new double data. * @param doubleData The new double data.
*/ */
@Override
public void SetDoublePhenotype(double[] doubleData) { public void SetDoublePhenotype(double[] doubleData) {
this.m_Phenotype = doubleData; this.m_Phenotype = doubleData;
} }
@ -195,6 +204,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
* memetic algorithms. * memetic algorithms.
* @param doubleData The new double data. * @param doubleData The new double data.
*/ */
@Override
public void SetDoubleGenotype(double[] doubleData) { public void SetDoubleGenotype(double[] doubleData) {
// this.SetDoublePhenotype(doubleData); // this.SetDoublePhenotype(doubleData);
this.SetDoublePhenotype(null); // tag it as invalid this.SetDoublePhenotype(null); // tag it as invalid
@ -208,6 +218,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
/** This method will allow a default initialisation of the individual /** This method will allow a default initialisation of the individual
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@Override
public void init(InterfaceOptimizationProblem opt) { public void init(InterfaceOptimizationProblem opt) {
super.init(opt); super.init(opt);
// evil operators may not respect the range, so at least give some hint // evil operators may not respect the range, so at least give some hint
@ -219,6 +230,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
* @param obj The initial value for the phenotype * @param obj The initial value for the phenotype
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@Override
public void initByValue(Object obj, InterfaceOptimizationProblem opt) { public void initByValue(Object obj, InterfaceOptimizationProblem opt) {
if (obj instanceof double[]) { if (obj instanceof double[]) {
double[] bs = (double[]) obj; double[] bs = (double[]) obj;
@ -236,6 +248,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
* noteably the Genotype. * noteably the Genotype.
* @return A descriptive string * @return A descriptive string
*/ */
@Override
public String getStringRepresentation() { public String getStringRepresentation() {
StringBuilder strB = new StringBuilder(200); StringBuilder strB = new StringBuilder(200);
strB.append("ESIndividual coding double: (Fitness {"); strB.append("ESIndividual coding double: (Fitness {");
@ -264,6 +277,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
/** This method will allow the user to read the ES 'genotype' /** This method will allow the user to read the ES 'genotype'
* @return BitSet * @return BitSet
*/ */
@Override
public double[] getDGenotype() { public double[] getDGenotype() {
return this.m_Genotype; return this.m_Genotype;
} }
@ -271,6 +285,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
/** This method will allow the user to set the current ES 'genotype'. /** This method will allow the user to set the current ES 'genotype'.
* @param b The new genotype of the Individual * @param b The new genotype of the Individual
*/ */
@Override
public void SetDGenotype(double[] b) { public void SetDGenotype(double[] b) {
this.m_Genotype = b; this.m_Genotype = b;
this.m_Phenotype=null; // mark it as invalid this.m_Phenotype=null; // mark it as invalid
@ -290,6 +305,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
/** This method performs a simple one element mutation on the double vector /** This method performs a simple one element mutation on the double vector
*/ */
@Override
public void defaultMutate() { public void defaultMutate() {
ESIndividualDoubleData.defaultMutate(this.m_Genotype, this.m_Range); ESIndividualDoubleData.defaultMutate(this.m_Genotype, this.m_Range);
m_Phenotype=null; // mark it as invalid m_Phenotype=null; // mark it as invalid
@ -310,6 +326,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
if (genotype[mutationIndex] > range[mutationIndex][1]) genotype[mutationIndex] = range[mutationIndex][1]; if (genotype[mutationIndex] > range[mutationIndex][1]) genotype[mutationIndex] = range[mutationIndex][1];
} }
@Override
public void defaultInit(InterfaceOptimizationProblem prob) { public void defaultInit(InterfaceOptimizationProblem prob) {
if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange)prob).getInitRange()!=null)) ESIndividualDoubleData.defaultInit(m_Genotype, (double[][])((InterfaceHasInitRange)prob).getInitRange()); if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange)prob).getInitRange()!=null)) ESIndividualDoubleData.defaultInit(m_Genotype, (double[][])((InterfaceHasInitRange)prob).getInitRange());
else ESIndividualDoubleData.defaultInit(m_Genotype, m_Range); else ESIndividualDoubleData.defaultInit(m_Genotype, m_Range);
@ -336,6 +353,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
* name to the current object. * name to the current object.
* @return The name. * @return The name.
*/ */
@Override
public String getName() { public String getName() {
return "ES individual"; return "ES individual";
} }

View File

@ -61,6 +61,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
cloneAEAObjects((AbstractEAIndividual) individual); cloneAEAObjects((AbstractEAIndividual) individual);
} }
@Override
public Object clone() { public Object clone() {
return (Object) new ESIndividualIntegerData(this); return (Object) new ESIndividualIntegerData(this);
} }
@ -69,6 +70,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
* @param individual The individual to compare to. * @param individual The individual to compare to.
* @return boolean if equal true else false. * @return boolean if equal true else false.
*/ */
@Override
public boolean equalGenotypes(AbstractEAIndividual individual) { public boolean equalGenotypes(AbstractEAIndividual individual) {
if (individual instanceof ESIndividualIntegerData) { if (individual instanceof ESIndividualIntegerData) {
ESIndividualIntegerData indy = (ESIndividualIntegerData) individual; ESIndividualIntegerData indy = (ESIndividualIntegerData) individual;
@ -91,6 +93,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
/** This method allows you to request a certain amount of int data /** This method allows you to request a certain amount of int data
* @param length The lenght of the int[] that is to be optimized * @param length The lenght of the int[] that is to be optimized
*/ */
@Override
public void setIntegerDataLength (int length) { public void setIntegerDataLength (int length) {
double[] newDesPa = new double[length]; double[] newDesPa = new double[length];
int[][] newRange = new int[length][2]; int[][] newRange = new int[length][2];
@ -115,6 +118,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
/** This method returns the length of the int data set /** This method returns the length of the int data set
* @return The number of ints stored * @return The number of ints stored
*/ */
@Override
public int size() { public int size() {
return this.m_Genotype.length; return this.m_Genotype.length;
} }
@ -124,6 +128,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
* ranges. * ranges.
* @param range The new range for the int data. * @param range The new range for the int data.
*/ */
@Override
public void SetIntRange(int[][] range) { public void SetIntRange(int[][] range) {
if (range.length != this.m_Range.length) { if (range.length != this.m_Range.length) {
System.out.println("Warning: Trying to set a range of length " + range.length + " to a vector of length " System.out.println("Warning: Trying to set a range of length " + range.length + " to a vector of length "
@ -138,6 +143,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
/** This method will return the range for all int attributes. /** This method will return the range for all int attributes.
* @return The range array. * @return The range array.
*/ */
@Override
public int[][] getIntRange() { public int[][] getIntRange() {
return this.m_Range; return this.m_Range;
} }
@ -145,6 +151,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
/** This method allows you to read the int data /** This method allows you to read the int data
* @return int[] representing the int data. * @return int[] representing the int data.
*/ */
@Override
public int[] getIntegerData() { public int[] getIntegerData() {
this.m_Phenotype = new int[this.m_Genotype.length]; this.m_Phenotype = new int[this.m_Genotype.length];
for (int i = 0; i < this.m_Phenotype.length; i++) { for (int i = 0; i < this.m_Phenotype.length; i++) {
@ -159,6 +166,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
* an update from the genotype * an update from the genotype
* @return int[] representing the int data. * @return int[] representing the int data.
*/ */
@Override
public int[] getIntegerDataWithoutUpdate() { public int[] getIntegerDataWithoutUpdate() {
return this.m_Phenotype; return this.m_Phenotype;
} }
@ -166,6 +174,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
/** This method allows you to set the int data. /** This method allows you to set the int data.
* @param intData The new int data. * @param intData The new int data.
*/ */
@Override
public void SetIntPhenotype(int[] intData) { public void SetIntPhenotype(int[] intData) {
this.m_Phenotype = intData; this.m_Phenotype = intData;
} }
@ -174,6 +183,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
* memetic algorithms. * memetic algorithms.
* @param intData The new int data. * @param intData The new int data.
*/ */
@Override
public void SetIntGenotype(int[] intData) { public void SetIntGenotype(int[] intData) {
for (int i = 0; i < this.m_Genotype.length; i++) { for (int i = 0; i < this.m_Genotype.length; i++) {
m_Genotype[i]=(double)intData[i]; m_Genotype[i]=(double)intData[i];
@ -190,6 +200,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
* @param obj The initial value for the phenotype * @param obj The initial value for the phenotype
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@Override
public void initByValue(Object obj, InterfaceOptimizationProblem opt) { public void initByValue(Object obj, InterfaceOptimizationProblem opt) {
if (obj instanceof int[]) { if (obj instanceof int[]) {
int[] bs = (int[]) obj; int[] bs = (int[]) obj;
@ -207,6 +218,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
* noteably the Genotype. * noteably the Genotype.
* @return A descriptive string * @return A descriptive string
*/ */
@Override
public String getStringRepresentation() { public String getStringRepresentation() {
String result = ""; String result = "";
result += "ESIndividual coding int: ("; result += "ESIndividual coding int: (";
@ -229,6 +241,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
/** This method will allow the user to read the ES 'genotype' /** This method will allow the user to read the ES 'genotype'
* @return BitSet * @return BitSet
*/ */
@Override
public double[] getDGenotype() { public double[] getDGenotype() {
return this.m_Genotype; return this.m_Genotype;
} }
@ -236,6 +249,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
/** This method will allow the user to set the current ES 'genotype'. /** This method will allow the user to set the current ES 'genotype'.
* @param b The new genotype of the Individual * @param b The new genotype of the Individual
*/ */
@Override
public void SetDGenotype(double[] b) { public void SetDGenotype(double[] b) {
this.m_Genotype = b; this.m_Genotype = b;
for (int i = 0; i < this.m_Genotype.length; i++) { for (int i = 0; i < this.m_Genotype.length; i++) {
@ -246,6 +260,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
/** This method performs a simple one element mutation on the double vector /** This method performs a simple one element mutation on the double vector
*/ */
@Override
public void defaultMutate() { public void defaultMutate() {
int mutationIndex = RNG.randomInt(0, this.m_Genotype.length-1); int mutationIndex = RNG.randomInt(0, this.m_Genotype.length-1);
this.m_Genotype[mutationIndex] += ((this.m_Range[mutationIndex][1] - this.m_Range[mutationIndex][0])/2)*RNG.gaussianDouble(0.05f); this.m_Genotype[mutationIndex] += ((this.m_Range[mutationIndex][1] - this.m_Range[mutationIndex][0])/2)*RNG.gaussianDouble(0.05f);
@ -256,6 +271,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
/** This method will return the range for all double attributes. /** This method will return the range for all double attributes.
* @return The range array. * @return The range array.
*/ */
@Override
public double[][] getDoubleRange() { public double[][] getDoubleRange() {
double[][] result = new double[this.m_Range.length][2]; double[][] result = new double[this.m_Range.length][2];
for (int i = 0; i < this.m_Range.length; i++) { for (int i = 0; i < this.m_Range.length; i++) {
@ -265,6 +281,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
return result; return result;
} }
@Override
public void defaultInit(InterfaceOptimizationProblem prob) { public void defaultInit(InterfaceOptimizationProblem prob) {
int[][] range = m_Range; int[][] range = m_Range;
if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange)prob).getInitRange()!=null)) range = (int[][])((InterfaceHasInitRange)prob).getInitRange(); if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange)prob).getInitRange()!=null)) range = (int[][])((InterfaceHasInitRange)prob).getInitRange();
@ -279,6 +296,7 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
* name to the current object. * name to the current object.
* @return The name. * @return The name.
*/ */
@Override
public String getName() { public String getName() {
return "ES individual"; return "ES individual";
} }

View File

@ -79,6 +79,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
} }
@Override
public Object clone() { public Object clone() {
return (Object) new ESIndividualPermutationData(this); return (Object) new ESIndividualPermutationData(this);
} }
@ -87,6 +88,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
* @param individual The individual to compare to. * @param individual The individual to compare to.
* @return boolean if equal true else false. * @return boolean if equal true else false.
*/ */
@Override
public boolean equalGenotypes(AbstractEAIndividual individual) { public boolean equalGenotypes(AbstractEAIndividual individual) {
if (individual instanceof ESIndividualPermutationData) { if (individual instanceof ESIndividualPermutationData) {
ESIndividualPermutationData indy = (ESIndividualPermutationData) individual; ESIndividualPermutationData indy = (ESIndividualPermutationData) individual;
@ -108,6 +110,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
* InterfaceDataTypePermutation methods * InterfaceDataTypePermutation methods
*/ */
@Override
public void setPermutationDataLength(int[] length){ public void setPermutationDataLength(int[] length){
this.m_Genotype = new double[length.length][]; this.m_Genotype = new double[length.length][];
@ -126,6 +129,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
} }
} }
@Override
public int[] sizePermutation() { public int[] sizePermutation() {
int[] res = new int[m_Genotype.length]; int[] res = new int[m_Genotype.length];
for (int i = 0; i < m_Genotype.length; i++) { for (int i = 0; i < m_Genotype.length; i++) {
@ -134,6 +138,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
return res; return res;
} }
@Override
public void SetPermutationPhenotype(int[][] perm){ public void SetPermutationPhenotype(int[][] perm){
this.m_Phenotype = perm; this.m_Phenotype = perm;
this.m_Range = new double[perm.length][][]; this.m_Range = new double[perm.length][][];
@ -147,6 +152,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
} }
@Override
public void SetPermutationGenotype(int[][] perm){ public void SetPermutationGenotype(int[][] perm){
this.SetPermutationPhenotype(perm); this.SetPermutationPhenotype(perm);
@ -170,6 +176,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
} }
@Override
public int[][] getPermutationData() { public int[][] getPermutationData() {
this.m_Phenotype = new int[this.m_Genotype.length][]; this.m_Phenotype = new int[this.m_Genotype.length][];
for (int p = 0; p < m_Genotype.length; p++) { for (int p = 0; p < m_Genotype.length; p++) {
@ -200,6 +207,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
* an update from the genotype * an update from the genotype
* @return int[] representing the permutation. * @return int[] representing the permutation.
*/ */
@Override
public int[][] getPermutationDataWithoutUpdate() { public int[][] getPermutationDataWithoutUpdate() {
return this.m_Phenotype; return this.m_Phenotype;
} }
@ -207,6 +215,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
public int[] getFirstindex() { public int[] getFirstindex() {
return firstindex; return firstindex;
} }
@Override
public void setFirstindex(int[] firstindex) { public void setFirstindex(int[] firstindex) {
this.firstindex = firstindex; this.firstindex = firstindex;
} }
@ -220,6 +229,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
* @param obj The initial value for the phenotype * @param obj The initial value for the phenotype
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@Override
public void initByValue(Object obj, InterfaceOptimizationProblem opt) { public void initByValue(Object obj, InterfaceOptimizationProblem opt) {
if (obj instanceof int[][]) { if (obj instanceof int[][]) {
int[][] bs = (int[][]) obj; int[][] bs = (int[][]) obj;
@ -237,6 +247,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
* noteably the Genotype. * noteably the Genotype.
* @return A descriptive string * @return A descriptive string
*/ */
@Override
public String getStringRepresentation() { public String getStringRepresentation() {
String result = ""; String result = "";
result += "ESIndividual coding permutation: ("; result += "ESIndividual coding permutation: (";
@ -259,6 +270,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
/** This method will allow the user to read the ES 'genotype' /** This method will allow the user to read the ES 'genotype'
* @return BitSet * @return BitSet
*/ */
@Override
public double[] getDGenotype() { public double[] getDGenotype() {
return mapMatrixToVector(m_Genotype); return mapMatrixToVector(m_Genotype);
} }
@ -297,6 +309,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
/** This method will allow the user to set the current ES 'genotype'. /** This method will allow the user to set the current ES 'genotype'.
* @param b The new genotype of the Individual * @param b The new genotype of the Individual
*/ */
@Override
public void SetDGenotype(double[] b) { public void SetDGenotype(double[] b) {
this.m_Genotype = mapVectorToMatrix(b, this.sizePermutation()); this.m_Genotype = mapVectorToMatrix(b, this.sizePermutation());
for (int i = 0; i < this.m_Genotype.length; i++) { for (int i = 0; i < this.m_Genotype.length; i++) {
@ -311,12 +324,14 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
/** This method performs a one element mutation on every permutation coded by a double vector. /** This method performs a one element mutation on every permutation coded by a double vector.
*/ */
@Override
public void defaultMutate() { public void defaultMutate() {
for (int i = 0; i < m_Genotype.length; i++) { for (int i = 0; i < m_Genotype.length; i++) {
ESIndividualDoubleData.defaultMutate(m_Genotype[i], m_Range[i]); ESIndividualDoubleData.defaultMutate(m_Genotype[i], m_Range[i]);
} }
} }
@Override
public void defaultInit(InterfaceOptimizationProblem prob) { public void defaultInit(InterfaceOptimizationProblem prob) {
double[][][] range = m_Range; double[][][] range = m_Range;
if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange)prob).getInitRange()!=null)) range = (double[][][])((InterfaceHasInitRange)prob).getInitRange(); if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange)prob).getInitRange()!=null)) range = (double[][][])((InterfaceHasInitRange)prob).getInitRange();
@ -329,6 +344,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
/** This method will return the range for all double attributes. /** This method will return the range for all double attributes.
* @return The range array. * @return The range array.
*/ */
@Override
public double[][] getDoubleRange() { public double[][] getDoubleRange() {
int sumentries = 0; int sumentries = 0;
for (int i = 0; i < this.m_Range.length; i++) { for (int i = 0; i < this.m_Range.length; i++) {
@ -353,6 +369,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
* name to the current object. * name to the current object.
* @return The name. * @return The name.
*/ */
@Override
public String getName() { public String getName() {
return "ES individual"; return "ES individual";
} }

View File

@ -48,6 +48,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
cloneAEAObjects((AbstractEAIndividual) individual); cloneAEAObjects((AbstractEAIndividual) individual);
} }
@Override
public Object clone() { public Object clone() {
return (Object) new GAESIndividualBinaryDoubleData(this); return (Object) new GAESIndividualBinaryDoubleData(this);
} }
@ -56,6 +57,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
* @param individual The individual to compare to. * @param individual The individual to compare to.
* @return boolean if equal true else false. * @return boolean if equal true else false.
*/ */
@Override
public boolean equalGenotypes(AbstractEAIndividual individual) { public boolean equalGenotypes(AbstractEAIndividual individual) {
if (individual instanceof GAESIndividualBinaryDoubleData) { if (individual instanceof GAESIndividualBinaryDoubleData) {
GAESIndividualBinaryDoubleData indy = (GAESIndividualBinaryDoubleData)individual; GAESIndividualBinaryDoubleData indy = (GAESIndividualBinaryDoubleData)individual;
@ -70,11 +72,13 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
/** This method will allow a default initialisation of the individual /** This method will allow a default initialisation of the individual
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@Override
public void init(InterfaceOptimizationProblem opt) { public void init(InterfaceOptimizationProblem opt) {
((AbstractEAIndividual)this.m_Numbers).init(opt); ((AbstractEAIndividual)this.m_Numbers).init(opt);
((AbstractEAIndividual)this.m_BitSet).init(opt); ((AbstractEAIndividual)this.m_BitSet).init(opt);
} }
@Override
public void defaultInit(InterfaceOptimizationProblem prob) { public void defaultInit(InterfaceOptimizationProblem prob) {
((AbstractEAIndividual)this.m_Numbers).defaultInit(prob); ((AbstractEAIndividual)this.m_Numbers).defaultInit(prob);
((AbstractEAIndividual)this.m_BitSet).defaultInit(prob); ((AbstractEAIndividual)this.m_BitSet).defaultInit(prob);
@ -85,6 +89,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
* @param obj The initial value for the phenotype * @param obj The initial value for the phenotype
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@Override
public void initByValue(Object obj, InterfaceOptimizationProblem opt) { public void initByValue(Object obj, InterfaceOptimizationProblem opt) {
if (obj instanceof Object[]) { if (obj instanceof Object[]) {
if (((Object[])obj)[0] instanceof double[]) { if (((Object[])obj)[0] instanceof double[]) {
@ -103,11 +108,13 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
/** This method will mutate the individual randomly /** This method will mutate the individual randomly
*/ */
@Override
public void mutate() { public void mutate() {
if (RNG.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_Numbers).mutate(); if (RNG.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_Numbers).mutate();
if (RNG.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_BitSet).mutate(); if (RNG.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_BitSet).mutate();
} }
@Override
public void defaultMutate() { public void defaultMutate() {
((AbstractEAIndividual)this.m_Numbers).defaultMutate(); ((AbstractEAIndividual)this.m_Numbers).defaultMutate();
((AbstractEAIndividual)this.m_BitSet).defaultMutate(); ((AbstractEAIndividual)this.m_BitSet).defaultMutate();
@ -118,6 +125,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
* @param partners The possible partners * @param partners The possible partners
* @return offsprings * @return offsprings
*/ */
@Override
public AbstractEAIndividual[] mateWith(Population partners) { public AbstractEAIndividual[] mateWith(Population partners) {
AbstractEAIndividual[] result; AbstractEAIndividual[] result;
if (RNG.flipCoin(this.m_CrossoverProbability)) { if (RNG.flipCoin(this.m_CrossoverProbability)) {
@ -172,6 +180,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
* noteably the Genotype. * noteably the Genotype.
* @return A descriptive string * @return A descriptive string
*/ */
@Override
public String getStringRepresentation() { public String getStringRepresentation() {
String result = "This is a hybrid Individual:\n"; String result = "This is a hybrid Individual:\n";
result += "The Numbers Part:\n"+((AbstractEAIndividual)this.m_Numbers).getStringRepresentation(); result += "The Numbers Part:\n"+((AbstractEAIndividual)this.m_Numbers).getStringRepresentation();
@ -185,6 +194,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
/** This method allows you to request a certain amount of double data /** This method allows you to request a certain amount of double data
* @param length The lenght of the double[] that is to be optimized * @param length The lenght of the double[] that is to be optimized
*/ */
@Override
public void setDoubleDataLength (int length) { public void setDoubleDataLength (int length) {
this.m_Numbers.setDoubleDataLength(length); this.m_Numbers.setDoubleDataLength(length);
this.m_BitSet.setBinaryDataLength(length); this.m_BitSet.setBinaryDataLength(length);
@ -193,6 +203,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
/** This method returns the length of the double data set /** This method returns the length of the double data set
* @return The number of bits stored * @return The number of bits stored
*/ */
@Override
public int size() { public int size() {
return this.m_Numbers.size(); return this.m_Numbers.size();
} }
@ -202,6 +213,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
* for dimension d. * for dimension d.
* @param range The new range for the double data. * @param range The new range for the double data.
*/ */
@Override
public void SetDoubleRange(double[][] range) { public void SetDoubleRange(double[][] range) {
this.m_Numbers.SetDoubleRange(range); this.m_Numbers.SetDoubleRange(range);
} }
@ -209,6 +221,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
/** This method will return the range for all double attributes. /** This method will return the range for all double attributes.
* @return The range array. * @return The range array.
*/ */
@Override
public double[][] getDoubleRange() { public double[][] getDoubleRange() {
return this.m_Numbers.getDoubleRange(); return this.m_Numbers.getDoubleRange();
} }
@ -216,6 +229,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
/** This method allows you to read the double data /** This method allows you to read the double data
* @return BitSet representing the double data. * @return BitSet representing the double data.
*/ */
@Override
public double[] getDoubleData() { public double[] getDoubleData() {
return this.m_Numbers.getDoubleData(); return this.m_Numbers.getDoubleData();
} }
@ -224,6 +238,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
* an update from the genotype * an update from the genotype
* @return double[] representing the double data. * @return double[] representing the double data.
*/ */
@Override
public double[] getDoubleDataWithoutUpdate() { public double[] getDoubleDataWithoutUpdate() {
return this.m_Numbers.getDoubleDataWithoutUpdate(); return this.m_Numbers.getDoubleDataWithoutUpdate();
} }
@ -232,6 +247,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
* @param doubleData The new double data. * @param doubleData The new double data.
* @see InterfaceDataTypeDouble.SetDoubleData() * @see InterfaceDataTypeDouble.SetDoubleData()
*/ */
@Override
public void SetDoublePhenotype(double[] doubleData) { public void SetDoublePhenotype(double[] doubleData) {
this.m_Numbers.SetDoublePhenotype(doubleData); this.m_Numbers.SetDoublePhenotype(doubleData);
} }
@ -241,6 +257,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
* @param doubleData The new double data. * @param doubleData The new double data.
* @see InterfaceDataTypeDouble.SetDoubleDataLamarckian() * @see InterfaceDataTypeDouble.SetDoubleDataLamarckian()
*/ */
@Override
public void SetDoubleGenotype(double[] doubleData) { public void SetDoubleGenotype(double[] doubleData) {
this.m_Numbers.SetDoubleGenotype(doubleData); this.m_Numbers.SetDoubleGenotype(doubleData);
} }
@ -251,6 +268,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
/** This method allows you to request a certain amount of binary data /** This method allows you to request a certain amount of binary data
* @param length The lenght of the BitSet that is to be optimized * @param length The lenght of the BitSet that is to be optimized
*/ */
@Override
public void setBinaryDataLength (int length) { public void setBinaryDataLength (int length) {
this.m_Numbers.setDoubleDataLength(length); this.m_Numbers.setDoubleDataLength(length);
this.m_BitSet.setBinaryDataLength(length); this.m_BitSet.setBinaryDataLength(length);
@ -266,6 +284,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
/** This method allows you to read the binary data /** This method allows you to read the binary data
* @return BitSet representing the binary data. * @return BitSet representing the binary data.
*/ */
@Override
public BitSet getBinaryData() { public BitSet getBinaryData() {
return this.m_BitSet.getBinaryData(); return this.m_BitSet.getBinaryData();
} }
@ -274,6 +293,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
* an update from the genotype * an update from the genotype
* @return BitSet representing the binary data. * @return BitSet representing the binary data.
*/ */
@Override
public BitSet getBinaryDataWithoutUpdate() { public BitSet getBinaryDataWithoutUpdate() {
return this.m_BitSet.getBinaryDataWithoutUpdate(); return this.m_BitSet.getBinaryDataWithoutUpdate();
} }
@ -282,6 +302,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
* @param binaryData The new binary data. * @param binaryData The new binary data.
* @see InterfaceDataTypeBinary.SetBinaryData() * @see InterfaceDataTypeBinary.SetBinaryData()
*/ */
@Override
public void SetBinaryPhenotype(BitSet binaryData) { public void SetBinaryPhenotype(BitSet binaryData) {
this.m_BitSet.SetBinaryPhenotype(binaryData); this.m_BitSet.SetBinaryPhenotype(binaryData);
} }
@ -291,6 +312,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
* @param binaryData The new binary data. * @param binaryData The new binary data.
* @see InterfaceBinaryData.SetBinaryDataLamarckian() * @see InterfaceBinaryData.SetBinaryDataLamarckian()
*/ */
@Override
public void SetBinaryGenotype(BitSet binaryData) { public void SetBinaryGenotype(BitSet binaryData) {
this.m_BitSet.SetBinaryGenotype(binaryData); this.m_BitSet.SetBinaryGenotype(binaryData);
} }
@ -302,6 +324,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
* name to the current object. * name to the current object.
* @return The name. * @return The name.
*/ */
@Override
public String getName() { public String getName() {
return "GA/ES individual"; return "GA/ES individual";
} }

View File

@ -61,6 +61,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
cloneAEAObjects((AbstractEAIndividual) individual); cloneAEAObjects((AbstractEAIndividual) individual);
} }
@Override
public Object clone() { public Object clone() {
return (Object) new GAIndividualBinaryData(this); return (Object) new GAIndividualBinaryData(this);
} }
@ -69,6 +70,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
* @param individual The individual to compare to. * @param individual The individual to compare to.
* @return boolean if equal true else false. * @return boolean if equal true else false.
*/ */
@Override
public boolean equalGenotypes(AbstractEAIndividual individual) { public boolean equalGenotypes(AbstractEAIndividual individual) {
if (individual instanceof GAIndividualBinaryData) { if (individual instanceof GAIndividualBinaryData) {
GAIndividualBinaryData indy = (GAIndividualBinaryData) individual; GAIndividualBinaryData indy = (GAIndividualBinaryData) individual;
@ -101,6 +103,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
* @param obj The initial value for the phenotype * @param obj The initial value for the phenotype
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@Override
public void initByValue(Object obj, InterfaceOptimizationProblem opt) { public void initByValue(Object obj, InterfaceOptimizationProblem opt) {
if (obj instanceof BitSet) { if (obj instanceof BitSet) {
BitSet bs = (BitSet) obj; BitSet bs = (BitSet) obj;
@ -118,6 +121,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
* double[] is used instead of a single double. * double[] is used instead of a single double.
* @return The complete fitness array * @return The complete fitness array
*/ */
@Override
public double[] getFitness() { public double[] getFitness() {
return this.m_Fitness; return this.m_Fitness;
} }
@ -126,6 +130,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
* noteably the Genotype. * noteably the Genotype.
* @return A descriptive string * @return A descriptive string
*/ */
@Override
public String getStringRepresentation() { public String getStringRepresentation() {
String result = ""; String result = "";
result += "GAIndividual: ("; result += "GAIndividual: (";
@ -151,6 +156,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
/** This method allows you to read the binary data /** This method allows you to read the binary data
* @return BitSet representing the binary data. * @return BitSet representing the binary data.
*/ */
@Override
public BitSet getBGenotype() { public BitSet getBGenotype() {
return this.m_Genotype; return this.m_Genotype;
} }
@ -159,6 +165,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
* memetic algorithms. * memetic algorithms.
* @param binaryData The new binary data. * @param binaryData The new binary data.
*/ */
@Override
public void SetBGenotype(BitSet binaryData) { public void SetBGenotype(BitSet binaryData) {
this.m_Genotype = binaryData; this.m_Genotype = binaryData;
} }
@ -168,10 +175,12 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
* of the last significant bit. * of the last significant bit.
* @return The length of the genotype. * @return The length of the genotype.
*/ */
@Override
public int getGenotypeLength() { public int getGenotypeLength() {
return this.m_GenotypeLength; return this.m_GenotypeLength;
} }
@Override
public void defaultInit(InterfaceOptimizationProblem prob) { public void defaultInit(InterfaceOptimizationProblem prob) {
for (int i = 0; i < this.m_GenotypeLength; i++) { for (int i = 0; i < this.m_GenotypeLength; i++) {
if (RNG.flipCoin(0.5)) this.m_Genotype.set(i); if (RNG.flipCoin(0.5)) this.m_Genotype.set(i);
@ -181,6 +190,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
/** This method performs a simple one point mutation in the genotype /** This method performs a simple one point mutation in the genotype
*/ */
@Override
public void defaultMutate() { public void defaultMutate() {
int mutationIndex = RNG.randomInt(0, this.m_GenotypeLength); int mutationIndex = RNG.randomInt(0, this.m_GenotypeLength);
//if (mutationIndex > 28) System.out.println("Mutate: " + this.getSolutionRepresentationFor()); //if (mutationIndex > 28) System.out.println("Mutate: " + this.getSolutionRepresentationFor());
@ -195,6 +205,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
/** This method allows you to request a certain amount of binary data /** This method allows you to request a certain amount of binary data
* @param length The lenght of the BitSet that is to be optimized * @param length The lenght of the BitSet that is to be optimized
*/ */
@Override
public void setBinaryDataLength(int length) { public void setBinaryDataLength(int length) {
this.m_GenotypeLength = length; this.m_GenotypeLength = length;
} }
@ -202,6 +213,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
/** This method returns the length of the binary data set /** This method returns the length of the binary data set
* @return The number of bits stored * @return The number of bits stored
*/ */
@Override
public int size() { public int size() {
return this.m_GenotypeLength; return this.m_GenotypeLength;
} }
@ -209,6 +221,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
/** This method allows you to read the binary data /** This method allows you to read the binary data
* @return BitSet representing the binary data. * @return BitSet representing the binary data.
*/ */
@Override
public BitSet getBinaryData() { public BitSet getBinaryData() {
this.m_Phenotype = (BitSet)this.m_Genotype.clone(); this.m_Phenotype = (BitSet)this.m_Genotype.clone();
return this.m_Phenotype; return this.m_Phenotype;
@ -218,6 +231,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
* an update from the genotype * an update from the genotype
* @return BitSet representing the binary data. * @return BitSet representing the binary data.
*/ */
@Override
public BitSet getBinaryDataWithoutUpdate() { public BitSet getBinaryDataWithoutUpdate() {
return this.m_Phenotype; return this.m_Phenotype;
} }
@ -225,6 +239,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
/** This method allows you to set the binary data. /** This method allows you to set the binary data.
* @param binaryData The new binary data. * @param binaryData The new binary data.
*/ */
@Override
public void SetBinaryPhenotype(BitSet binaryData) { public void SetBinaryPhenotype(BitSet binaryData) {
this.m_Phenotype = binaryData; this.m_Phenotype = binaryData;
} }
@ -233,6 +248,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
* memetic algorithms. * memetic algorithms.
* @param binaryData The new binary data. * @param binaryData The new binary data.
*/ */
@Override
public void SetBinaryGenotype(BitSet binaryData) { public void SetBinaryGenotype(BitSet binaryData) {
this.SetBinaryPhenotype(binaryData); this.SetBinaryPhenotype(binaryData);
this.m_Genotype =(BitSet)binaryData.clone(); this.m_Genotype =(BitSet)binaryData.clone();
@ -245,6 +261,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
* name to the current object. * name to the current object.
* @return The name. * @return The name.
*/ */
@Override
public String getName() { public String getName() {
return "GA binary individual"; return "GA binary individual";
} }

View File

@ -73,6 +73,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
cloneAEAObjects((AbstractEAIndividual) individual); cloneAEAObjects((AbstractEAIndividual) individual);
} }
@Override
public Object clone() { public Object clone() {
return (Object) new GAIndividualDoubleData(this); return (Object) new GAIndividualDoubleData(this);
} }
@ -81,6 +82,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
* @param individual The individual to compare to. * @param individual The individual to compare to.
* @return boolean if equal true else false. * @return boolean if equal true else false.
*/ */
@Override
public boolean equalGenotypes(AbstractEAIndividual individual) { public boolean equalGenotypes(AbstractEAIndividual individual) {
if (individual instanceof GAIndividualDoubleData) { if (individual instanceof GAIndividualDoubleData) {
GAIndividualDoubleData indy = (GAIndividualDoubleData) individual; GAIndividualDoubleData indy = (GAIndividualDoubleData) individual;
@ -104,6 +106,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
/** This method allows you to request a certain amount of double data /** This method allows you to request a certain amount of double data
* @param length The lenght of the double[] that is to be optimized * @param length The lenght of the double[] that is to be optimized
*/ */
@Override
public void setDoubleDataLength (int length) { public void setDoubleDataLength (int length) {
double[] newDesPa = new double[length]; double[] newDesPa = new double[length];
double[][] newRange = new double[length][2]; double[][] newRange = new double[length][2];
@ -134,6 +137,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
/** This method returns the length of the double data set /** This method returns the length of the double data set
* @return The number of bits stored * @return The number of bits stored
*/ */
@Override
public int size() { public int size() {
return this.m_Range.length; return this.m_Range.length;
} }
@ -143,6 +147,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
* ranges. * ranges.
* @param range The new range for the double data. * @param range The new range for the double data.
*/ */
@Override
public void SetDoubleRange(double[][] range) { public void SetDoubleRange(double[][] range) {
if (range.length != this.m_Range.length) { if (range.length != this.m_Range.length) {
System.out.println("Warning: Trying to set a range of length " + range.length + " to a vector of length " System.out.println("Warning: Trying to set a range of length " + range.length + " to a vector of length "
@ -157,6 +162,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
/** This method will return the range for all double attributes. /** This method will return the range for all double attributes.
* @return The range array. * @return The range array.
*/ */
@Override
public double[][] getDoubleRange() { public double[][] getDoubleRange() {
return this.m_Range; return this.m_Range;
} }
@ -164,6 +170,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
/** This method allows you to read the double data /** This method allows you to read the double data
* @return BitSet representing the double data. * @return BitSet representing the double data.
*/ */
@Override
public double[] getDoubleData() { public double[] getDoubleData() {
int[] locus = new int[2]; int[] locus = new int[2];
this.m_Phenotype = new double[this.m_Range.length]; this.m_Phenotype = new double[this.m_Range.length];
@ -179,6 +186,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
* an update from the genotype * an update from the genotype
* @return double[] representing the double data. * @return double[] representing the double data.
*/ */
@Override
public double[] getDoubleDataWithoutUpdate() { public double[] getDoubleDataWithoutUpdate() {
return this.m_Phenotype; return this.m_Phenotype;
} }
@ -187,6 +195,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
* use SetDoubleDataLamarckian. * use SetDoubleDataLamarckian.
* @param doubleData The new double data. * @param doubleData The new double data.
*/ */
@Override
public void SetDoublePhenotype(double[] doubleData) { public void SetDoublePhenotype(double[] doubleData) {
this.m_Phenotype = doubleData; this.m_Phenotype = doubleData;
} }
@ -195,6 +204,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
* memetic algorithms. * memetic algorithms.
* @param doubleData The new double data. * @param doubleData The new double data.
*/ */
@Override
public void SetDoubleGenotype(double[] doubleData) { public void SetDoubleGenotype(double[] doubleData) {
this.SetDoublePhenotype(doubleData); this.SetDoublePhenotype(doubleData);
int[] locus = new int[2]; int[] locus = new int[2];
@ -214,6 +224,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
* @param obj The initial value for the phenotype * @param obj The initial value for the phenotype
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@Override
public void initByValue(Object obj, InterfaceOptimizationProblem opt) { public void initByValue(Object obj, InterfaceOptimizationProblem opt) {
if (obj instanceof double[]) { if (obj instanceof double[]) {
double[] bs = (double[]) obj; double[] bs = (double[]) obj;
@ -231,6 +242,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
* noteably the Genotype. * noteably the Genotype.
* @return A descriptive string * @return A descriptive string
*/ */
@Override
public String getStringRepresentation() { public String getStringRepresentation() {
String result = ""; String result = "";
result += "GAIndividual coding double: ("; result += "GAIndividual coding double: (";
@ -261,6 +273,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
/** This method allows you to read the binary data /** This method allows you to read the binary data
* @return BitSet representing the binary data. * @return BitSet representing the binary data.
*/ */
@Override
public BitSet getBGenotype() { public BitSet getBGenotype() {
return this.m_Genotype; return this.m_Genotype;
} }
@ -269,6 +282,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
* memetic algorithms. * memetic algorithms.
* @param binaryData The new binary data. * @param binaryData The new binary data.
*/ */
@Override
public void SetBGenotype(BitSet binaryData) { public void SetBGenotype(BitSet binaryData) {
this.m_Genotype = binaryData; this.m_Genotype = binaryData;
} }
@ -278,10 +292,12 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
* of the last significat bit. * of the last significat bit.
* @return The length of the genotype. * @return The length of the genotype.
*/ */
@Override
public int getGenotypeLength() { public int getGenotypeLength() {
return this.m_GenotypeLength; return this.m_GenotypeLength;
} }
@Override
public void defaultInit(InterfaceOptimizationProblem prob) { public void defaultInit(InterfaceOptimizationProblem prob) {
for (int i = 0; i < this.m_GenotypeLength; i++) { for (int i = 0; i < this.m_GenotypeLength; i++) {
if (RNG.flipCoin(0.5)) this.m_Genotype.set(i); if (RNG.flipCoin(0.5)) this.m_Genotype.set(i);
@ -291,6 +307,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
/** This method performs a simple one point mutation in the genotype /** This method performs a simple one point mutation in the genotype
*/ */
@Override
public void defaultMutate() { public void defaultMutate() {
int mutationIndex = RNG.randomInt(0, this.m_GenotypeLength); int mutationIndex = RNG.randomInt(0, this.m_GenotypeLength);
if (this.m_Genotype.get(mutationIndex)) this.m_Genotype.clear(mutationIndex); if (this.m_Genotype.get(mutationIndex)) this.m_Genotype.clear(mutationIndex);
@ -303,6 +320,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
* name to the current object. * name to the current object.
* @return The name. * @return The name.
*/ */
@Override
public String getName() { public String getName() {
return "GA individual"; return "GA individual";
} }

View File

@ -72,6 +72,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
cloneAEAObjects((AbstractEAIndividual) individual); cloneAEAObjects((AbstractEAIndividual) individual);
} }
@Override
public Object clone() { public Object clone() {
return (Object) new GAIndividualIntegerData(this); return (Object) new GAIndividualIntegerData(this);
} }
@ -81,6 +82,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
* @param individual The individual to compare to. * @param individual The individual to compare to.
* @return boolean if equal true else false. * @return boolean if equal true else false.
*/ */
@Override
public boolean equalGenotypes(AbstractEAIndividual individual) { public boolean equalGenotypes(AbstractEAIndividual individual) {
if (individual instanceof GAIndividualIntegerData) { if (individual instanceof GAIndividualIntegerData) {
GAIndividualIntegerData indy = (GAIndividualIntegerData) individual; GAIndividualIntegerData indy = (GAIndividualIntegerData) individual;
@ -104,6 +106,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
/** This method allows you to request a certain amount of double data /** This method allows you to request a certain amount of double data
* @param length The lenght of the double[] that is to be optimized * @param length The lenght of the double[] that is to be optimized
*/ */
@Override
public void setIntegerDataLength (int length) { public void setIntegerDataLength (int length) {
int[] newDesPa = new int[length]; int[] newDesPa = new int[length];
int[][] newRange = new int[length][2]; int[][] newRange = new int[length][2];
@ -129,6 +132,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
/** This method returns the length of the double data set /** This method returns the length of the double data set
* @return The number of bits stored * @return The number of bits stored
*/ */
@Override
public int size() { public int size() {
return this.m_Range.length; return this.m_Range.length;
} }
@ -138,6 +142,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
* ranges. * ranges.
* @param range The new range for the double data. * @param range The new range for the double data.
*/ */
@Override
public void SetIntRange(int[][] range) { public void SetIntRange(int[][] range) {
if (range.length != this.m_Range.length) { if (range.length != this.m_Range.length) {
System.out.println("Warning: Trying to set a range of length " + range.length + " to a vector of length " System.out.println("Warning: Trying to set a range of length " + range.length + " to a vector of length "
@ -179,6 +184,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
/** This method will return the range for all double attributes. /** This method will return the range for all double attributes.
* @return The range array. * @return The range array.
*/ */
@Override
public int[][] getIntRange() { public int[][] getIntRange() {
return this.m_Range; return this.m_Range;
} }
@ -186,6 +192,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
/** This method allows you to read the double data /** This method allows you to read the double data
* @return BitSet representing the double data. * @return BitSet representing the double data.
*/ */
@Override
public int[] getIntegerData() { public int[] getIntegerData() {
int[] locus = new int[2]; int[] locus = new int[2];
locus[0] = 0; locus[0] = 0;
@ -203,6 +210,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
* an update from the genotype * an update from the genotype
* @return int[] representing the int data. * @return int[] representing the int data.
*/ */
@Override
public int[] getIntegerDataWithoutUpdate() { public int[] getIntegerDataWithoutUpdate() {
return this.m_Phenotype; return this.m_Phenotype;
} }
@ -210,6 +218,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
/** This method allows you to set the double data. /** This method allows you to set the double data.
* @param doubleData The new double data. * @param doubleData The new double data.
*/ */
@Override
public void SetIntPhenotype(int[] doubleData) { public void SetIntPhenotype(int[] doubleData) {
this.m_Phenotype = doubleData; this.m_Phenotype = doubleData;
} }
@ -218,6 +227,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
* memetic algorithms. * memetic algorithms.
* @param doubleData The new double data. * @param doubleData The new double data.
*/ */
@Override
public void SetIntGenotype(int[] doubleData) { public void SetIntGenotype(int[] doubleData) {
this.SetIntPhenotype(doubleData); this.SetIntPhenotype(doubleData);
if (doubleData != null) { if (doubleData != null) {
@ -240,6 +250,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
* @param obj The initial value for the phenotype * @param obj The initial value for the phenotype
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@Override
public void initByValue(Object obj, InterfaceOptimizationProblem opt) { public void initByValue(Object obj, InterfaceOptimizationProblem opt) {
if (obj instanceof int[]) { if (obj instanceof int[]) {
int[] bs = (int[]) obj; int[] bs = (int[]) obj;
@ -257,6 +268,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
* noteably the Genotype. * noteably the Genotype.
* @return A descriptive string * @return A descriptive string
*/ */
@Override
public String getStringRepresentation() { public String getStringRepresentation() {
String result = ""; String result = "";
result += "GAIndividual coding int: ("; result += "GAIndividual coding int: (";
@ -299,6 +311,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
/** This method allows you to read the binary data /** This method allows you to read the binary data
* @return BitSet representing the binary data. * @return BitSet representing the binary data.
*/ */
@Override
public BitSet getBGenotype() { public BitSet getBGenotype() {
return this.m_Genotype; return this.m_Genotype;
} }
@ -307,6 +320,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
* memetic algorithms. * memetic algorithms.
* @param binaryData The new binary data. * @param binaryData The new binary data.
*/ */
@Override
public void SetBGenotype(BitSet binaryData) { public void SetBGenotype(BitSet binaryData) {
this.m_Genotype = binaryData; this.m_Genotype = binaryData;
} }
@ -316,12 +330,14 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
* of the last significat bit. * of the last significat bit.
* @return The length of the genotype. * @return The length of the genotype.
*/ */
@Override
public int getGenotypeLength() { public int getGenotypeLength() {
int overallLength = 0; int overallLength = 0;
for (int i = 0; i < this.m_CodingLenghts.length; i++) overallLength += this.m_CodingLenghts[i]; for (int i = 0; i < this.m_CodingLenghts.length; i++) overallLength += this.m_CodingLenghts[i];
return overallLength; return overallLength;
} }
@Override
public void defaultInit(InterfaceOptimizationProblem prob) { public void defaultInit(InterfaceOptimizationProblem prob) {
int overallLength = 0; int overallLength = 0;
for (int i = 0; i < this.m_CodingLenghts.length; i++) overallLength += this.m_CodingLenghts[i]; for (int i = 0; i < this.m_CodingLenghts.length; i++) overallLength += this.m_CodingLenghts[i];
@ -333,6 +349,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
/** This method performs a simple one point mutation in the genotype /** This method performs a simple one point mutation in the genotype
*/ */
@Override
public void defaultMutate() { public void defaultMutate() {
int overallLength = 0; int overallLength = 0;
for (int i = 0; i < this.m_CodingLenghts.length; i++) overallLength += this.m_CodingLenghts[i]; for (int i = 0; i < this.m_CodingLenghts.length; i++) overallLength += this.m_CodingLenghts[i];
@ -383,6 +400,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
* name to the current object. * name to the current object.
* @return The name. * @return The name.
*/ */
@Override
public String getName() { public String getName() {
return "GA individual"; return "GA individual";
} }

View File

@ -47,6 +47,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
cloneAEAObjects((AbstractEAIndividual) individual); cloneAEAObjects((AbstractEAIndividual) individual);
} }
@Override
public Object clone() { public Object clone() {
return (Object) new GAPIndividualProgramData(this); return (Object) new GAPIndividualProgramData(this);
} }
@ -55,6 +56,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
* @param individual The individual to compare to. * @param individual The individual to compare to.
* @return boolean if equal true else false. * @return boolean if equal true else false.
*/ */
@Override
public boolean equalGenotypes(AbstractEAIndividual individual) { public boolean equalGenotypes(AbstractEAIndividual individual) {
if (individual instanceof GAPIndividualProgramData) { if (individual instanceof GAPIndividualProgramData) {
GAPIndividualProgramData indy = (GAPIndividualProgramData)individual; GAPIndividualProgramData indy = (GAPIndividualProgramData)individual;
@ -69,11 +71,13 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
/** This method will allow a default initialisation of the individual /** This method will allow a default initialisation of the individual
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@Override
public void init(InterfaceOptimizationProblem opt) { public void init(InterfaceOptimizationProblem opt) {
((AbstractEAIndividual)this.m_Numbers).init(opt); ((AbstractEAIndividual)this.m_Numbers).init(opt);
((AbstractEAIndividual)this.m_Program).init(opt); ((AbstractEAIndividual)this.m_Program).init(opt);
} }
@Override
public void defaultInit(InterfaceOptimizationProblem prob) { public void defaultInit(InterfaceOptimizationProblem prob) {
((AbstractEAIndividual)this.m_Numbers).defaultInit(prob); ((AbstractEAIndividual)this.m_Numbers).defaultInit(prob);
((AbstractEAIndividual)this.m_Program).defaultInit(prob); ((AbstractEAIndividual)this.m_Program).defaultInit(prob);
@ -84,6 +88,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
* @param obj The initial value for the phenotype * @param obj The initial value for the phenotype
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@Override
public void initByValue(Object obj, InterfaceOptimizationProblem opt) { public void initByValue(Object obj, InterfaceOptimizationProblem opt) {
if (obj instanceof Object[]) { if (obj instanceof Object[]) {
if (((Object[])obj)[0] instanceof double[]) { if (((Object[])obj)[0] instanceof double[]) {
@ -102,11 +107,13 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
/** This method will mutate the individual randomly /** This method will mutate the individual randomly
*/ */
@Override
public void mutate() { public void mutate() {
if (RNG.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_Numbers).mutate(); if (RNG.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_Numbers).mutate();
if (RNG.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_Program).mutate(); if (RNG.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_Program).mutate();
} }
@Override
public void defaultMutate() { public void defaultMutate() {
((AbstractEAIndividual)this.m_Numbers).defaultMutate(); ((AbstractEAIndividual)this.m_Numbers).defaultMutate();
((AbstractEAIndividual)this.m_Program).defaultMutate(); ((AbstractEAIndividual)this.m_Program).defaultMutate();
@ -117,6 +124,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
* @param partners The possible partners * @param partners The possible partners
* @return offsprings * @return offsprings
*/ */
@Override
public AbstractEAIndividual[] mateWith(Population partners) { public AbstractEAIndividual[] mateWith(Population partners) {
AbstractEAIndividual[] result; AbstractEAIndividual[] result;
if (RNG.flipCoin(this.m_CrossoverProbability)) { if (RNG.flipCoin(this.m_CrossoverProbability)) {
@ -156,6 +164,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
* noteably the Genotype. * noteably the Genotype.
* @return A descriptive string * @return A descriptive string
*/ */
@Override
public String getStringRepresentation() { public String getStringRepresentation() {
String result = "This is a hybrid Individual:\n"; String result = "This is a hybrid Individual:\n";
result += "The Numbers Part:\n"+((AbstractEAIndividual)this.m_Numbers).getStringRepresentation(); result += "The Numbers Part:\n"+((AbstractEAIndividual)this.m_Numbers).getStringRepresentation();
@ -169,6 +178,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
/** This method allows you to request a certain amount of double data /** This method allows you to request a certain amount of double data
* @param length The lenght of the double[] that is to be optimized * @param length The lenght of the double[] that is to be optimized
*/ */
@Override
public void setDoubleDataLength (int length) { public void setDoubleDataLength (int length) {
this.m_Numbers.setDoubleDataLength(length); this.m_Numbers.setDoubleDataLength(length);
} }
@ -176,6 +186,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
/** This method returns the length of the double data set /** This method returns the length of the double data set
* @return The number of bits stored * @return The number of bits stored
*/ */
@Override
public int size() { public int size() {
return this.m_Numbers.size(); return this.m_Numbers.size();
} }
@ -185,6 +196,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
* for dimension d. * for dimension d.
* @param range The new range for the double data. * @param range The new range for the double data.
*/ */
@Override
public void SetDoubleRange(double[][] range) { public void SetDoubleRange(double[][] range) {
this.m_Numbers.SetDoubleRange(range); this.m_Numbers.SetDoubleRange(range);
} }
@ -192,6 +204,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
/** This method will return the range for all double attributes. /** This method will return the range for all double attributes.
* @return The range array. * @return The range array.
*/ */
@Override
public double[][] getDoubleRange() { public double[][] getDoubleRange() {
return this.m_Numbers.getDoubleRange(); return this.m_Numbers.getDoubleRange();
} }
@ -199,6 +212,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
/** This method allows you to read the double data /** This method allows you to read the double data
* @return BitSet representing the double data. * @return BitSet representing the double data.
*/ */
@Override
public double[] getDoubleData() { public double[] getDoubleData() {
return this.m_Numbers.getDoubleData(); return this.m_Numbers.getDoubleData();
} }
@ -207,6 +221,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
* an update from the genotype * an update from the genotype
* @return double[] representing the double data. * @return double[] representing the double data.
*/ */
@Override
public double[] getDoubleDataWithoutUpdate() { public double[] getDoubleDataWithoutUpdate() {
return this.m_Numbers.getDoubleDataWithoutUpdate(); return this.m_Numbers.getDoubleDataWithoutUpdate();
} }
@ -215,6 +230,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
* SetDoubleDataLamarckian(). * SetDoubleDataLamarckian().
* @param doubleData The new double data. * @param doubleData The new double data.
*/ */
@Override
public void SetDoublePhenotype(double[] doubleData) { public void SetDoublePhenotype(double[] doubleData) {
this.m_Numbers.SetDoublePhenotype(doubleData); this.m_Numbers.SetDoublePhenotype(doubleData);
} }
@ -223,6 +239,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
* memetic algorithms. * memetic algorithms.
* @param doubleData The new double data. * @param doubleData The new double data.
*/ */
@Override
public void SetDoubleGenotype(double[] doubleData) { public void SetDoubleGenotype(double[] doubleData) {
this.m_Numbers.SetDoubleGenotype(doubleData); this.m_Numbers.SetDoubleGenotype(doubleData);
} }
@ -233,6 +250,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
/** This method allows you to request a certain amount of double data /** This method allows you to request a certain amount of double data
* @param length The lenght of the double[] that is to be optimized * @param length The lenght of the double[] that is to be optimized
*/ */
@Override
public void setProgramDataLength (int length) { public void setProgramDataLength (int length) {
this.m_Program.setProgramDataLength(length); this.m_Program.setProgramDataLength(length);
} }
@ -240,6 +258,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
/** This method allows you to read the program stored as Koza style node tree /** This method allows you to read the program stored as Koza style node tree
* @return AbstractGPNode representing the binary data. * @return AbstractGPNode representing the binary data.
*/ */
@Override
public InterfaceProgram[] getProgramData() { public InterfaceProgram[] getProgramData() {
return this.m_Program.getProgramData(); return this.m_Program.getProgramData();
} }
@ -248,6 +267,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
* an update from the genotype * an update from the genotype
* @return InterfaceProgram[] representing the Program. * @return InterfaceProgram[] representing the Program.
*/ */
@Override
public InterfaceProgram[] getProgramDataWithoutUpdate() { public InterfaceProgram[] getProgramDataWithoutUpdate() {
return this.m_Program.getProgramDataWithoutUpdate(); return this.m_Program.getProgramDataWithoutUpdate();
} }
@ -255,6 +275,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
/** This method allows you to set the program. /** This method allows you to set the program.
* @param program The new program. * @param program The new program.
*/ */
@Override
public void SetProgramPhenotype(InterfaceProgram[] program) { public void SetProgramPhenotype(InterfaceProgram[] program) {
this.m_Program.SetProgramPhenotype(program); this.m_Program.SetProgramPhenotype(program);
} }
@ -262,6 +283,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
/** This method allows you to set the program. /** This method allows you to set the program.
* @param program The new program. * @param program The new program.
*/ */
@Override
public void SetProgramGenotype(InterfaceProgram[] program) { public void SetProgramGenotype(InterfaceProgram[] program) {
this.m_Program.SetProgramGenotype(program); this.m_Program.SetProgramGenotype(program);
} }
@ -269,6 +291,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
/** This method allows you to set the function area /** This method allows you to set the function area
* @param area The area contains functions and terminals * @param area The area contains functions and terminals
*/ */
@Override
public void SetFunctionArea(Object[] area) { public void SetFunctionArea(Object[] area) {
this.m_Program.SetFunctionArea(area); this.m_Program.SetFunctionArea(area);
} }
@ -276,6 +299,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
/** This method allows you to set the function area /** This method allows you to set the function area
* @return The function area * @return The function area
*/ */
@Override
public Object[] getFunctionArea() { public Object[] getFunctionArea() {
return this.m_Program.getFunctionArea(); return this.m_Program.getFunctionArea();
} }
@ -287,6 +311,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
* name to the current object. * name to the current object.
* @return The name. * @return The name.
*/ */
@Override
public String getName() { public String getName() {
return "GAP individual"; return "GAP individual";
} }

View File

@ -108,6 +108,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
cloneAEAObjects((AbstractEAIndividual) individual); cloneAEAObjects((AbstractEAIndividual) individual);
} }
@Override
public Object clone() { public Object clone() {
return (Object) new GEIndividualProgramData(this); return (Object) new GEIndividualProgramData(this);
} }
@ -116,6 +117,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
* @param individual The individual to compare to. * @param individual The individual to compare to.
* @return boolean if equal true else false. * @return boolean if equal true else false.
*/ */
@Override
public boolean equalGenotypes(AbstractEAIndividual individual) { public boolean equalGenotypes(AbstractEAIndividual individual) {
if (individual instanceof GEIndividualProgramData) { if (individual instanceof GEIndividualProgramData) {
GEIndividualProgramData indy = (GEIndividualProgramData) individual; GEIndividualProgramData indy = (GEIndividualProgramData) individual;
@ -302,6 +304,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
/** This method allows you to request a certain amount of double data /** This method allows you to request a certain amount of double data
* @param length The lenght of the double[] that is to be optimized * @param length The lenght of the double[] that is to be optimized
*/ */
@Override
public void setProgramDataLength (int length) { public void setProgramDataLength (int length) {
GPArea[] oldArea = this.m_Area; GPArea[] oldArea = this.m_Area;
Object[][] oldRulz = this.m_Rules; Object[][] oldRulz = this.m_Rules;
@ -417,6 +420,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
/** This method allows you to read the program stored as Koza style node tree /** This method allows you to read the program stored as Koza style node tree
* @return GPNode representing the binary data. * @return GPNode representing the binary data.
*/ */
@Override
public InterfaceProgram[] getProgramData() { public InterfaceProgram[] getProgramData() {
// if (true) { // if (true) {
// String test ="GE decoding:\n"; // String test ="GE decoding:\n";
@ -453,6 +457,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
* an update from the genotype * an update from the genotype
* @return InterfaceProgram[] representing the Program. * @return InterfaceProgram[] representing the Program.
*/ */
@Override
public InterfaceProgram[] getProgramDataWithoutUpdate() { public InterfaceProgram[] getProgramDataWithoutUpdate() {
return this.m_Phenotype; return this.m_Phenotype;
} }
@ -460,6 +465,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
/** This method allows you to set the program phenotype. /** This method allows you to set the program phenotype.
* @param program The new program. * @param program The new program.
*/ */
@Override
public void SetProgramPhenotype(InterfaceProgram[] program) { public void SetProgramPhenotype(InterfaceProgram[] program) {
if (program instanceof AbstractGPNode[]) { if (program instanceof AbstractGPNode[]) {
this.m_Phenotype = new AbstractGPNode[program.length]; this.m_Phenotype = new AbstractGPNode[program.length];
@ -473,6 +479,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
* Warning - this is not implemented, it only sets the phenotype using SetProgramData. * Warning - this is not implemented, it only sets the phenotype using SetProgramData.
* @param program The new program. * @param program The new program.
*/ */
@Override
public void SetProgramGenotype(InterfaceProgram[] program) { public void SetProgramGenotype(InterfaceProgram[] program) {
this.SetProgramPhenotype(program); this.SetProgramPhenotype(program);
if (program instanceof AbstractGPNode[]) System.err.println("Warning setProgram() for GEIndividualProgramData not implemented!"); if (program instanceof AbstractGPNode[]) System.err.println("Warning setProgram() for GEIndividualProgramData not implemented!");
@ -481,6 +488,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
/** This method allows you to set the function area /** This method allows you to set the function area
* @param area The area contains functions and terminals * @param area The area contains functions and terminals
*/ */
@Override
public void SetFunctionArea(Object[] area) { public void SetFunctionArea(Object[] area) {
if (area instanceof GPArea[]) { if (area instanceof GPArea[]) {
this.m_Area = new GPArea[area.length]; this.m_Area = new GPArea[area.length];
@ -494,6 +502,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
/** This method allows you to set the function area /** This method allows you to set the function area
* @return The function area * @return The function area
*/ */
@Override
public Object[] getFunctionArea() { public Object[] getFunctionArea() {
return this.m_Area; return this.m_Area;
} }
@ -506,6 +515,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
* @param obj The initial value for the phenotype * @param obj The initial value for the phenotype
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@Override
public void initByValue(Object obj, InterfaceOptimizationProblem opt) { public void initByValue(Object obj, InterfaceOptimizationProblem opt) {
if (obj instanceof InterfaceProgram) { if (obj instanceof InterfaceProgram) {
this.SetProgramGenotype((InterfaceProgram[])obj); this.SetProgramGenotype((InterfaceProgram[])obj);
@ -521,6 +531,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
* noteably the Genotype. * noteably the Genotype.
* @return A descriptive string * @return A descriptive string
*/ */
@Override
public String getStringRepresentation() { public String getStringRepresentation() {
String result = ""; String result = "";
result += "GEIndividual coding program:\n"; result += "GEIndividual coding program:\n";
@ -544,6 +555,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
/** This method allows you to read the binary data /** This method allows you to read the binary data
* @return BitSet representing the binary data. * @return BitSet representing the binary data.
*/ */
@Override
public BitSet getBGenotype() { public BitSet getBGenotype() {
return this.m_Genotype; return this.m_Genotype;
} }
@ -552,6 +564,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
* memetic algorithms. * memetic algorithms.
* @param binaryData The new binary data. * @param binaryData The new binary data.
*/ */
@Override
public void SetBGenotype(BitSet binaryData) { public void SetBGenotype(BitSet binaryData) {
this.m_Genotype = binaryData; this.m_Genotype = binaryData;
} }
@ -561,10 +574,12 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
* of the last significat bit. * of the last significat bit.
* @return The length of the genotype. * @return The length of the genotype.
*/ */
@Override
public int getGenotypeLength() { public int getGenotypeLength() {
return this.m_GenotypeLengthPerProgram*this.m_Area.length; return this.m_GenotypeLengthPerProgram*this.m_Area.length;
} }
@Override
public void defaultInit(InterfaceOptimizationProblem prob) { public void defaultInit(InterfaceOptimizationProblem prob) {
for (int i = 0; i < this.m_GenotypeLengthPerProgram*this.m_Area.length; i++) { for (int i = 0; i < this.m_GenotypeLengthPerProgram*this.m_Area.length; i++) {
if (RNG.flipCoin(0.5)) this.m_Genotype.set(i); if (RNG.flipCoin(0.5)) this.m_Genotype.set(i);
@ -574,6 +589,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
/** This method performs a simple one point mutation in the genotype /** This method performs a simple one point mutation in the genotype
*/ */
@Override
public void defaultMutate() { public void defaultMutate() {
int mutationIndex = RNG.randomInt(0, this.m_GenotypeLengthPerProgram*this.m_Area.length); int mutationIndex = RNG.randomInt(0, this.m_GenotypeLengthPerProgram*this.m_Area.length);
//if (mutationIndex > 28) System.out.println("Mutate: " + this.getSolutionRepresentationFor()); //if (mutationIndex > 28) System.out.println("Mutate: " + this.getSolutionRepresentationFor());
@ -589,6 +605,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
* name to the current object. * name to the current object.
* @return The name. * @return The name.
*/ */
@Override
public String getName() { public String getName() {
return "GE individual"; return "GE individual";
} }

View File

@ -71,6 +71,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
cloneAEAObjects((AbstractEAIndividual) individual); cloneAEAObjects((AbstractEAIndividual) individual);
} }
@Override
public Object clone() { public Object clone() {
return (Object) new GIIndividualIntegerData(this); return (Object) new GIIndividualIntegerData(this);
} }
@ -80,6 +81,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
* @param individual The individual to compare to. * @param individual The individual to compare to.
* @return boolean if equal true else false. * @return boolean if equal true else false.
*/ */
@Override
public boolean equalGenotypes(AbstractEAIndividual individual) { public boolean equalGenotypes(AbstractEAIndividual individual) {
if (individual instanceof GIIndividualIntegerData) { if (individual instanceof GIIndividualIntegerData) {
GIIndividualIntegerData indy = (GIIndividualIntegerData) individual; GIIndividualIntegerData indy = (GIIndividualIntegerData) individual;
@ -102,6 +104,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
/** This method allows you to request a certain amount of double data /** This method allows you to request a certain amount of double data
* @param length The lenght of the double[] that is to be optimized * @param length The lenght of the double[] that is to be optimized
*/ */
@Override
public void setIntegerDataLength (int length) { public void setIntegerDataLength (int length) {
int[] newDesPa = new int[length]; int[] newDesPa = new int[length];
int[][] newRange = new int[length][2]; int[][] newRange = new int[length][2];
@ -126,6 +129,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
/** This method returns the length of the double data set /** This method returns the length of the double data set
* @return The number of bits stored * @return The number of bits stored
*/ */
@Override
public int size() { public int size() {
return this.m_Range.length; return this.m_Range.length;
} }
@ -135,6 +139,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
* ranges. * ranges.
* @param range The new range for the double data. * @param range The new range for the double data.
*/ */
@Override
public void SetIntRange(int[][] range) { public void SetIntRange(int[][] range) {
if (range.length != this.m_Range.length) { if (range.length != this.m_Range.length) {
this.setIntegerDataLength(range.length); this.setIntegerDataLength(range.length);
@ -148,6 +153,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
/** This method will return the range for all double attributes. /** This method will return the range for all double attributes.
* @return The range array. * @return The range array.
*/ */
@Override
public int[][] getIntRange() { public int[][] getIntRange() {
return this.m_Range; return this.m_Range;
} }
@ -155,6 +161,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
/** This method allows you to read the double data /** This method allows you to read the double data
* @return BitSet representing the double data. * @return BitSet representing the double data.
*/ */
@Override
public int[] getIntegerData() { public int[] getIntegerData() {
this.m_Phenotype = new int[this.m_Range.length]; this.m_Phenotype = new int[this.m_Range.length];
for (int i = 0; i < this.m_Phenotype.length; i++) { for (int i = 0; i < this.m_Phenotype.length; i++) {
@ -167,6 +174,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
* an update from the genotype * an update from the genotype
* @return int[] representing the int data. * @return int[] representing the int data.
*/ */
@Override
public int[] getIntegerDataWithoutUpdate() { public int[] getIntegerDataWithoutUpdate() {
return this.m_Phenotype; return this.m_Phenotype;
} }
@ -174,6 +182,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
/** This method allows you to set the double data. /** This method allows you to set the double data.
* @param doubleData The new double data. * @param doubleData The new double data.
*/ */
@Override
public void SetIntPhenotype(int[] doubleData) { public void SetIntPhenotype(int[] doubleData) {
this.m_Phenotype = doubleData; this.m_Phenotype = doubleData;
} }
@ -182,6 +191,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
* memetic algorithms. * memetic algorithms.
* @param doubleData The new double data. * @param doubleData The new double data.
*/ */
@Override
public void SetIntGenotype(int[] doubleData) { public void SetIntGenotype(int[] doubleData) {
this.SetIntPhenotype(doubleData); this.SetIntPhenotype(doubleData);
this.m_Genotype = new int[this.m_Range.length]; this.m_Genotype = new int[this.m_Range.length];
@ -198,6 +208,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
* @param obj The initial value for the phenotype * @param obj The initial value for the phenotype
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@Override
public void initByValue(Object obj, InterfaceOptimizationProblem opt) { public void initByValue(Object obj, InterfaceOptimizationProblem opt) {
if (obj instanceof int[]) { if (obj instanceof int[]) {
int[] bs = (int[]) obj; int[] bs = (int[]) obj;
@ -215,6 +226,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
* noteably the Genotype. * noteably the Genotype.
* @return A descriptive string * @return A descriptive string
*/ */
@Override
public String getStringRepresentation() { public String getStringRepresentation() {
String result = ""; String result = "";
result += "GIIndividual coding int: ("; result += "GIIndividual coding int: (";
@ -244,6 +256,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
/** This method will allow the user to read the GI genotype /** This method will allow the user to read the GI genotype
* @return BitSet * @return BitSet
*/ */
@Override
public int[] getIGenotype() { public int[] getIGenotype() {
return this.m_Genotype; return this.m_Genotype;
} }
@ -254,6 +267,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
* this method. * this method.
* @param b The new genotype of the Individual * @param b The new genotype of the Individual
*/ */
@Override
public void SetIGenotype(int[] b) { public void SetIGenotype(int[] b) {
this.m_Genotype = b; this.m_Genotype = b;
} }
@ -263,17 +277,20 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
* of the last significat bit. * of the last significat bit.
* @return The length of the genotype. * @return The length of the genotype.
*/ */
@Override
public int getGenotypeLength() { public int getGenotypeLength() {
return this.m_Genotype.length; return this.m_Genotype.length;
} }
/** This method performs a simple one point mutation in the genotype /** This method performs a simple one point mutation in the genotype
*/ */
@Override
public void defaultMutate() { public void defaultMutate() {
int mutationIndex = RNG.randomInt(0, this.m_Genotype.length-1); int mutationIndex = RNG.randomInt(0, this.m_Genotype.length-1);
this.m_Genotype[mutationIndex] = RNG.randomInt(this.m_Range[mutationIndex][0], this.m_Range[mutationIndex][1]); this.m_Genotype[mutationIndex] = RNG.randomInt(this.m_Range[mutationIndex][0], this.m_Range[mutationIndex][1]);
} }
@Override
public void defaultInit(InterfaceOptimizationProblem prob) { public void defaultInit(InterfaceOptimizationProblem prob) {
int[][] range = m_Range; int[][] range = m_Range;
if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange)prob).getInitRange()!=null)) { if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange)prob).getInitRange()!=null)) {
@ -304,6 +321,7 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
* name to the current object. * name to the current object.
* @return The name. * @return The name.
*/ */
@Override
public String getName() { public String getName() {
return "GI individual"; return "GI individual";
} }

View File

@ -45,6 +45,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
cloneAEAObjects((AbstractEAIndividual) individual); cloneAEAObjects((AbstractEAIndividual) individual);
} }
@Override
public Object clone() { public Object clone() {
return (Object) new GIOBGAIndividualIntegerPermutationData(this); return (Object) new GIOBGAIndividualIntegerPermutationData(this);
} }
@ -53,6 +54,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
* @param individual The individual to compare to. * @param individual The individual to compare to.
* @return boolean if equal true else false. * @return boolean if equal true else false.
*/ */
@Override
public boolean equalGenotypes(AbstractEAIndividual individual) { public boolean equalGenotypes(AbstractEAIndividual individual) {
if (individual instanceof GIOBGAIndividualIntegerPermutationData) { if (individual instanceof GIOBGAIndividualIntegerPermutationData) {
GIOBGAIndividualIntegerPermutationData indy = (GIOBGAIndividualIntegerPermutationData)individual; GIOBGAIndividualIntegerPermutationData indy = (GIOBGAIndividualIntegerPermutationData)individual;
@ -67,11 +69,13 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
/** This method will allow a default initialisation of the individual /** This method will allow a default initialisation of the individual
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@Override
public void init(InterfaceOptimizationProblem opt) { public void init(InterfaceOptimizationProblem opt) {
((AbstractEAIndividual)this.m_Integer).init(opt); ((AbstractEAIndividual)this.m_Integer).init(opt);
((AbstractEAIndividual)this.m_Permutation).init(opt); ((AbstractEAIndividual)this.m_Permutation).init(opt);
} }
@Override
public void defaultInit(InterfaceOptimizationProblem prob) { public void defaultInit(InterfaceOptimizationProblem prob) {
((AbstractEAIndividual)this.m_Integer).defaultInit(prob); ((AbstractEAIndividual)this.m_Integer).defaultInit(prob);
((AbstractEAIndividual)this.m_Permutation).defaultInit(prob); ((AbstractEAIndividual)this.m_Permutation).defaultInit(prob);
@ -82,6 +86,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
* @param obj The initial value for the phenotype * @param obj The initial value for the phenotype
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@Override
public void initByValue(Object obj, InterfaceOptimizationProblem opt) { public void initByValue(Object obj, InterfaceOptimizationProblem opt) {
if (obj instanceof Object[]) { if (obj instanceof Object[]) {
if (((Object[])obj)[0] instanceof double[]) { if (((Object[])obj)[0] instanceof double[]) {
@ -100,11 +105,13 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
/** This method will mutate the individual randomly /** This method will mutate the individual randomly
*/ */
@Override
public void mutate() { public void mutate() {
if (RNG.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_Integer).mutate(); if (RNG.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_Integer).mutate();
if (RNG.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_Permutation).mutate(); if (RNG.flipCoin(this.m_MutationProbability))((AbstractEAIndividual)this.m_Permutation).mutate();
} }
@Override
public void defaultMutate() { public void defaultMutate() {
((AbstractEAIndividual)this.m_Integer).defaultMutate(); ((AbstractEAIndividual)this.m_Integer).defaultMutate();
((AbstractEAIndividual)this.m_Permutation).defaultMutate(); ((AbstractEAIndividual)this.m_Permutation).defaultMutate();
@ -115,6 +122,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
* @param partners The possible partners * @param partners The possible partners
* @return offsprings * @return offsprings
*/ */
@Override
public AbstractEAIndividual[] mateWith(Population partners) { public AbstractEAIndividual[] mateWith(Population partners) {
AbstractEAIndividual[] result; AbstractEAIndividual[] result;
if (RNG.flipCoin(this.m_CrossoverProbability)) { if (RNG.flipCoin(this.m_CrossoverProbability)) {
@ -169,6 +177,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
* noteably the Genotype. * noteably the Genotype.
* @return A descriptive string * @return A descriptive string
*/ */
@Override
public String getStringRepresentation() { public String getStringRepresentation() {
String result = "This is a hybrid Individual:\n"; String result = "This is a hybrid Individual:\n";
result += "The Integer Part:\n"+((AbstractEAIndividual)this.m_Integer).getStringRepresentation(); result += "The Integer Part:\n"+((AbstractEAIndividual)this.m_Integer).getStringRepresentation();
@ -182,6 +191,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
/** This method allows you to request a certain amount of int data /** This method allows you to request a certain amount of int data
* @param length The lenght of the int[] that is to be optimized * @param length The lenght of the int[] that is to be optimized
*/ */
@Override
public void setIntegerDataLength (int length) { public void setIntegerDataLength (int length) {
this.m_Integer.setIntegerDataLength(length); this.m_Integer.setIntegerDataLength(length);
} }
@ -189,6 +199,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
/** This method returns the length of the int data set /** This method returns the length of the int data set
* @return The number of integers stored * @return The number of integers stored
*/ */
@Override
public int size() { public int size() {
return this.m_Integer.size(); return this.m_Integer.size();
} }
@ -198,6 +209,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
* for dimension d. * for dimension d.
* @param range The new range for the int data. * @param range The new range for the int data.
*/ */
@Override
public void SetIntRange(int[][] range) { public void SetIntRange(int[][] range) {
this.m_Integer.SetIntRange(range); this.m_Integer.SetIntRange(range);
} }
@ -205,6 +217,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
/** This method will return the range for all int attributes. /** This method will return the range for all int attributes.
* @return The range array. * @return The range array.
*/ */
@Override
public int[][] getIntRange() { public int[][] getIntRange() {
return this.m_Integer.getIntRange(); return this.m_Integer.getIntRange();
} }
@ -212,6 +225,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
/** This method allows you to read the int data /** This method allows you to read the int data
* @return int[] representing the int data. * @return int[] representing the int data.
*/ */
@Override
public int[] getIntegerData() { public int[] getIntegerData() {
return this.m_Integer.getIntegerData(); return this.m_Integer.getIntegerData();
} }
@ -220,6 +234,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
* an update from the genotype * an update from the genotype
* @return int[] representing the int data. * @return int[] representing the int data.
*/ */
@Override
public int[] getIntegerDataWithoutUpdate() { public int[] getIntegerDataWithoutUpdate() {
return this.m_Integer.getIntegerDataWithoutUpdate(); return this.m_Integer.getIntegerDataWithoutUpdate();
} }
@ -227,6 +242,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
/** This method allows you to set the int data. /** This method allows you to set the int data.
* @param intData The new int data. * @param intData The new int data.
*/ */
@Override
public void SetIntPhenotype(int[] intData) { public void SetIntPhenotype(int[] intData) {
this.m_Integer.SetIntPhenotype(intData); this.m_Integer.SetIntPhenotype(intData);
} }
@ -235,6 +251,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
* memetic algorithms. * memetic algorithms.
* @param intData The new int data. * @param intData The new int data.
*/ */
@Override
public void SetIntGenotype(int[] intData) { public void SetIntGenotype(int[] intData) {
this.m_Integer.SetIntGenotype(intData); this.m_Integer.SetIntGenotype(intData);
} }
@ -245,6 +262,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
/** setLength sets the length of the permutation. /** setLength sets the length of the permutation.
* @param length int new length * @param length int new length
*/ */
@Override
public void setPermutationDataLength(int[] length) { public void setPermutationDataLength(int[] length) {
this.m_Permutation.setPermutationDataLength(length); this.m_Permutation.setPermutationDataLength(length);
this.m_Integer.setIntegerDataLength(length.length); this.m_Integer.setIntegerDataLength(length.length);
@ -253,6 +271,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
/** size returns the size of the permutation. /** size returns the size of the permutation.
* @return int * @return int
*/ */
@Override
public int[] sizePermutation() { public int[] sizePermutation() {
return this.m_Permutation.sizePermutation(); return this.m_Permutation.sizePermutation();
} }
@ -260,6 +279,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
/** This method allows you to read the permutation data /** This method allows you to read the permutation data
* @return int[] represent the permutation. * @return int[] represent the permutation.
*/ */
@Override
public int[][] getPermutationData() { public int[][] getPermutationData() {
return this.m_Permutation.getPermutationData(); return this.m_Permutation.getPermutationData();
} }
@ -268,6 +288,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
* an update from the genotype * an update from the genotype
* @return int[] representing the permutation. * @return int[] representing the permutation.
*/ */
@Override
public int[][] getPermutationDataWithoutUpdate() { public int[][] getPermutationDataWithoutUpdate() {
return this.m_Permutation.getPermutationDataWithoutUpdate(); return this.m_Permutation.getPermutationDataWithoutUpdate();
} }
@ -275,6 +296,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
/** This method allows you to set the permutation. /** This method allows you to set the permutation.
* @param perm The new permutation data. * @param perm The new permutation data.
*/ */
@Override
public void SetPermutationPhenotype(int[][] perm) { public void SetPermutationPhenotype(int[][] perm) {
this.SetPermutationPhenotype(perm); this.SetPermutationPhenotype(perm);
} }
@ -283,10 +305,12 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
* memetic algorithms. * memetic algorithms.
* @param perm The new permutation data. * @param perm The new permutation data.
*/ */
@Override
public void SetPermutationGenotype(int[][] perm) { public void SetPermutationGenotype(int[][] perm) {
this.SetPermutationGenotype(perm); this.SetPermutationGenotype(perm);
} }
@Override
public void setFirstindex(int[] firstindex) { public void setFirstindex(int[] firstindex) {
this.m_Permutation.setFirstindex(firstindex); this.m_Permutation.setFirstindex(firstindex);
} }
@ -298,6 +322,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
* name to the current object. * name to the current object.
* @return The name. * @return The name.
*/ */
@Override
public String getName() { public String getName() {
return "GA/ES individual"; return "GA/ES individual";
} }

View File

@ -78,6 +78,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
cloneAEAObjects((AbstractEAIndividual) individual); cloneAEAObjects((AbstractEAIndividual) individual);
} }
@Override
public Object clone() { public Object clone() {
return (Object) new GPIndividualProgramData(this); return (Object) new GPIndividualProgramData(this);
} }
@ -86,6 +87,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
* @param individual The individual to compare to. * @param individual The individual to compare to.
* @return boolean if equal true else false. * @return boolean if equal true else false.
*/ */
@Override
public boolean equalGenotypes(AbstractEAIndividual individual) { public boolean equalGenotypes(AbstractEAIndividual individual) {
if (individual instanceof GPIndividualProgramData) { if (individual instanceof GPIndividualProgramData) {
GPIndividualProgramData indy = (GPIndividualProgramData) individual; GPIndividualProgramData indy = (GPIndividualProgramData) individual;
@ -112,6 +114,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
/** This method allows you to request a certain amount of double data /** This method allows you to request a certain amount of double data
* @param length The lenght of the double[] that is to be optimized * @param length The lenght of the double[] that is to be optimized
*/ */
@Override
public void setProgramDataLength (int length) { public void setProgramDataLength (int length) {
GPArea[] oldArea = this.m_Area; GPArea[] oldArea = this.m_Area;
AbstractGPNode[] oldProg = this.m_Genotype; AbstractGPNode[] oldProg = this.m_Genotype;
@ -130,6 +133,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
/** This method allows you to read the program stored as Koza style node tree /** This method allows you to read the program stored as Koza style node tree
* @return AbstractGPNode representing the binary data. * @return AbstractGPNode representing the binary data.
*/ */
@Override
public InterfaceProgram[] getProgramData() { public InterfaceProgram[] getProgramData() {
this.m_Phenotype = new AbstractGPNode[this.m_Genotype.length]; this.m_Phenotype = new AbstractGPNode[this.m_Genotype.length];
for (int i = 0; i < this.m_Genotype.length; i++) { for (int i = 0; i < this.m_Genotype.length; i++) {
@ -151,6 +155,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
* an update from the genotype * an update from the genotype
* @return InterfaceProgram[] representing the Program. * @return InterfaceProgram[] representing the Program.
*/ */
@Override
public InterfaceProgram[] getProgramDataWithoutUpdate() { public InterfaceProgram[] getProgramDataWithoutUpdate() {
if (this.m_Phenotype==null) return getProgramData(); if (this.m_Phenotype==null) return getProgramData();
else return this.m_Phenotype; else return this.m_Phenotype;
@ -159,6 +164,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
/** This method allows you to set the program phenotype. /** This method allows you to set the program phenotype.
* @param program The new program. * @param program The new program.
*/ */
@Override
public void SetProgramPhenotype(InterfaceProgram[] program) { public void SetProgramPhenotype(InterfaceProgram[] program) {
if (program instanceof AbstractGPNode[]) { if (program instanceof AbstractGPNode[]) {
this.m_Phenotype = new AbstractGPNode[program.length]; this.m_Phenotype = new AbstractGPNode[program.length];
@ -170,6 +176,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
/** This method allows you to set the program genotype. /** This method allows you to set the program genotype.
* @param program The new program. * @param program The new program.
*/ */
@Override
public void SetProgramGenotype(InterfaceProgram[] program) { public void SetProgramGenotype(InterfaceProgram[] program) {
this.SetProgramPhenotype(program); this.SetProgramPhenotype(program);
if (program instanceof AbstractGPNode[]) { if (program instanceof AbstractGPNode[]) {
@ -182,6 +189,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
/** This method allows you to set the function area /** This method allows you to set the function area
* @param area The area contains functions and terminals * @param area The area contains functions and terminals
*/ */
@Override
public void SetFunctionArea(Object[] area) { public void SetFunctionArea(Object[] area) {
if (area instanceof GPArea[]) { if (area instanceof GPArea[]) {
this.m_Area = (GPArea[]) area; this.m_Area = (GPArea[]) area;
@ -191,6 +199,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
/** This method allows you to set the function area /** This method allows you to set the function area
* @return The function area * @return The function area
*/ */
@Override
public Object[] getFunctionArea() { public Object[] getFunctionArea() {
return this.m_Area; return this.m_Area;
} }
@ -203,6 +212,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
* @param obj The initial value for the phenotype * @param obj The initial value for the phenotype
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@Override
public void initByValue(Object obj, InterfaceOptimizationProblem opt) { public void initByValue(Object obj, InterfaceOptimizationProblem opt) {
if (obj instanceof InterfaceProgram[]) { if (obj instanceof InterfaceProgram[]) {
this.SetProgramGenotype((InterfaceProgram[])obj); this.SetProgramGenotype((InterfaceProgram[])obj);
@ -218,6 +228,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
* noteably the Genotype. * noteably the Genotype.
* @return A descriptive string * @return A descriptive string
*/ */
@Override
public String getStringRepresentation() { public String getStringRepresentation() {
String result = ""; String result = "";
result += "GPIndividual coding program: ("; result += "GPIndividual coding program: (";
@ -240,6 +251,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
/** This method will allow the user to read the program genotype /** This method will allow the user to read the program genotype
* @return AbstractGPNode * @return AbstractGPNode
*/ */
@Override
public AbstractGPNode[] getPGenotype() { public AbstractGPNode[] getPGenotype() {
return this.m_Genotype; return this.m_Genotype;
} }
@ -247,6 +259,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
/** This method will allow the user to set the current program 'genotype'. /** This method will allow the user to set the current program 'genotype'.
* @param b The new programgenotype of the Individual * @param b The new programgenotype of the Individual
*/ */
@Override
public void SetPGenotype(AbstractGPNode[] b) { public void SetPGenotype(AbstractGPNode[] b) {
this.m_Genotype = b; this.m_Genotype = b;
this.m_Phenotype=null; this.m_Phenotype=null;
@ -256,6 +269,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
* @param b The new program genotype of the Individual * @param b The new program genotype of the Individual
* @param i The index where to insert the new program * @param i The index where to insert the new program
*/ */
@Override
public void SetPGenotype(AbstractGPNode b, int i) { public void SetPGenotype(AbstractGPNode b, int i) {
this.m_Genotype[i] = b; this.m_Genotype[i] = b;
m_Genotype[i].updateDepth(0); m_Genotype[i].updateDepth(0);
@ -266,6 +280,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
/** /**
* This method performs a simple one element mutation on the program * This method performs a simple one element mutation on the program
*/ */
@Override
public void defaultMutate() { public void defaultMutate() {
for (int i = 0; i < this.m_Genotype.length; i++) { for (int i = 0; i < this.m_Genotype.length; i++) {
AbstractGPNode nodeToMutate = this.m_Genotype[i].getRandomNode(); AbstractGPNode nodeToMutate = this.m_Genotype[i].getRandomNode();
@ -291,6 +306,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
m_Phenotype=null; // reset pheno m_Phenotype=null; // reset pheno
} }
@Override
public void defaultInit(InterfaceOptimizationProblem prob) { public void defaultInit(InterfaceOptimizationProblem prob) {
m_Phenotype=null; // reset pheno m_Phenotype=null; // reset pheno
for (int i = 0; i < this.m_Area.length; i++) { for (int i = 0; i < this.m_Area.length; i++) {
@ -315,6 +331,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
* name to the current object. * name to the current object.
* @return The name. * @return The name.
*/ */
@Override
public String getName() { public String getName() {
return "GP individual"; return "GP individual";
} }
@ -377,6 +394,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
public void setMaxAllowedDepth(int b) { public void setMaxAllowedDepth(int b) {
this.m_maxAllowedDepth = b; this.m_maxAllowedDepth = b;
} }
@Override
public int getMaxAllowedDepth() { public int getMaxAllowedDepth() {
return this.m_maxAllowedDepth; return this.m_maxAllowedDepth;
} }

View File

@ -29,6 +29,7 @@ public class IndividualDistanceComparator implements Comparator<Object>, Seriali
closerMeansLess = closerIsLess; closerMeansLess = closerIsLess;
} }
@Override
public int compare(Object o1, Object o2) { public int compare(Object o1, Object o2) {
double d1 = distMetric.distance((AbstractEAIndividual)o1, refIndy); double d1 = distMetric.distance((AbstractEAIndividual)o1, refIndy);
double d2 = distMetric.distance((AbstractEAIndividual)o2, refIndy); double d2 = distMetric.distance((AbstractEAIndividual)o2, refIndy);

View File

@ -68,6 +68,7 @@ public class IndividualWeightedFitnessComparator implements Comparator<Object>,
* (non-Javadoc) * (non-Javadoc)
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
*/ */
@Override
public int compare(Object o1, Object o2) { public int compare(Object o1, Object o2) {
double[] f1 = ((AbstractEAIndividual) o1).getFitness(); double[] f1 = ((AbstractEAIndividual) o1).getFitness();
double[] f2 = ((AbstractEAIndividual) o2).getFitness(); double[] f2 = ((AbstractEAIndividual) o2).getFitness();

View File

@ -69,6 +69,7 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen
* @param individual The individual to compare to. * @param individual The individual to compare to.
* @return boolean if equal true else false. * @return boolean if equal true else false.
*/ */
@Override
public boolean equalGenotypes(AbstractEAIndividual individual) { public boolean equalGenotypes(AbstractEAIndividual individual) {
if (individual instanceof OBGAIndividualPermutationData) { if (individual instanceof OBGAIndividualPermutationData) {
OBGAIndividualPermutationData indy = (OBGAIndividualPermutationData) individual; OBGAIndividualPermutationData indy = (OBGAIndividualPermutationData) individual;
@ -96,6 +97,7 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen
* @param obj The initial value for the phenotype * @param obj The initial value for the phenotype
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@Override
public void initByValue(Object obj, InterfaceOptimizationProblem opt) { public void initByValue(Object obj, InterfaceOptimizationProblem opt) {
if (obj instanceof int[]) { if (obj instanceof int[]) {
this.SetPermutationGenotype((int[][]) obj); this.SetPermutationGenotype((int[][]) obj);
@ -112,6 +114,7 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen
* double[] is used instead of a single double. * double[] is used instead of a single double.
* @return The complete fitness array * @return The complete fitness array
*/ */
@Override
public double[] getFitness() { public double[] getFitness() {
return this.m_Fitness; return this.m_Fitness;
} }
@ -120,6 +123,7 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen
* noteably the Genotype. * noteably the Genotype.
* @return A descriptive string * @return A descriptive string
*/ */
@Override
public String getStringRepresentation() { public String getStringRepresentation() {
String result = ""; String result = "";
result += "OBGAIndividual: ("; result += "OBGAIndividual: (";
@ -144,6 +148,7 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen
} }
@Override
public Object clone() { public Object clone() {
return new OBGAIndividualPermutationData(this); return new OBGAIndividualPermutationData(this);
} }
@ -152,14 +157,17 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen
* InterfaceOBGAIndividual methods * InterfaceOBGAIndividual methods
*/ */
@Override
public int[][] getOBGenotype() { public int[][] getOBGenotype() {
return this.m_Genotype; return this.m_Genotype;
} }
@Override
public void SetOBGenotype(int[][] g) { public void SetOBGenotype(int[][] g) {
this.m_Genotype = g; this.m_Genotype = g;
} }
@Override
public void defaultMutate(){ public void defaultMutate(){
int[][] permmatrix = this.getPermutationData(); int[][] permmatrix = this.getPermutationData();
for (int i = 0; i < permmatrix.length; i++) { for (int i = 0; i < permmatrix.length; i++) {
@ -174,6 +182,7 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen
this.SetPermutationGenotype(permmatrix); this.SetPermutationGenotype(permmatrix);
} }
@Override
public void defaultInit(InterfaceOptimizationProblem prob){ public void defaultInit(InterfaceOptimizationProblem prob){
//System.out.println("Default Init!"); //System.out.println("Default Init!");
int[][] perm = new int[this.m_Genotype.length][]; int[][] perm = new int[this.m_Genotype.length][];
@ -200,6 +209,7 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen
*/ */
@Override
public void setPermutationDataLength(int[] length){ public void setPermutationDataLength(int[] length){
this.m_Genotype = new int[length.length][]; this.m_Genotype = new int[length.length][];
for (int i = 0; i < length.length; i++) { for (int i = 0; i < length.length; i++) {
@ -208,6 +218,7 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen
} }
@Override
public int[] sizePermutation() { public int[] sizePermutation() {
int[] res = new int[m_Genotype.length]; int[] res = new int[m_Genotype.length];
for (int i = 0; i <m_Genotype.length; i++) { for (int i = 0; i <m_Genotype.length; i++) {
@ -216,10 +227,12 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen
return res; return res;
} }
@Override
public void SetPermutationPhenotype(int[][] perm){ public void SetPermutationPhenotype(int[][] perm){
this.m_Phenotype = perm; this.m_Phenotype = perm;
} }
@Override
public void SetPermutationGenotype(int[][] perm){ public void SetPermutationGenotype(int[][] perm){
this.SetPermutationPhenotype(perm); this.SetPermutationPhenotype(perm);
this.m_Genotype = new int[perm.length][]; this.m_Genotype = new int[perm.length][];
@ -230,6 +243,7 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen
} }
@Override
public int[][] getPermutationData() { public int[][] getPermutationData() {
this.m_Phenotype = new int[this.m_Genotype.length][]; this.m_Phenotype = new int[this.m_Genotype.length][];
for (int i = 0; i < this.m_Genotype.length; i++) { for (int i = 0; i < this.m_Genotype.length; i++) {
@ -243,6 +257,7 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen
* an update from the genotype * an update from the genotype
* @return int[] representing the permutation. * @return int[] representing the permutation.
*/ */
@Override
public int[][] getPermutationDataWithoutUpdate() { public int[][] getPermutationDataWithoutUpdate() {
return this.m_Phenotype; return this.m_Phenotype;
} }
@ -250,6 +265,7 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen
public int[] getFirstindex() { public int[] getFirstindex() {
return firstindex; return firstindex;
} }
@Override
public void setFirstindex(int[] firstindex) { public void setFirstindex(int[] firstindex) {
this.firstindex = firstindex; this.firstindex = firstindex;
} }
@ -258,6 +274,7 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen
* name to the current object. * name to the current object.
* @return The name. * @return The name.
*/ */
@Override
public String getName() { public String getName() {
return "OBGA individual"; return "OBGA individual";
} }

View File

@ -27,6 +27,7 @@ public class GAGrayCodingDouble implements InterfaceGADoubleCoding, java.io.Seri
* @param correction Enable automatic correction is enabled. * @param correction Enable automatic correction is enabled.
* @return The float value. * @return The float value.
*/ */
@Override
public double decodeValue(BitSet refBitSet, double[] range, int[] locus, boolean correction) { public double decodeValue(BitSet refBitSet, double[] range, int[] locus, boolean correction) {
BitSet tmpBitSet; BitSet tmpBitSet;
int[] tmpLocus; int[] tmpLocus;
@ -54,6 +55,7 @@ public class GAGrayCodingDouble implements InterfaceGADoubleCoding, java.io.Seri
* @param refBitSet The BitSet where the questioned value is stored. * @param refBitSet The BitSet where the questioned value is stored.
* @param locus The position and length on the BitSet that is to be coded. * @param locus The position and length on the BitSet that is to be coded.
*/ */
@Override
public void codeValue(double value, double[] range, BitSet refBitSet, int[] locus) { public void codeValue(double value, double[] range, BitSet refBitSet, int[] locus) {
BitSet tmpBitSet; BitSet tmpBitSet;
int[] tmpLocus; int[] tmpLocus;

View File

@ -22,6 +22,7 @@ public class GAGrayCodingInteger implements InterfaceGAIntegerCoding,java.io.Ser
* @param correction Enable automatic correction is enabled. * @param correction Enable automatic correction is enabled.
* @return The int value. * @return The int value.
*/ */
@Override
public int decodeValue(BitSet refBitSet, int[] range, int[] locus, boolean correction) { public int decodeValue(BitSet refBitSet, int[] range, int[] locus, boolean correction) {
BitSet tmpBitSet; BitSet tmpBitSet;
int[] tmpLocus; int[] tmpLocus;
@ -54,6 +55,7 @@ public class GAGrayCodingInteger implements InterfaceGAIntegerCoding,java.io.Ser
* @param refBitSet The BitSet where the questioned value is stored. * @param refBitSet The BitSet where the questioned value is stored.
* @param locus The position and length on the BitSet that is to be coded. * @param locus The position and length on the BitSet that is to be coded.
*/ */
@Override
public void codeValue(int value, int[] range, BitSet refBitSet, int[] locus) { public void codeValue(int value, int[] range, BitSet refBitSet, int[] locus) {
BitSet tmpBitSet; BitSet tmpBitSet;
int[] tmpLocus; int[] tmpLocus;
@ -81,6 +83,7 @@ public class GAGrayCodingInteger implements InterfaceGAIntegerCoding,java.io.Ser
/** This method will calculate how many bits are to be used to code a given value /** This method will calculate how many bits are to be used to code a given value
* @param range The range for the value. * @param range The range for the value.
*/ */
@Override
public int calculateNecessaryBits(int[] range) { public int calculateNecessaryBits(int[] range) {
return this.m_HelpingHand.calculateNecessaryBits(range); return this.m_HelpingHand.calculateNecessaryBits(range);
} }

View File

@ -71,6 +71,7 @@ public class GAStandardCodingDouble implements InterfaceGADoubleCoding, java.io.
* @param correction Enable automatic correction is enabled. * @param correction Enable automatic correction is enabled.
* @return The decoded value. * @return The decoded value.
*/ */
@Override
public double decodeValue(BitSet refBitSet, double[] range, int[] locus, boolean correction) { public double decodeValue(BitSet refBitSet, double[] range, int[] locus, boolean correction) {
long val = (refBitSet.get(locus[0]) ? 1 : 0); long val = (refBitSet.get(locus[0]) ? 1 : 0);
int m_length = locus[1]; int m_length = locus[1];
@ -96,6 +97,7 @@ public class GAStandardCodingDouble implements InterfaceGADoubleCoding, java.io.
* @param refBitSet The BitSet where the questioned value is stored. * @param refBitSet The BitSet where the questioned value is stored.
* @param locus The position and length on the BitSet that is to be coded. * @param locus The position and length on the BitSet that is to be coded.
*/ */
@Override
public void codeValue(double value, double[] range, BitSet refBitSet, int[] locus) { public void codeValue(double value, double[] range, BitSet refBitSet, int[] locus) {
double u_max, u_min, m_max, m_min; double u_max, u_min, m_max, m_min;
int m_start, m_length, counter = 0; int m_start, m_length, counter = 0;

View File

@ -24,6 +24,7 @@ public class GAStandardCodingInteger implements InterfaceGAIntegerCoding, java.i
* @param correction Enable automatic correction is enabled. * @param correction Enable automatic correction is enabled.
* @return The int value. * @return The int value.
*/ */
@Override
public int decodeValue(BitSet refBitSet, int[] range, int[] locus, boolean correction) { public int decodeValue(BitSet refBitSet, int[] range, int[] locus, boolean correction) {
int u_max, u_min, m_max, m_min; int u_max, u_min, m_max, m_min;
int m_start, m_length, counter = 0; int m_start, m_length, counter = 0;
@ -76,6 +77,7 @@ public class GAStandardCodingInteger implements InterfaceGAIntegerCoding, java.i
* @param refBitSet The BitSet where the questioned value is stored. * @param refBitSet The BitSet where the questioned value is stored.
* @param locus The position and length on the BitSet that is to be coded. * @param locus The position and length on the BitSet that is to be coded.
*/ */
@Override
public void codeValue(int value, int[] range, BitSet refBitSet, int[] locus) { public void codeValue(int value, int[] range, BitSet refBitSet, int[] locus) {
int u_max, u_min, m_max, m_min; int u_max, u_min, m_max, m_min;
int m_start, m_length, counter = 0; int m_start, m_length, counter = 0;
@ -123,6 +125,7 @@ public class GAStandardCodingInteger implements InterfaceGAIntegerCoding, java.i
/** This method will calculate how many bits are to be used to code a given value /** This method will calculate how many bits are to be used to code a given value
* @param range The range for the value. * @param range The range for the value.
*/ */
@Override
public int calculateNecessaryBits(int[] range) { public int calculateNecessaryBits(int[] range) {
int result = 0; int result = 0;
double maxStore = 1. + range[1] -range[0]; double maxStore = 1. + range[1] -range[0];

View File

@ -31,6 +31,7 @@ public abstract class AbstractGPNode implements InterfaceProgram, java.io.Serial
/** This method allows you to clone the Nodes /** This method allows you to clone the Nodes
* @return the clone * @return the clone
*/ */
@Override
public abstract Object clone(); public abstract Object clone();
/** This method will be used to identify the node in the GPAreaEditor /** This method will be used to identify the node in the GPAreaEditor
@ -41,6 +42,7 @@ public abstract class AbstractGPNode implements InterfaceProgram, java.io.Serial
/** This method will evaluate a given node /** This method will evaluate a given node
* @param environment * @param environment
*/ */
@Override
public abstract Object evaluate(InterfaceProgramProblem environment); public abstract Object evaluate(InterfaceProgramProblem environment);
/** This method will return the current arity /** This method will return the current arity
@ -51,6 +53,7 @@ public abstract class AbstractGPNode implements InterfaceProgram, java.io.Serial
/** This method returns a string representation /** This method returns a string representation
* @return string * @return string
*/ */
@Override
public String getStringRepresentation() { public String getStringRepresentation() {
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
AbstractGPNode.appendStringRepresentation(this, sb); AbstractGPNode.appendStringRepresentation(this, sb);
@ -541,6 +544,7 @@ public abstract class AbstractGPNode implements InterfaceProgram, java.io.Serial
* @param obj The other subtree. * @param obj The other subtree.
* @return boolean if equal true else false. * @return boolean if equal true else false.
*/ */
@Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj.getClass().equals(this.getClass())) { if (obj.getClass().equals(this.getClass())) {
AbstractGPNode node = (AbstractGPNode)obj; AbstractGPNode node = (AbstractGPNode)obj;

View File

@ -37,6 +37,7 @@ public class GPArea implements java.io.Serializable {
this.m_CompleteList = (ArrayList<AbstractGPNode>)g.m_CompleteList.clone(); this.m_CompleteList = (ArrayList<AbstractGPNode>)g.m_CompleteList.clone();
} }
@Override
public Object clone() { public Object clone() {
return new GPArea(this); return new GPArea(this);
} }

View File

@ -18,6 +18,7 @@ public class GPNodeAbs extends AbstractGPNode implements java.io.Serializable {
/** This method will be used to identify the node in the GPAreaEditor /** This method will be used to identify the node in the GPAreaEditor
* @return The name. * @return The name.
*/ */
@Override
public String getName() { public String getName() {
return "Abs"; return "Abs";
} }
@ -25,6 +26,7 @@ public class GPNodeAbs extends AbstractGPNode implements java.io.Serializable {
/** This method allows you to clone the Nodes /** This method allows you to clone the Nodes
* @return the clone * @return the clone
*/ */
@Override
public Object clone() { public Object clone() {
return (Object) new GPNodeAbs(this); return (Object) new GPNodeAbs(this);
} }
@ -32,6 +34,7 @@ public class GPNodeAbs extends AbstractGPNode implements java.io.Serializable {
/** This method will return the current arity /** This method will return the current arity
* @return Arity. * @return Arity.
*/ */
@Override
public int getArity() { public int getArity() {
return 1; return 1;
} }
@ -39,6 +42,7 @@ public class GPNodeAbs extends AbstractGPNode implements java.io.Serializable {
/** This method will evaluate a given node /** This method will evaluate a given node
* @param environment * @param environment
*/ */
@Override
public Object evaluate(InterfaceProgramProblem environment) { public Object evaluate(InterfaceProgramProblem environment) {
Object tmpObj; Object tmpObj;
double result = 0; double result = 0;

View File

@ -24,6 +24,7 @@ public class GPNodeAdd extends AbstractGPNode implements java.io.Serializable {
/** This method will be used to identify the node in the GPAreaEditor /** This method will be used to identify the node in the GPAreaEditor
* @return The name. * @return The name.
*/ */
@Override
public String getName() { public String getName() {
return "Add"; return "Add";
} }
@ -31,6 +32,7 @@ public class GPNodeAdd extends AbstractGPNode implements java.io.Serializable {
/** This method allows you to clone the Nodes /** This method allows you to clone the Nodes
* @return the clone * @return the clone
*/ */
@Override
public Object clone() { public Object clone() {
return (Object) new GPNodeAdd(this); return (Object) new GPNodeAdd(this);
} }
@ -38,6 +40,7 @@ public class GPNodeAdd extends AbstractGPNode implements java.io.Serializable {
/** This method will return the current arity /** This method will return the current arity
* @return Arity. * @return Arity.
*/ */
@Override
public int getArity() { public int getArity() {
return 2; return 2;
} }
@ -45,6 +48,7 @@ public class GPNodeAdd extends AbstractGPNode implements java.io.Serializable {
/** This method will evaluate a given node /** This method will evaluate a given node
* @param environment * @param environment
*/ */
@Override
public Object evaluate(InterfaceProgramProblem environment) { public Object evaluate(InterfaceProgramProblem environment) {
Object tmpObj; Object tmpObj;
double result = 0; double result = 0;

View File

@ -30,6 +30,7 @@ public class GPNodeConst extends AbstractGPNode implements java.io.Serializable
/** This method will be used to identify the node in the GPAreaEditor /** This method will be used to identify the node in the GPAreaEditor
* @return The name. * @return The name.
*/ */
@Override
public String getName() { public String getName() {
return ""+value; return ""+value;
} }
@ -37,6 +38,7 @@ public class GPNodeConst extends AbstractGPNode implements java.io.Serializable
/** This method will return the current arity /** This method will return the current arity
* @return Arity. * @return Arity.
*/ */
@Override
public int getArity() { public int getArity() {
return 0; return 0;
} }
@ -44,6 +46,7 @@ public class GPNodeConst extends AbstractGPNode implements java.io.Serializable
/** This method will evaluate a given node /** This method will evaluate a given node
* @param environment * @param environment
*/ */
@Override
public Object evaluate(InterfaceProgramProblem environment) { public Object evaluate(InterfaceProgramProblem environment) {
return new Double(value); return new Double(value);
} }

View File

@ -20,6 +20,7 @@ public class GPNodeCos extends AbstractGPNode implements java.io.Serializable {
/** This method will be used to identify the node in the GPAreaEditor /** This method will be used to identify the node in the GPAreaEditor
* @return The name. * @return The name.
*/ */
@Override
public String getName() { public String getName() {
return "Cos"; return "Cos";
} }
@ -27,6 +28,7 @@ public class GPNodeCos extends AbstractGPNode implements java.io.Serializable {
/** This method allows you to clone the Nodes /** This method allows you to clone the Nodes
* @return the clone * @return the clone
*/ */
@Override
public Object clone() { public Object clone() {
return (Object) new GPNodeCos(this); return (Object) new GPNodeCos(this);
} }
@ -34,6 +36,7 @@ public class GPNodeCos extends AbstractGPNode implements java.io.Serializable {
/** This method will return the current arity /** This method will return the current arity
* @return Arity. * @return Arity.
*/ */
@Override
public int getArity() { public int getArity() {
return 1; return 1;
} }
@ -41,6 +44,7 @@ public class GPNodeCos extends AbstractGPNode implements java.io.Serializable {
/** This method will evaluate a given node /** This method will evaluate a given node
* @param environment * @param environment
*/ */
@Override
public Object evaluate(InterfaceProgramProblem environment) { public Object evaluate(InterfaceProgramProblem environment) {
Object tmpObj; Object tmpObj;
double result = 1; double result = 1;

View File

@ -28,6 +28,7 @@ public class GPNodeDiv extends AbstractGPNode implements java.io.Serializable {
/** This method will be used to identify the node in the GPAreaEditor /** This method will be used to identify the node in the GPAreaEditor
* @return The name. * @return The name.
*/ */
@Override
public String getName() { public String getName() {
return "Div"; return "Div";
} }
@ -35,6 +36,7 @@ public class GPNodeDiv extends AbstractGPNode implements java.io.Serializable {
/** This method allows you to clone the Nodes /** This method allows you to clone the Nodes
* @return the clone * @return the clone
*/ */
@Override
public Object clone() { public Object clone() {
return (Object) new GPNodeDiv(this); return (Object) new GPNodeDiv(this);
} }
@ -42,6 +44,7 @@ public class GPNodeDiv extends AbstractGPNode implements java.io.Serializable {
/** This method will return the current arity /** This method will return the current arity
* @return Arity. * @return Arity.
*/ */
@Override
public int getArity() { public int getArity() {
return 2; return 2;
} }
@ -49,6 +52,7 @@ public class GPNodeDiv extends AbstractGPNode implements java.io.Serializable {
/** This method will evaluate a given node /** This method will evaluate a given node
* @param environment * @param environment
*/ */
@Override
public Object evaluate(InterfaceProgramProblem environment) { public Object evaluate(InterfaceProgramProblem environment) {
Object tmpObj; Object tmpObj;
double result = 1; double result = 1;

View File

@ -20,6 +20,7 @@ public class GPNodeExp extends AbstractGPNode implements java.io.Serializable {
/** This method will be used to identify the node in the GPAreaEditor /** This method will be used to identify the node in the GPAreaEditor
* @return The name. * @return The name.
*/ */
@Override
public String getName() { public String getName() {
return "Exp"; return "Exp";
} }
@ -27,6 +28,7 @@ public class GPNodeExp extends AbstractGPNode implements java.io.Serializable {
/** This method allows you to clone the Nodes /** This method allows you to clone the Nodes
* @return the clone * @return the clone
*/ */
@Override
public Object clone() { public Object clone() {
return (Object) new GPNodeExp(this); return (Object) new GPNodeExp(this);
} }
@ -34,6 +36,7 @@ public class GPNodeExp extends AbstractGPNode implements java.io.Serializable {
/** This method will return the current arity /** This method will return the current arity
* @return Arity. * @return Arity.
*/ */
@Override
public int getArity() { public int getArity() {
return 1; return 1;
} }
@ -41,6 +44,7 @@ public class GPNodeExp extends AbstractGPNode implements java.io.Serializable {
/** This method will evaluate a given node /** This method will evaluate a given node
* @param environment * @param environment
*/ */
@Override
public Object evaluate(InterfaceProgramProblem environment) { public Object evaluate(InterfaceProgramProblem environment) {
Object tmpObj; Object tmpObj;
double result = 1; double result = 1;

View File

@ -21,6 +21,7 @@ public class GPNodeFlowExec2 extends AbstractGPNode implements java.io.Serializa
/** This method will be used to identify the node in the GPAreaEditor /** This method will be used to identify the node in the GPAreaEditor
* @return The name. * @return The name.
*/ */
@Override
public String getName() { public String getName() {
return "Exec2"; return "Exec2";
} }
@ -28,6 +29,7 @@ public class GPNodeFlowExec2 extends AbstractGPNode implements java.io.Serializa
/** This method allows you to clone the Nodes /** This method allows you to clone the Nodes
* @return the clone * @return the clone
*/ */
@Override
public Object clone() { public Object clone() {
return (Object) new GPNodeFlowExec2(this); return (Object) new GPNodeFlowExec2(this);
} }
@ -35,6 +37,7 @@ public class GPNodeFlowExec2 extends AbstractGPNode implements java.io.Serializa
/** This method will return the current arity /** This method will return the current arity
* @return Arity. * @return Arity.
*/ */
@Override
public int getArity() { public int getArity() {
return 2; return 2;
} }
@ -42,6 +45,7 @@ public class GPNodeFlowExec2 extends AbstractGPNode implements java.io.Serializa
/** This method will evaluate a given node /** This method will evaluate a given node
* @param environment * @param environment
*/ */
@Override
public Object evaluate(InterfaceProgramProblem environment) { public Object evaluate(InterfaceProgramProblem environment) {
Object[] result = new Object[this.m_Nodes.length]; Object[] result = new Object[this.m_Nodes.length];

Some files were not shown because too many files have changed in this diff Show More