Example usage for weka.gui.beans PluginManager getPluginInstance

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

Introduction

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

Prototype

public static Object getPluginInstance(String interfaceType, String name) throws Exception 

Source Link

Document

Get an instance of a concrete implementation of a plugin type

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
 * //w  w w. ja v a  2 s  .  com
 * @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;
}