Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/project-web/dgpf/htdocs/scripts/datetime.php on line 7

Warning: Cannot modify header information - headers already sent by (output started at /home/project-web/dgpf/htdocs/scripts/datetime.php:7) in /home/project-web/dgpf/htdocs/scripts/init.php on line 28

Warning: Cannot modify header information - headers already sent by (output started at /home/project-web/dgpf/htdocs/scripts/datetime.php:7) in /home/project-web/dgpf/htdocs/scripts/init.php on line 29
Distributed Genetic Programming Framework
Logo
Distributed Genetic Programming Framework
print print


Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/project-web/dgpf/htdocs/scripts/datetime.php on line 16

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/project-web/dgpf/htdocs/scripts/datetime.php on line 16

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/project-web/dgpf/htdocs/scripts/datetime.php on line 16

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/project-web/dgpf/htdocs/scripts/datetime.php on line 16

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/project-web/dgpf/htdocs/scripts/datetime.php on line 16

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/project-web/dgpf/htdocs/scripts/datetime.php on line 16

File org.dgpf.gp.netautomaton.instructions.SendWordHandler.java

Here you can find all the information about the file org.dgpf.gp.netautomaton.instructions.SendWordHandler.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-02-07 07:26:46
 * Original Filename: org.dgpf.netautomaton.expressions.SendWordHandler.java
 * Version          : 2.2.1
 * Last modification: 2006-05-08
 * Last modified 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.gp.netautomaton.instructions;

import org.dgpf.gp.automaton.base.Expression;
import org.dgpf.gp.automaton.base.Instruction;
import org.dgpf.gp.automaton.search.InstructionHandler;
import org.dgpf.gp.automaton.search.Mutator;
import org.dgpf.gp.automaton.search.ProgramContext;
import org.dgpf.gp.netautomaton.expressions.ReceiveWord;
import org.sfc.collections.Arrays;
import org.sfc.utils.Typesafe;

/**
 * The handler for the send word instruction.
 *
 * @author Thomas Weise
 */

final class SendWordHandler  extends InstructionHandler<SendWord>
  {

/**
 * Mutate the send-word expression.
 */

  private static final Mutator<Instruction, SendWord> MUTATE_EXPRESSION =
                   new Mutator<Instruction, SendWord>()
    {
/**
 * Mutate an existing instance of the genotype.
 * @param p_source        The source instance.
 * @param p_context     The program context to be used.
 * @param p_instruction_count The count of instructions of the program
 *                            the mutated instruction will be part of.
 * @param p_memory_size   The memory size currently available.
 * @return The randomly mutated copy of the source or <code>p_source</code>
 *         itself if it cannot be mutated in any way.
 */

    @Override
    protected Instruction mutate(final  SendWord        p_source,
                                 final  ProgramContext  p_context,
                                 final  int             p_instruction_count,
                                 final  int             p_memory_size)
      {
      return new SendWord(p_context.mutate_expression(
                          p_source.get_what(), false,
                          p_memory_size));
      }
    };


/**
 * The possible mutators of the sleepinstruction.
 */

  private static  final Mutator<Instruction, SendWord>[] MUTATORS =
                                       Arrays.create(MUTATE_EXPRESSION);
/**
 * The frequencies at which the mutations are selected.
 */

  private static  final double[]  FREQUENCIES = {1.0d};

/**
 * The singleton handler for if instructions.
 */

  static final InstructionHandler<Instruction>
                            INSTANCE = Typesafe.cast(new SendWordHandler());
  
/**
 * Create a new sendword handler.
 */

  private SendWordHandler()
    {
    super(MUTATORS, FREQUENCIES);
    }

/**
 * Create a new, random instance of the genotype.
 * @param p_context     The program context to be used.
 * @param p_instruction_count The count of instructions of the program
 *                            the new instruction will be part of.
 * @param p_memory_size   The memory size currently available.
 * @return  The random genotype instance.
 */

  @Override
  public final Instruction create(final ProgramContext  p_context,
                                  final int             p_instruction_count,
                                  final int             p_memory_size)
    {
    Expression  l_ex;
    
    do
      {
      l_ex = p_context.create_expression(false, false, p_memory_size);
      } while (l_ex instanceof ReceiveWord);
    return new SendWord(l_ex);
    }



/**
 * This method returns an optimized version of the source instruction,
 * or the source instruction itself if it cannot be optimized.
 * @param p_source  The source instruction.
 * @return  An optimized version of the source instruction,
 *          or the source instruction itself if it cannot be optimized.
 */

  @Override
  public final  Instruction optimize     (final SendWord   p_source)
    {
    Expression  l_ex, l_w;

    l_w  = p_source.get_what();
    l_ex = l_w;
    l_ex = l_ex.get_handler().optimize(l_ex);
    
    if( (l_ex != null) && (l_ex != l_w) )
      {
      p_source.init(l_ex);
      }

    return p_source;
    }
  
/**
 * Checks wether this instruction is practically useless.
 * @param p_source            The instruction to check.
 * @param p_position          The position this instruction can be found at.
 * @return  <code>true</code> if and only if leaving this instruction away
 *          will not change the program's functionality.
 */

  @Override
  public final   boolean is_useless  (final SendWord   p_source,
                                      final int        p_position)
    {
    if(super.is_useless(p_source, p_position)) return true;
    return (p_source.get_what() instanceof ReceiveWord);
    }
  }

File Information:

file name:SendWordHandler.java
package:org.dgpf.gp.netautomaton.instructions
qualified name:org.dgpf.gp.netautomaton.instructions.SendWordHandler.java
file type:Java Source File
download location:download http://dgpf.sourceforge.net/source/org/dgpf/gp/netautomaton/instructions/SendWordHandler.java
size:5.514 KB (5647 B)
uploaded: 2018-01-07 12:03:34 GMT+0000
last update: 2006-06-09 03:06:03 GMT+0000
last access: 2018-01-07 12:03:34 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
Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/project-web/dgpf/htdocs/scripts/datetime.php on line 16

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/project-web/dgpf/htdocs/scripts/datetime.php on line 16
last modified at 2018-01-07 12:03:34 GMT+0000
Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/project-web/dgpf/htdocs/scripts/datetime.php on line 19

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/project-web/dgpf/htdocs/scripts/datetime.php on line 19
served at 2018-02-21 07:09:07 GMT+0000.
Valid CSS Valid XHTML 1.1
Valid RSS SourceForge.net Logo