Logo
Distributed Genetic Programming Framework
print print

File org.dgpf.search.algorithms.hc.p2p.P2PHCState.java

Here you can find all the information about the file org.dgpf.search.algorithms.hc.p2p.P2PHCState.java. You may explore it here or download it onto your local disk.
/*
 * Copyright (c) 2006 Thomas Weise
 * 
 * E-Mail           : tweise@gmx.de
 * Creation Date    : 2006-05-10 08:17:46
 * Original Filename: org.dgpf.search.algorithms.hc.HCState.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.hc.p2p;

import java.io.Serializable;

import org.dgpf.search.algorithms.hc.HCState;
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 hill climbing engine.
 * @param <Genotype> The genotype of the elements to be evolved.
 *
 * @author Thomas Weise
 */

public class P2PHCState<Genotype extends Serializable>
                                 extends HCState<Genotype>
  {
/**
 * The serial version uid.
 */

  private static final long serialVersionUID = 1;
  
/**
 * The meta information of the p2p hill climbingstate.
 */

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

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

  protected P2PHCState  (final int                      p_ff_count,
                         final P2PHCStateBag<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;
    P2PHCParameters<Genotype>  l_hcp;
    
    super.assign(p_data);
    
    if(p_data instanceof P2PHCState)
      {
      Assigner.assign(this.m_p2p_state, ((P2PHCState)p_data).m_p2p_state);
      }
    else
      {
      if(p_data instanceof P2PHCParameters)
        {
        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 P2PHCState<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:P2PHCState.java
package:org.dgpf.search.algorithms.hc.p2p
qualified name:org.dgpf.search.algorithms.hc.p2p.P2PHCState.java
file type:Java Source File
download location:download http://dgpf.sourceforge.net/source/org/dgpf/search/algorithms/hc/p2p/P2PHCState.java
size:4.001 KB (4098 B)
uploaded: 2015-07-22 04:10:59 GMT+0000
last update: 2006-07-21 13:11:55 GMT+0000
last access: 2017-11-20 18:51:31 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-20 18:51:31 GMT+0000.
Valid CSS Valid XHTML 1.1
Valid RSS SourceForge.net Logo