View Javadoc
1   /**
2    * @(#)StateRunning.java
3    * Copyright (C) 2008-2011 delhezi.com
4    *
5    * This class is released under the:
6    * GNU Lesser General Public License (LGPL) version 3 or later.
7    * http://www.gnu.org/copyleft/lesser.html
8    */
9   package com.delhezi.ga;
10  
11  import com.delhezi.ga.exception.GeneticAlgorithmException;
12  //import java.util.logging.Logger;
13  
14  /**
15   * <code>StateRunning</code>: Klasa określająca stan
16   * algorytmu genetycznego.
17   * @version 1.0 2011-01-10
18   * @author <a href="mailto:wojciech.wolszczak@delhezi.com">
19   * Wojciech Wolszczak</a>
20   */
21  public class StateRunning implements State {
22      /** Logger object. */
23      //private static final Logger LOGGER =
24      //    Logger.getLogger(StateRunning.class.getName());
25  
26      /** Delhezi Error Code. */
27      //private static final String DERC = "1-10-";
28      private GeneticAlgorithm ga;
29  
30      /**
31       * Konstruktor.
32       * @param ga Referencja do obiektu algorytmu genetycznego.
33       * @since 1.0
34       */
35      public StateRunning(final GeneticAlgorithm ga) {
36          this.ga = ga;
37      }
38  
39      /**
40       * Uruchamia działanie algorytmu gentycznego.
41       * @throws GeneticAlgorithmException xxx
42       * @since 1.0
43       */
44      @Override
45      public final void run() throws GeneticAlgorithmException {
46          return;
47      }
48  
49      /**
50       * Zatrzymuje działanie algorytmu gentycznego.
51       * @throws GeneticAlgorithmException xxx
52       * @since 1.0
53       */
54      @Override
55      public final void stop() throws GeneticAlgorithmException {
56          ga.setState(GeneticAlgorithmState.STOPPED);
57      }
58  
59      /**
60       * Zwraca status algorytmu gentycznego.
61       * @return Status algorytmu gegentycznego.
62       * @since 1.0
63       */
64      @Override
65      public final GeneticAlgorithmState getState() {
66          return GeneticAlgorithmState.RUNNING;
67      }
68  }