Logo
Distributed Genetic Programming Framework
print print

File org.dgpf.gp.vm.instructions.base.NoMemInstr2Handler.java

Here you can find all the information about the file org.dgpf.gp.vm.instructions.base.NoMemInstr2Handler.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-07-03 04:10:21
 * Original Filename: org.dgpf.gp.vm.instructions.base.NoMemInstrHandler.java
 * Version          : 1.0.0
 * Last modification: 2006-07-03
 *                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.vm.instructions.base;

import org.dgpf.gp.vm.base.IInstructionHandler;
import org.dgpf.gp.vm.base.Instruction;
import org.dgpf.gp.vm.base.VMContext;
import org.dgpf.gp.vm.mutation.MutationInfo;
import org.dgpf.search.api.utils.IMutator;
import org.dgpf.search.api.utils.WeightedMutator;
import org.dgpf.search.api.utils.WeightedSetBuilder;


/**
 * Another simple instruction handler prototype for instructions not
 * accessing memory cells.
 *
 * @author Thomas Weise
 */

public abstract class       NoMemInstr2Handler 
                extends     WeightedMutator<Instruction, VMContext,
                                            MutationInfo>
                implements  IInstructionHandler
  {
      
/**
 * Create a new mem instr 1 handler. Such handlers use internal mutator
 * lists.
 * @param p_wsb The weighted set builder to use. Leave this
 *              <code>null</code> if no additional mutators are needed. 
 */

  protected NoMemInstr2Handler(final WeightedSetBuilder<IMutator
                             <Instruction, VMContext, MutationInfo>> p_wsb)
    {
    super(p_wsb);
    }
             

/**
 * Replace a memory access address by another one.
 * @param p_instruction The instruction to replace the address.
 * @param p_old         The old address.
 * @param p_new         The new address.
 * @return  The new instruction where the address relacement has been
 *          performed, or the old one if no replacement was needed.  
 */

  public Instruction swap_address(final Instruction p_instruction,
                                  final int         p_old,
                                  final int         p_new)
    {        
    return p_instruction;
    }
  
/**
 * This method tells if this instruction can be useful at the end of a
 * procedure. A comparison, for example, will never be useful, since
 * its result will always get lost.
 * @return <code>true</code> if and only if an instruction is useful at the
 *         end of a procedure.
 */

  public boolean is_useful_at_end()
    {
    return true;
    }
  
/**
 * This method tells if this instruction can be useful at the beginning of
 * a procedure. A pop, for example, will never be useful, since the stack
 * of a procedure is initially empty.
 * @return <code>true</code> if and only if an instruction is useful at the
 *         beginning of a procedure.
 */

  public boolean is_useful_at_begin()
    {
    return true;
    }
  
  
/**
 * Get an instruction that better represents the passed in instruction.
 * @param p_i   The instruction to replace.
 * @return  An instruction that better represents <code>p_i</code>, or
 *          <code>p_i</code> if it is already perfect, or <code>null</code>
 *          if <code>p_i</code> itself is totally useless.
 */

  public Instruction get_replacement (final Instruction p_i)
    {
    return p_i;
    }
  
  
/**
 * Try to melt two instructions together. The second instruction is of
 * the type this instruction handler handles.
 * @param p_first   The first instruction.
 * @param p_second  The second instruction.
 * @return  An instruction able to replace the sequence of these both
 *          instructions, or <code>null</code> if no valid replacement
 *          coult be found.
 */
  
  public  Instruction try_melt  (final Instruction p_first,
                                 final Instruction p_second)
    {
    return null;
    }
  }

File Information:

file name:NoMemInstr2Handler.java
package:org.dgpf.gp.vm.instructions.base
qualified name:org.dgpf.gp.vm.instructions.base.NoMemInstr2Handler.java
file type:Java Source File
download location:download http://dgpf.sourceforge.net/source/org/dgpf/gp/vm/instructions/base/NoMemInstr2Handler.java
size:4.545 KB (4655 B)
uploaded: 2015-07-22 04:10:58 GMT+0000
last update: 2006-07-10 07:54:40 GMT+0000
last access: 2017-11-23 07:27:42 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-24 00:22:18 GMT+0000.
Valid CSS Valid XHTML 1.1
Valid RSS SourceForge.net Logo