程序包 weka.gui

类 GenericPropertiesCreator

java.lang.Object
weka.gui.GenericPropertiesCreator

public class GenericPropertiesCreator extends Object
This class can generate the properties object that is normally loaded from the GenericObjectEditor.props file (= PROPERTY_FILE). It takes the GenericPropertiesCreator.props file as a template to determine all the derived classes by checking the classes in the given packages (a file with the same name in your home directory overrides the the one in the weka/gui directory/package).
E.g. if we want to have all the subclasses of the Classifier class then we specify the superclass ("weka.classifiers.Classifier") and the packages where to look for ("weka.classifiers.bayes" etc.):
 
   weka.classifiers.Classifier=\
     weka.classifiers.bayes,\
     weka.classifiers.functions,\
     weka.classifiers.lazy,\
     weka.classifiers.meta,\
     weka.classifiers.trees,\
     weka.classifiers.rules
  
 
This creates the same list as stored in the GenericObjectEditor.props file, but it will also add additional classes, that are not listed in the static list (e.g. a newly developed Classifier), but still in the classpath.

For discovering the subclasses the whole classpath is inspected, which means that you can have several parallel directories with the same package structure (e.g. a release directory and a developer directory with additional classes).

The dynamic discovery can be turned off via the UseDyanmic property in the props file (values: true|false).
版本:
$Revision: 7059 $
作者:
FracPete (fracpete at waikato dot ac dot nz)
另请参阅:
  • 字段概要

    字段
    修饰符和类型
    字段
    说明
    static final String
    name of property whether to use the dynamic approach or the old GenericObjectEditor.props file
    static final boolean
    whether to output some debug information
  • 构造器概要

    构造器
    构造器
    说明
    initializes the creator, locates the props file with the Utils class.
    initializes the creator, the given file overrides the props-file search of the Utils class
  • 方法概要

    修饰符和类型
    方法
    说明
    void
    generates the props-file for the GenericObjectEditor and stores it
    void
    execute(boolean store)
    generates the props-file for the GenericObjectEditor and stores it only if the the param store is TRUE.
    boolean
    returns TRUE, if a file is loaded and not the Utils class used for locating the props file.
    returns the name of the input file
    returns the input properties object (template containing the packages)
    returns the name of the output file
    returns the output properties object (structure like the template, but filled with classes instead of packages)
    static void
    main(String[] args)
    for generating props file: no parameter: see default constructor 1 parameter (i.e., filename): see default constructor + setOutputFilename(String) 2 parameters (i.e, filenames): see constructor with String argument + setOutputFilename(String)
    void
    setExplicitPropsFile(boolean value)
    if FALSE, the locating of a props-file of the Utils-class is used, otherwise it's tried to load the specified file
    void
    sets the file to get the information about the packages from.
    void
    sets the file to output the properties for the GEO to
    boolean
    gets whether the dynamic approach should be used or not

    从类继承的方法 java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 字段详细资料

    • VERBOSE

      public static final boolean VERBOSE
      whether to output some debug information
      另请参阅:
    • USE_DYNAMIC

      public static final String USE_DYNAMIC
      name of property whether to use the dynamic approach or the old GenericObjectEditor.props file
      另请参阅:
  • 构造器详细资料

    • GenericPropertiesCreator

      public GenericPropertiesCreator() throws Exception
      initializes the creator, locates the props file with the Utils class.
      抛出:
      Exception - if loading of CREATOR_FILE fails
      另请参阅:
    • GenericPropertiesCreator

      public GenericPropertiesCreator(String filename) throws Exception
      initializes the creator, the given file overrides the props-file search of the Utils class
      参数:
      filename - the file containing the packages to create a props file from
      抛出:
      Exception - if loading of the file fails
      另请参阅:
  • 方法详细资料

    • setExplicitPropsFile

      public void setExplicitPropsFile(boolean value)
      if FALSE, the locating of a props-file of the Utils-class is used, otherwise it's tried to load the specified file
      参数:
      value - if true the specified file will be loaded not via the Utils-class
      另请参阅:
    • getExplicitPropsFile

      public boolean getExplicitPropsFile()
      returns TRUE, if a file is loaded and not the Utils class used for locating the props file.
      返回:
      true if the specified file is used and not the one found by the Utils class
      另请参阅:
    • getOutputFilename

      public String getOutputFilename()
      returns the name of the output file
      返回:
      the name of the output file
    • setOutputFilename

      public void setOutputFilename(String filename)
      sets the file to output the properties for the GEO to
      参数:
      filename - the filename for the output
    • getInputFilename

      public String getInputFilename()
      returns the name of the input file
      返回:
      the name of the input file
    • setInputFilename

      public void setInputFilename(String filename)
      sets the file to get the information about the packages from. automatically sets explicitPropsFile to TRUE.
      参数:
      filename - the filename for the input
      另请参阅:
    • getInputProperties

      public Properties getInputProperties()
      returns the input properties object (template containing the packages)
      返回:
      the input properties (the template)
    • getOutputProperties

      public Properties getOutputProperties()
      returns the output properties object (structure like the template, but filled with classes instead of packages)
      返回:
      the output properties (filled with classes)
    • useDynamic

      public boolean useDynamic()
      gets whether the dynamic approach should be used or not
      返回:
      true if the dynamic approach is to be used
    • execute

      public void execute() throws Exception
      generates the props-file for the GenericObjectEditor and stores it
      抛出:
      Exception - if something goes wrong
      另请参阅:
    • execute

      public void execute(boolean store) throws Exception
      generates the props-file for the GenericObjectEditor and stores it only if the the param store is TRUE. If it is FALSE then the generated properties file can be retrieved via the getOutputProperties method.
      参数:
      store - if TRUE then the properties file is stored to the stored filename
      抛出:
      Exception - if something goes wrong
      另请参阅:
    • main

      public static void main(String[] args) throws Exception
      for generating props file:
      • no parameter: see default constructor
      • 1 parameter (i.e., filename): see default constructor + setOutputFilename(String)
      • 2 parameters (i.e, filenames): see constructor with String argument + setOutputFilename(String)
      参数:
      args - the commandline arguments
      抛出:
      Exception - if something goes wrong
      另请参阅: