Logo
Distributed Genetic Programming Framework
print print

File org.sfc.scoped.Scoped.java

Here you can find all the information about the file org.sfc.scoped.Scoped.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-06-20 07:02:57
 * Original Filename: org.sfc.scoped.Scoped.java
 * Version          : 1.0.2
 * Last modification: 2006-03-07
 *                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.scoped;

/**
 * This internal class is the base for all scoped classes.
 * @author Thomas Weise 
 */

class Scoped
  {
/**
 * <code>true</code> as long as this object is alive, <code>false</code> if
 * it died. 
 */

  boolean m_living    ;
  
/**
 * Create a new instance of the default base of scoped classes.
 */

  public  Scoped ()
    {
    super();
    this.m_living         = true;
    }
  
/**
 * Use this method to check if the object is still alive. It will throw
 * an error if not.         
 */

  protected final void  check_living ()
    {
    if(!(this.m_living)) throw new AlreadyDisposedException();
    }
  
/**
 * This method is automatically called when the object gets disposed.
 * You should perform your cleanup in this method. If you override this
 * method, don't forget to call the super method.
 */

  protected void  dispose ()
    {
    //
    }
  
/**
 * This method ensures the <code>close()</code> is called if it was not
 * yet called due to a programming mistake.
 * @throws  Throwable Maybe thrown by the super method.
 */

    @Override
  protected final void  finalize  () throws Throwable
    {
    
    synchronized(this)
      {
      if(this.m_living)
        {
        this.m_living    = false;
        this.dispose();
        }
      }
      
    super.finalize();
    }
  
/**
 * Creates and returns a copy of this object.
 * This copy will have a reference-count of one. You must call
 * <code>release</code> on that copy when you're finished with it.
 * You cannot assume the copy's reference count being linked in any way
 * with this object's one.
 * @return  An exact copy of this object.
 * 
 * @throws  CloneNotSupportedException  If the object doesn't implement the
 *                                      <code>Cloneable</code> interface.
 */

    @Override
  protected Object  clone() throws  CloneNotSupportedException
    {    
    synchronized(this)
      {
      if(this.m_living)
        {
        return super.clone();
        }
      }
    
    throw new AlreadyDisposedException();
    }
  }

File Information:

file name:Scoped.java
package:org.sfc.scoped
qualified name:org.sfc.scoped.Scoped.java
file type:Java Source File
download location:download http://dgpf.sourceforge.net/source/org/sfc/scoped/Scoped.java
size:3.181 KB (3258 B)
uploaded: 2018-01-07 12:03:36 GMT+0000
last update: 2006-03-07 04:20:28 GMT+0000
last access: 2018-04-21 04:15:05 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-21 04:15:05 GMT+0000.
Valid CSS Valid XHTML 1.1
Valid RSS SourceForge.net Logo