MOA 12.03
Real Time Analytics for Data Streams
FileOption.java
Go to the documentation of this file.
00001 /*
00002  *    FileOption.java
00003  *    Copyright (C) 2007 University of Waikato, Hamilton, New Zealand
00004  *    @author Richard Kirkby (rkirkby@cs.waikato.ac.nz)
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.options;
00021 
00022 import java.io.File;
00023 
00024 import javax.swing.JComponent;
00025 
00026 import moa.gui.FileOptionEditComponent;
00027 
00034 public class FileOption extends StringOption {
00035 
00036     private static final long serialVersionUID = 1L;
00037 
00038     protected String defaultFileExtension;
00039 
00040     protected boolean isOutputFile;
00041 
00042     public FileOption(String name, char cliChar, String purpose,
00043             String defaultFileName, String defaultExtension, boolean isOutput) {
00044         super(name, cliChar, purpose, defaultFileName);
00045         this.defaultFileExtension = defaultExtension;
00046         this.isOutputFile = isOutput;
00047     }
00048 
00049     public String getDefaultFileExtension() {
00050         return this.defaultFileExtension;
00051     }
00052 
00053     public boolean isOutputFile() {
00054         return this.isOutputFile;
00055     }
00056 
00057     public File getFile() {
00058         if ((getValue() != null) && (getValue().length() > 0)) {
00059             return new File(getValue());
00060         }
00061         return null;
00062     }
00063 
00064     @Override
00065     public JComponent getEditComponent() {
00066         return new FileOptionEditComponent(this);
00067     }
00068 }
 All Classes Namespaces Files Functions Variables Enumerations