Example usage for weka.gui ExtensionFileFilter getExtensions

List of usage examples for weka.gui ExtensionFileFilter getExtensions

Introduction

In this page you can find the example usage for weka.gui ExtensionFileFilter getExtensions.

Prototype

public String[] getExtensions() 

Source Link

Document

Returns a copy of the acceptable extensions.

Usage

From source file:meka.gui.choosers.AbstractExtensionFileFilterFileChooser.java

License:Open Source License

/**
 * Checks whether the filter uses "*.*".
 *
 * @param filter   the filter to check/*from w ww.  j  a v  a 2  s. com*/
 * @return      true if filter has extension .*
 */
public static boolean isAllFilter(ExtensionFileFilter filter) {
    for (String ext : filter.getExtensions()) {
        if (ext.endsWith("*") || ext.endsWith(".*"))
            return true;
    }
    return false;
}

From source file:meka.gui.choosers.ExtensionFileFilterComparator.java

License:Open Source License

/**
 * Compares the two filters.//  w ww  . j ava2 s .c  o m
 *
 * @param o1        the first filter
 * @param o2        the second filter
 * @return          less than 0, 0, or greater than 0, if the first filter is less than,
 *                  equal, or greater than the second one
 */
@Override
public int compare(ExtensionFileFilter o1, ExtensionFileFilter o2) {
    int result;
    int i;

    result = 0;

    for (i = 0; i < o1.getExtensions().length && i < o2.getExtensions().length; i++) {
        result = o1.getExtensions()[i].compareTo(o2.getExtensions()[i]);
        if (result != 0)
            break;
    }

    if ((result == 0) && (o1.getExtensions().length != o2.getExtensions().length))
        result = new Integer(o1.getExtensions().length).compareTo(o2.getExtensions().length);

    return result;
}