Example usage for weka.gui.beans PluginManager getPluginNamesOfType

List of usage examples for weka.gui.beans PluginManager getPluginNamesOfType

Introduction

In this page you can find the example usage for weka.gui.beans PluginManager getPluginNamesOfType.

Prototype

public static Set<String> getPluginNamesOfType(String interfaceName) 

Source Link

Document

Get a set of names of plugins that implement the supplied interface.

Usage

From source file:AbstractEvaluationMetric.java

License:Open Source License

/**
 * Gets a list of freshly instantiated concrete implementations of available
 * plugin metrics or null if there are no plugin metrics available
 * /*from ww w  .ja  va 2s.c o  m*/
 * @return a list of plugin metrics or null if there are no plugin metrics
 */
public static ArrayList<AbstractEvaluationMetric> getPluginMetrics() {
    ArrayList<AbstractEvaluationMetric> pluginMetricsList = null;
    Set<String> pluginMetrics = PluginManager.getPluginNamesOfType(AbstractEvaluationMetric.class.getName());
    if (pluginMetrics != null) {
        pluginMetricsList = new ArrayList<AbstractEvaluationMetric>();

        for (String metric : pluginMetrics) {
            try {
                Object impl = PluginManager.getPluginInstance(AbstractEvaluationMetric.class.getName(), metric);
                if (impl instanceof AbstractEvaluationMetric) {
                    pluginMetricsList.add((AbstractEvaluationMetric) impl);
                }
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
    }
    return pluginMetricsList;
}