Documentation of 'org.jgap.impl.JGAPFactory' Java class
JGAPFactory
org.jgap.impl

Class JGAPFactory

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Comparable, IJGAPFactory, ICloneable


    public class JGAPFactory
    extends java.lang.Object
    implements IJGAPFactory, java.io.Serializable, ICloneable, java.lang.Comparable
    Central factory for creating default objects to use, e.g. random generators. Could be made configurable. An instance of JGAPFactory can be accessed via

    Genotype.getConfiguration().getJGAPFactory();

    To use your own factory class instead, use:

    System.setProperty(Configuration.PROPERTY_JGAPFACTORY_CLASS, "myFactory");

    with "myFactory" representing the name of your class to use.

    Since:
    2.6
    See Also:
    Serialized Form
    • Constructor Detail

      • JGAPFactory

        public JGAPFactory(boolean a_useCaching)
    • Method Detail

      • setParameters

        public void setParameters(java.util.Collection a_parameters)
        Allows setting (generic because unknown) parameters for creating objects.
        Specified by:
        setParameters in interface IJGAPFactory
        Parameters:
        a_parameters - Collection of generic parameters
        Since:
        2.6
      • getParameters

        public java.util.Collection getParameters()
        Returns:
        Collection of generic parameters
        Since:
        3.0
      • registerCloneHandler

        public int registerCloneHandler(ICloneHandler a_cloneHandler)
        Registers a clone handler that could be retrieved by getCloneHandlerFor(Class).
        Specified by:
        registerCloneHandler in interface IJGAPFactory
        Parameters:
        a_cloneHandler - the ICloneHandler to register
        Returns:
        index of the added clone handler, needed when removeCloneHandler will be called
        Since:
        2.6
      • removeCloneHandler

        public ICloneHandler removeCloneHandler(int a_index)
        Removes a clone handler at a given index (which is obtained from registerCloneHandler).
        Parameters:
        a_index - the index of the clone handler to remove
        Returns:
        the removed ICloneHandler, or Exception if not successfull
        Since:
        2.6
      • getCloneHandlerFor

        public ICloneHandler getCloneHandlerFor(java.lang.Object a_obj,
                                                java.lang.Class a_classToClone)
        Retrieves a clone handler capable of clone the given class.
        Specified by:
        getCloneHandlerFor in interface IJGAPFactory
        Parameters:
        a_obj - the object to clone (maybe null)
        a_classToClone - the class to clone an object of (maybe null)
        Returns:
        the clone handler found capable of clone the given class, or null if none registered
        Since:
        2.6
      • registerInitializer

        public int registerInitializer(IInitializer a_chromIniter)
        Registers an initializer that could be retrieved by getInitializerFor(Class).
        Specified by:
        registerInitializer in interface IJGAPFactory
        Parameters:
        a_chromIniter - the IChromosomeInitializer to register
        Returns:
        index of the added initializer, needed when removeChromosomeInitializer will be called
        Since:
        2.6
      • removeInitializer

        public IInitializer removeInitializer(int a_index)
        Removes an initializer at a given index (which is obtained from registerInitializer).
        Parameters:
        a_index - the index of the initializer to remove
        Returns:
        the removed IInitializer, or null if not successfull
        Since:
        2.6
      • getInitializerFor

        public IInitializer getInitializerFor(java.lang.Object a_obj,
                                              java.lang.Class a_class)
        Retrieves an initializer capable of initializing the Object of the given class.
        Specified by:
        getInitializerFor in interface IJGAPFactory
        Parameters:
        a_obj - the object to init (maybe null)
        a_class - the object class to init (maybe null)
        Returns:
        new instance (should be!) of initialized object
        Since:
        2.6
      • getCompareToHandlerFor

        public ICompareToHandler getCompareToHandlerFor(java.lang.Object a_obj,
                                                        java.lang.Class a_classToCompareTo)
        Retrieves a handler capable of comparing two instances of the given class.
        Specified by:
        getCompareToHandlerFor in interface IJGAPFactory
        Parameters:
        a_obj - the object to compare (maybe null)
        a_classToCompareTo - the class instances to compare (maybe null)
        Returns:
        the handler found capable of comparing instances of the given class, or null if none registered
        Since:
        2.6
      • registerCompareToHandler

        public int registerCompareToHandler(ICompareToHandler a_compareToHandler)
        Registers a compareTo-handler that could be retrieved by getCompareToHandlerFor(Class).
        Specified by:
        registerCompareToHandler in interface IJGAPFactory
        Parameters:
        a_compareToHandler - the ICompareToHandler to register
        Returns:
        index of the added handler, needed when removeCompareToHandler will be called
        Since:
        2.6
      • removeCompareToHandler

        public ICompareToHandler removeCompareToHandler(int a_index)
        Removes a compareTo-handler at a given index (which is obtained from registerCompareToHandler).
        Parameters:
        a_index - the index of the handler to remove
        Returns:
        the removed handler, or Exception if not successfull
        Since:
        2.6
      • isUseCaching

        public boolean isUseCaching()
        Returns:
        true: caching used, false: no caching used
        Since:
        3.0
      • clone

        public java.lang.Object clone()
        Specified by:
        clone in interface ICloneable
        Overrides:
        clone in class java.lang.Object
        Returns:
        clone of the current object instance
      • equals

        public boolean equals(java.lang.Object a_other)
        The equals-method
        Overrides:
        equals in class java.lang.Object
        Parameters:
        a_other - sic
        Returns:
        sic
        Since:
        3.2
      • compareTo

        public int compareTo(java.lang.Object a_other)
        Specified by:
        compareTo in interface java.lang.Comparable
        Parameters:
        a_other - other object to compare
        Returns:
        as always
        Since:
        3.2
      • getUniqueKey

        public java.lang.String getUniqueKey(java.lang.String a_context)
        Returns a unique key for the given context. The key uses the current date and time and a GUID. Thus it is quite probable, that the key is unique worldwide.
        Parameters:
        a_context - the context to get the next key for, like "Chromosome".
        Returns:
        the unique key for the given context
        Since:
        3.5

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.