MOA 12.03
Real Time Analytics for Data Streams
FileExtensionFilter.java
Go to the documentation of this file.
00001 /*
00002  *    FileExtensionFilter.java
00003  *    Copyright (C) 2007 University of Waikato, Hamilton, New Zealand
00004  *    @author Richard Kirkby ([email protected])
00005  *
00006  *    This program is free software; you can redistribute it and/or modify
00007  *    it under the terms of the GNU General Public License as published by
00008  *    the Free Software Foundation; either version 3 of the License, or
00009  *    (at your option) any later version.
00010  *
00011  *    This program is distributed in the hope that it will be useful,
00012  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *    GNU General Public License for more details.
00015  *
00016  *    You should have received a copy of the GNU General Public License
00017  *    along with this program. If not, see <http://www.gnu.org/licenses/>.
00018  *    
00019  */
00020 package moa.gui;
00021 
00022 import java.io.File;
00023 
00024 import javax.swing.filechooser.FileFilter;
00025 
00033 public class FileExtensionFilter extends FileFilter {
00034 
00035     protected String fileExtension;
00036 
00037     public FileExtensionFilter(String extension) {
00038         this.fileExtension = extension.toLowerCase();
00039     }
00040 
00041     @Override
00042     public boolean accept(File f) {
00043         if (f != null) {
00044             if (f.isDirectory()) {
00045                 return true;
00046             }
00047             return (f.getName().toLowerCase().endsWith("." + this.fileExtension));
00048         }
00049         return false;
00050     }
00051 
00052     @Override
00053     public String getDescription() {
00054         return ("*." + this.fileExtension);
00055     }
00056 }
 All Classes Namespaces Files Functions Variables Enumerations