Logo
Distributed Genetic Programming Framework
print print

File org.dgpf.search.algorithms.sa.p2p.P2PSAState.java

Here you can find all the information about the file org.dgpf.search.algorithms.sa.p2p.P2PSAState.java. You may explore it here or download it onto your local disk.
/*
 * Copyright (c) 2006 Thomas Weise
 * 
 * E-Mail           : tweise@gmx.dev
 * Creation Date    : 2006-06-05 13:27:42
 * Created by       : Stefan Niemczyk, Marc Kirchhoff
 * Original Filename: org.dgpf.search.algorithms.sa.p2p.P2PSAState.java
 * Version          : 1.0.2
 * Last modification: 2006-07-21
 *                by: Thomas Weise
 * 
 * License          : GNU LESSER GENERAL PUBLIC LICENSE
 *                    Version 2.1, February 1999
 *                    You should have received a copy of this license along
 *                    with this library; if not, write to the Free Software
 *                    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *                    MA 02111-1307, USA or download the license under
 *                    http://www.gnu.org/copyleft/lesser.html.
 *                    
 * Warranty         : This software is provided "as is" without any
 *                    warranty; without even the implied warranty of
 *                    merchantability or fitness for a particular purpose.
 *                    See the Gnu Lesser General Public License for more
 *                    details.
 */

 
package org.dgpf.search.algorithms.sa.p2p;

import java.io.Serializable;

import org.dgpf.search.algorithms.sa.SAState;
import org.dgpf.search.api.Assigner;
import org.dgpf.search.api.p2p.P2PSearchUtils;
import org.dgpf.search.api.p2p.P2PState;
import org.sfc.meta.MetaInformation;
import org.sfc.utils.Typesafe;


/**
 * The state of the p2p-extended simulated annealing engine.
 * @param <Genotype> The genotype of the elements to be evolved.
 *
 * @author Stefan Niemczyk, Marc Kirchhoff
 */

public class P2PSAState<Genotype extends Serializable>
                                 extends SAState<Genotype> 
{
/**
 * The serial version uid.
 */

  private static final long serialVersionUID = 1;
  
/**
 * The meta information of the p2p simulated annealing state.
 */

  public  static  final MetaInformation P2P_SA_STATE_METAINFO  ;
  
  static
    {
    P2PSearchUtils.P2P_STATE.add_port(
            P2PSAState.class, true, false, null);    
    P2P_SA_STATE_METAINFO = new MetaInformation();
    }
  
/**
 * The peer-to-peer state.
 */

  private  P2PState  m_p2p_state;
  
/**
 * Create a new simulated annealing state.
 * @param p_ff_count  The count of fitness functions evaluated by this
 *                    search.
 * @param p_bag       The peer-to-peer state bag.
 */

  protected P2PSAState  (final int                      p_ff_count,
                         final P2PSAStateBag<Genotype>  p_bag)
    {
    super(p_ff_count, p_bag);
    this.m_p2p_state = p_bag.m_p2p_state.unpack();
    }
  
  
/**
 * Assign the internal data of this search data to the data of
 * another one.
 * @param p_data  The simulation data to assign to.
 */

  @Override
  protected void  assign  (final Object p_data)
    { 
    //P2PHCState<Genotype> l_hcs;
    P2PSAParameters<Genotype>  l_hcp;
    
    super.assign(p_data);
    
    if(p_data instanceof P2PSAState)
      {
      Assigner.assign(this.m_p2p_state, ((P2PSAState)p_data).m_p2p_state);
      }
    else
      {
      if(p_data instanceof P2PSAParameters)
        {
        l_hcp = Typesafe.cast(p_data);
        Assigner.assign(this.m_p2p_state, l_hcp.get_p2p_parameters());
        }
      }
    }
  

/**
 * Obtain the p2p state which holds the control and statical data of the
 * peer-to-peer node.
 * @return The p2p state which holds the control and statical data of the
 *         peer-to-peer node.
 */

  public  final P2PState  get_p2p_state()
    {
    return this.m_p2p_state;
    }
  
  
/**
 * Creates and returns a copy of this object.  The precise meaning 
 * of "copy" may depend on the class of the object. 
 *
 * @return     A clone of this instance.
 * 
 * @see java.lang.Cloneable
 */

  @Override
  public  Object  clone ()
    {
    final P2PSAState<Genotype>  l_ss;
  
    l_ss             = Typesafe.cast(super.clone());      
    l_ss.m_p2p_state = Typesafe.cast(l_ss.m_p2p_state.clone());
    
    return l_ss;
    }
  }

File Information:

file name:P2PSAState.java
package:org.dgpf.search.algorithms.sa.p2p
qualified name:org.dgpf.search.algorithms.sa.p2p.P2PSAState.java
file type:Java Source File
download location:download http://dgpf.sourceforge.net/source/org/dgpf/search/algorithms/sa/p2p/P2PSAState.java
size:4.105 KB (4204 B)
uploaded: 2015-07-22 04:10:59 GMT+0000
last update: 2006-07-21 13:11:55 GMT+0000
last access: 2017-11-19 05:01:19 GMT+0000

statistics online since 2006-01-02.   RSS Feed
Contact us by sending an email to tweise@gmx.de to receive further information, to report errors, or to join our project.
All content on this site (http://dgpf.sourceforge.net/) is LGPL-licensed.
http://dgpf.sourceforge.net/scripts/source/source.php last modified at 2015-07-22 04:10:53 GMT+0000 served at 2017-11-19 05:01:19 GMT+0000.
Valid CSS Valid XHTML 1.1
Valid RSS SourceForge.net Logo