[6152] | 1 | /* |
---|
| 2 | Copyright 2006 by Sean Luke |
---|
| 3 | Licensed under the Academic Free License version 3.0 |
---|
| 4 | See the file "LICENSE" for more information |
---|
| 5 | */ |
---|
| 6 | |
---|
| 7 | |
---|
| 8 | package ec.simple; |
---|
| 9 | import ec.EvolutionState; |
---|
| 10 | import ec.Population; |
---|
| 11 | import ec.Exchanger; |
---|
| 12 | import ec.util.Parameter; |
---|
| 13 | import ec.steadystate.*; |
---|
| 14 | |
---|
| 15 | /* |
---|
| 16 | * SimpleExchanger.java |
---|
| 17 | * |
---|
| 18 | * Created: Tue Aug 10 21:59:17 1999 |
---|
| 19 | * By: Sean Luke |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | /** |
---|
| 23 | * A SimpleExchanger is a default Exchanger which, well, doesn't do anything. |
---|
| 24 | * Most applications don't need Exchanger facilities; this simple version |
---|
| 25 | * will suffice. |
---|
| 26 | * |
---|
| 27 | * <p>The SimpleExchanger implements the SteadyStateExchangerForm, mostly |
---|
| 28 | * because it does nothing with individuals. For this reason, it is final; |
---|
| 29 | * implement your own Exchanger if you need to do something more advanced. |
---|
| 30 | * |
---|
| 31 | * @author Sean Luke |
---|
| 32 | * @version 1.0 |
---|
| 33 | */ |
---|
| 34 | |
---|
| 35 | public final class SimpleExchanger extends Exchanger implements SteadyStateExchangerForm |
---|
| 36 | { |
---|
| 37 | public void setup(final EvolutionState state, final Parameter base) { } |
---|
| 38 | |
---|
| 39 | /** Doesn't do anything. */ |
---|
| 40 | public void initializeContacts(final EvolutionState state) |
---|
| 41 | { |
---|
| 42 | // don't care |
---|
| 43 | return; |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | /** Doesn't do anything. */ |
---|
| 47 | public void reinitializeContacts(final EvolutionState state) |
---|
| 48 | { |
---|
| 49 | // don't care |
---|
| 50 | return; |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | /** Simply returns state.population. */ |
---|
| 54 | public Population preBreedingExchangePopulation(final EvolutionState state) |
---|
| 55 | { |
---|
| 56 | // don't care |
---|
| 57 | return state.population; |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | /** Simply returns state.population. */ |
---|
| 61 | public Population postBreedingExchangePopulation(final EvolutionState state) |
---|
| 62 | { |
---|
| 63 | // don't care |
---|
| 64 | return state.population; |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | /** Doesn't do anything. */ |
---|
| 68 | public void closeContacts(final EvolutionState state, final int result) |
---|
| 69 | { |
---|
| 70 | // don't care |
---|
| 71 | return; |
---|
| 72 | } |
---|
| 73 | |
---|
| 74 | /** Always returns null */ |
---|
| 75 | public String runComplete(final EvolutionState state) |
---|
| 76 | { |
---|
| 77 | return null; |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | } |
---|