📄 parametertype.java
字号:
/* * YALE - Yet Another Learning Environment * Copyright (C) 2002, 2003 * Simon Fischer, Ralf Klinkenberg, Ingo Mierswa, * Katharina Morik, Oliver Ritthoff * Artificial Intelligence Unit * Computer Science Department * University of Dortmund * 44221 Dortmund, Germany * email: yale@ls8.cs.uni-dortmund.de * web: http://yale.cs.uni-dortmund.de/ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA. */package edu.udo.cs.yale.operator.parameter;import edu.udo.cs.yale.tools.LogService;/** A ParameterType holds information about type, range, and default value of a parameter. * Lists of ParameterTypes are provided by operators. * * @version $Id: ParameterType.java,v 2.3 2003/05/01 18:06:26 mierswa Exp $ * @see edu.udo.cs.yale.operator.Operator#getParameterTypes() */public abstract class ParameterType { /** The key of this parameter. */ private String key; /** The documentation. Used as tooltip text... */ private String description = "No documentation for this parameter."; /** Creates a new ParameterType. */ public ParameterType(String key, String description) { this.key = key; this.description = description; } /** Returns true if this parameter is optional. The default implementation returns true. */ public boolean isOptional() { return true; } /** Returns the key. */ public String getKey() { return key; } /** Returns a short description. */ public String getDescription() { return description; } /** Sets the short description. */ public void setDescription(String description) { this.description = description; } /** Returns a human readable description of the range. */ public abstract String getRange(); /** For single parameters the value is a String and must be converted to * an Integer, Double, Boolean or String. For lists, value already is a list. * If value is out of range, a corrected value must be returned. */ public abstract Object checkValue(Object value); /** Returns a value that can be used if the parameter is not set. */ public abstract Object getDefaultValue(); /** Returns a string representation of this value. */ public String toString(Object value) { if (value == null) return ""; else return value.toString(); } /** Can be called in order to report an illegal parameter value which is encountered during <tt>checkValue()</tt>. */ public void illegalValue(Object illegal, Object corrected) { LogService.logMessage("Illegal value '"+illegal+"' for parameter '"+key+"' has been corrected to '"+corrected.toString()+"'.", LogService.WARNING); } /** Writes an xml representation of the given key-value pair. */ public abstract String getXML(String indent, String key, Object value);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -