MOA 12.03
Real Time Analytics for Data Streams
|
00001 /* 00002 * StringOption.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.options; 00021 00028 public class StringOption extends AbstractOption { 00029 00030 private static final long serialVersionUID = 1L; 00031 00032 protected String currentVal; 00033 00034 protected String defaultVal; 00035 00036 public StringOption(String name, char cliChar, String purpose, 00037 String defaultVal) { 00038 super(name, cliChar, purpose); 00039 this.defaultVal = defaultVal; 00040 resetToDefault(); 00041 } 00042 00043 public void setValue(String v) { 00044 this.currentVal = v; 00045 } 00046 00047 public String getValue() { 00048 return this.currentVal; 00049 } 00050 00051 @Override 00052 public String getDefaultCLIString() { 00053 return this.defaultVal; 00054 } 00055 00056 @Override 00057 public String getValueAsCLIString() { 00058 return this.currentVal; 00059 } 00060 00061 @Override 00062 public void setValueViaCLIString(String s) { 00063 setValue(s); 00064 } 00065 }