Logo
Distributed Genetic Programming Framework
print print

File org.dgpf.gp.netvm.instructions.Send.java

Here you can find all the information about the file org.dgpf.gp.netvm.instructions.Send.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-26 08:21:11
 * Original Filename: org.dgpf.gp.netvm.instructions.Send.java
 * Version          : 1.0.0
 * Last modification: 2006-06-26
 *                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.netvm.instructions;


import org.dgpf.gp.netvm.base.NetVM;
import org.dgpf.gp.vm.base.IInstructionHandler;
import org.dgpf.gp.vm.base.Instruction;
import org.dgpf.gp.vm.base.VM;
import org.dgpf.gp.vm.instructions.BasicCosts;

/**
 * The send operation.
 *
 * @author Thomas Weise
 */

public class Send extends Instruction
  {
/**
 * The serial version uid.
 */

  private static final long serialVersionUID = 1;

/**
 * The globally shared singleton instance.
 */

  public  static  final Instruction INSTANCE = new Send();
/**
 * The costs for sending a message.
 */

  public  static  final double      COSTS    = (BasicCosts.CALL_COSTS * 7.0d);
  
/**
 * Create a new send instruction.
 */

  private  Send         ()
    {
    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.
 */

  @Override
  protected   final double  execute (final VM p_machine)
    {
    ((NetVM)p_machine).send();
    return COSTS;
    }
  

/**
 * Store this objects content into a string builder.
 * @param p_sb  The string builder to store stuff into.
 */

  @Override
  public  final void  to_string (final StringBuilder p_sb)
    {
    p_sb.append("send");
    }
  
  
/**
 * Perform a write replace of this object.
 * @return  The object to store.
 */

  private final Object writeReplace()
    {
    return INSTANCE;
    }

/**
 * Deserialize to the proper instance.
 * @return  The globally shared instance.
 */

  private final Object readResolve()
    {
    return INSTANCE;
    }
  

/**
 * Obtain the instruction handler to be used for this sort of instructions.
 * @return The instruction handler to be used for this sort of instructions.
 */

  @Override
  public  final IInstructionHandler get_handler()
    {
    return SendHandler.INSTANCE;
    }
  
/**
 * 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.
 */

  @Override
  protected boolean does_equal  (final Object p_o)
    {
    return true;
    }
  

/**
 * Get a string that can be copy-pasted into a java file an that creates
 * this instruction.
 * @param p_b The string builder to add with. 
 */

  @Override
  public final void    to_creation_string (final StringBuilder p_b)
    {
    p_b.append("Send.INSTANCE");
    }
  }

File Information:

file name:Send.java
package:org.dgpf.gp.netvm.instructions
qualified name:org.dgpf.gp.netvm.instructions.Send.java
file type:Java Source File
download location:download http://dgpf.sourceforge.net/source/org/dgpf/gp/netvm/instructions/Send.java
size:3.726 KB (3816 B)
uploaded: 2015-07-22 04:10:56 GMT+0000
last update: 2006-07-15 08:58:29 GMT+0000
last access: 2017-11-17 21:06:09 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-17 21:06:09 GMT+0000.
Valid CSS Valid XHTML 1.1
Valid RSS SourceForge.net Logo