Logo
Distributed Genetic Programming Framework
print print

File org.sfc.events.SfcEvent.java

Here you can find all the information about the file org.sfc.events.SfcEvent.java. You may explore it here or download it onto your local disk.
/*
 * Copyright (c) 2005 Thomas Weise
 *
 * E-Mail           : tweise@gmx.de
 * Creation Date    : 2005-07-14 08:02:45
 * Original Filename: org.sfc.events.SfcEvent.java
 * Version          : 3.0.0
 * Last modification: 2006-04-10
 *                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.sfc.events;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.EventObject;

/**
 * This is the default event implementation all sfc-events should inherite
 * from. It is serializable even if the event's source isn't. In this case,
 * just the sources class name will be serialized. So whenever you check
 * for the source of an SfcEvent, you might as well encounter a class name
 * instead of an object.
 * @author Thomas Weise
 */

public class SfcEvent extends EventObject
  {
/**
 * The serial version uid.
 */

  private static final long serialVersionUID = 2;


/**
 * Create a new <code>SfcEvent</code>. You cannot do this directly,
 * but can create derived class instances.
 * @param p_source  The source of the event.
 */

  protected SfcEvent(final Object p_source)
    {
    super(p_source);
    }


/**
 * Reconstitute the <code>SfcEvent</code> instance from a stream (that is,
 * deserialize it).
 * @param p_s The input stream.
 * @throws  IOException If something io-like went wrong.
 * @throws  ClassNotFoundException  If a needed class could not be found.
 */

  private final void readObject(final ObjectInputStream p_s)
        throws IOException, ClassNotFoundException
    {
    p_s.defaultReadObject();
    this.source = p_s.readObject();
    }


/**
 * Stores the <code>SfcEvent</code> into the stream.
 * @param p_s The output stream.
 * @throws  IOException If something io-like went wrong.
 */

  private final void writeObject(final ObjectOutputStream p_s)
        throws IOException
    {
    Object  l_s;

    p_s.defaultWriteObject();

    l_s = this.source;
    if(l_s == null)
      {
      p_s.writeObject(null);
      }
    else
      {
      if(l_s instanceof Serializable)
        {
        p_s.writeObject(l_s);
        }
      else
        {
        p_s.writeObject(l_s.getClass().toString());
        }
      }
    }
  }

File Information:

file name:SfcEvent.java
package:org.sfc.events
qualified name:org.sfc.events.SfcEvent.java
file type:Java Source File
download location:download http://dgpf.sourceforge.net/source/org/sfc/events/SfcEvent.java
size:3.052 KB (3126 B)
uploaded: 2018-01-07 12:03:36 GMT+0000
last update: 2006-04-10 10:13:07 GMT+0000
last access: 2018-04-27 02:36:17 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 2018-01-07 12:03:34 GMT+0000 served at 2018-04-27 02:36:17 GMT+0000.
Valid CSS Valid XHTML 1.1
Valid RSS SourceForge.net Logo