Logo
Distributed Genetic Programming Framework
print print

File org.dgpf.gp.vm.base.Instruction.java

Here you can find all the information about the file org.dgpf.gp.vm.base.Instruction.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-06-08 08:27:06
 * Original Filename: org.dgpf.gp.vm.Instruction.java
 * Version          : 1.0.0
 * Last modification: 2006-07-15
 *                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.base;

import org.dgpf.gp.Construct;
import org.sfc.utils.ICloneable;


/**
 * This class is the base of all instructions.
 *
 * @author Thomas Weise
 */

public abstract class Instruction extends     Construct
                                  implements  ICloneable
  {
/**
 * Create a new instruction.
 */

  protected Instruction()
    {
    super();
    }
  
  
/**
 * Execute this instruction on a virtual machine.
 * @param p_machine The virtual machine to execute on.
 * @return  The cost of the execution of the last instruction.
 */

  protected   abstract    double  execute (final VM p_machine);
  
/**
 * Obtain the highest directly accessed address.
 * @return The highest directly accessed address.
 */

  public     int   get_highest_address()
    {
    return 0;
    }
  
/**
 * Obtain the lowest directly accessed address.
 * @return The lowest directly accessed address.
 */

  public    int   get_lowest_address()
    {
    return 0;
    }
  
/**
 * Obtain the instruction handler to be used for this sort of instructions.
 * @return The instruction handler to be used for this sort of instructions.
 */

  public  abstract  IInstructionHandler get_handler();
  

/**
 * 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 ()
    {
    try
      {
      return super.clone();
      }
    catch(Throwable l_t)
      {
      return this//this will never happen
      }
    }
  
  
/**
 * Check whether this instruction equals to a specified object, called
 * internally.
 * @param p_o   The object to compare with, which is of the same class as
 *              this instruction.
 * @return  <code>true</code> if and only if this instruction equals
 *          the specified object.
 */

  protected abstract  boolean does_equal  (final Object p_o);
  
  
/**
 * Check whether this instruction equals to a specified object.
 * @param p_o   The object to compare with.
 * @return  <code>true</code> if and only if this instruction equals
 *          the specified object.
 */

  @Override
  public  final boolean equals  (final Object p_o)
    {
    return ( (p_o == this) ||
           ( (p_o != null) && (p_o.getClass() == this.getClass())
                           && this.does_equal(p_o)) );
    }
  }

File Information:

file name:Instruction.java
package:org.dgpf.gp.vm.base
qualified name:org.dgpf.gp.vm.base.Instruction.java
file type:Java Source File
download location:download http://dgpf.sourceforge.net/source/org/dgpf/gp/vm/base/Instruction.java
size:3.546 KB (3632 B)
uploaded: 2015-07-22 04:10:56 GMT+0000
last update: 2006-08-01 05:36:43 GMT+0000
last access: 2017-11-20 18:59:43 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:59:43 GMT+0000.
Valid CSS Valid XHTML 1.1
Valid RSS SourceForge.net Logo