View Javadoc
1   /**
2    * @(#)StateError.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  /**
16   * <code>StateError</code>: Klasa określająca stan
17   * algorytmu genetycznego.
18   * @version 1.0 2011-01-10
19   * @author <a href="mailto:wojciech.wolszczak@delhezi.com">
20   * Wojciech Wolszczak</a>
21   */
22  public class StateError implements State {
23      /** Logger object. */
24      //private static final Logger LOGGER =
25      //    Logger.getLogger(StateInitialized.class.getName());
26  
27      /** Delhezi Error Code. */
28      //private static final String DERC = "1-12-";
29      private GeneticAlgorithm ga;
30  
31      /**
32       * Konstruktor.
33       * @param ga Referencja do obiektu algorytmu genetycznego.
34       * @since 1.0
35       */
36      public StateError(final GeneticAlgorithm ga) {
37          this.ga = ga;
38      }
39  
40      /**
41       * Uruchamia działanie algorytmu gentycznego.
42       * @throws GeneticAlgorithmException xxx
43       * @since 1.0
44       */
45      @Override
46      public final void run() throws GeneticAlgorithmException {
47          throw new GeneticAlgorithmException("Current status : "
48                                              + this.getState().toString());
49      }
50  
51      /**
52       * Zatrzymuje działanie algorytmu gentycznego.
53       * @throws GeneticAlgorithmException xxx
54       * @since 1.0
55       */
56      @Override
57      public final void stop() throws GeneticAlgorithmException {
58          throw new GeneticAlgorithmException("Current status : "
59                                              + this.getState().toString());
60      }
61  
62      /**
63       * Zwraca status algorytmu gentycznego.
64       * @return Status algorytmu gegentycznego.
65       * @since 1.0
66       */
67      @Override
68      public final GeneticAlgorithmState getState() {
69          return GeneticAlgorithmState.ERROR;
70      }
71  }
72