Logo
Distributed Genetic Programming Framework
print print

File org.dgpf.search.api.utils.SearchFactory.java

Here you can find all the information about the file org.dgpf.search.api.utils.SearchFactory.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-15 15:34:02
 * Original Filename: org.dgpf.search.api.utils.SearchFactory.java
 * Version          : 1.0.0
 * Last modification: 2006-06-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.search.api.utils;

import org.dgpf.search.api.SearchEngine;
import org.sfc.code.CodeSession;

/**
 * This class allows us to create searches with predefined parameter
 * settings, ready to run.
 *
 * @author Thomas Weise
 */

public abstract class SearchFactory
  {
/**
 * This is the default place where you can find the search factory class in
 * a search jar archive.
 */

  public  static  final String  DEFAULT_FACTORY_CLASS = "startup.Factory";
  
/**
 * Create a new search. This search comes with predefined settings,
 * parameters and definitions. It has not yet been started, therefore use
 * the search's <code>start</code>-routine.
 * @return  The new predefined search.
 * @see SearchEngine#start()
 */

  public  abstract  SearchEngine<?>   create();
  
/**
 * Instantiate a search factory by using a code session which must contain
 * the class needed.
 * @param p_session The code session containing the class.
 * @return  The new search factory. You can reuse this instance to create
 *          many searches. If no search factory is contained in the
 *          code session according to the conventions, <code>null</code>
 *          is returned.
 */

  public static final SearchFactory instantiate(final CodeSession p_session)
    {
    Object l_o;
    
    l_o = p_session.instantiate(DEFAULT_FACTORY_CLASS, null);
    
    if(l_o instanceof SearchFactory) return ((SearchFactory)(l_o));
    return null;
    }
  
/**
 * Instantiate a search directly by using a code session which must contain
 * the class needed.
 * @param p_session The code session containing the search factory.
 * @return  The new search engine, ready to be started. 
 *          If no search factory is contained in the
 *          code session according to the conventions, <code>null</code>
 *          is returned.
 */

  public static final SearchEngine<?> create_search(final CodeSession p_session)
    {
    SearchFactory l_f;
    
    l_f = instantiate(p_session);
    if(l_f != null) return l_f.create();
    return null;
    }
  }

File Information:

file name:SearchFactory.java
package:org.dgpf.search.api.utils
qualified name:org.dgpf.search.api.utils.SearchFactory.java
file type:Java Source File
download location:download http://dgpf.sourceforge.net/source/org/dgpf/search/api/utils/SearchFactory.java
size:3.161 KB (3237 B)
uploaded: 2012-05-02 03:11:05 GMT+0000
last update: 2006-06-16 04:21:07 GMT+0000
last access: 2012-11-21 18:41: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 2012-05-02 03:10:45 GMT+0000 served at 2014-10-22 15:23:24 GMT+0000.
Valid CSS Valid XHTML 1.1
Valid RSS SourceForge.net Logo