com.rapidminer.parameter
Class ParameterType

java.lang.Object
  extended by com.rapidminer.parameter.ParameterType
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable
Direct Known Subclasses:
CombinedParameterType, ParameterTypeConfiguration, ParameterTypePreview, ParameterTypeSingle

public abstract class ParameterType
extends java.lang.Object
implements java.lang.Comparable, java.io.Serializable

A ParameterType holds information about type, range, and default value of a parameter. Lists of ParameterTypes are provided by operators.

Author:
Ingo Mierswa, Simon Fischer
See Also:
Operator.getParameterTypes(), Serialized Form

Constructor Summary
ParameterType(java.lang.String key, java.lang.String description)
          Creates a new ParameterType.
 
Method Summary
 int compareTo(java.lang.Object o)
          ParameterTypes are compared by key.
 java.util.Collection<ParameterCondition> getConditions()
           
abstract  java.lang.Object getDefaultValue()
          Returns a value that can be used if the parameter is not set.
 java.lang.String getDefaultValueAsString()
          Returns the correct string representation of the default value.
 java.util.Collection<ParameterCondition> getDependencyConditions()
           
 java.lang.String getDescription()
          Returns a short description.
 java.lang.String getKey()
          Returns the key.
abstract  java.lang.String getRange()
          Returns a human readable description of the range.
abstract  org.w3c.dom.Element getXML(java.lang.String key, java.lang.String value, boolean hideDefault, org.w3c.dom.Document doc)
           
abstract  java.lang.String getXML(java.lang.String indent, java.lang.String key, java.lang.String value, boolean hideDefault)
          Deprecated. Use the DOM version of this method. At the moment, we cannot delete it, because Parameters.equals(Object) and Parameters.hashCode() rely on it.
 void illegalValue(java.lang.Object illegal, java.lang.Object corrected)
          Can be called in order to report an illegal parameter value which is encountered during checkValue().
 boolean isExpert()
          Returns true if this parameter can only be seen in expert mode.
 boolean isHidden()
          Returns true if this parameter is hidden or not all dependency conditions are fulfilled.
abstract  boolean isNumerical()
          Returns true if the values of this parameter type are numerical, i.e. might be parsed by Double.parseDouble(String).
 boolean isOptional()
          Returns true if this parameter is optional.
 java.lang.String notifyOperatorRenaming(java.lang.String oldOperatorName, java.lang.String newOperatorName, java.lang.String parameterValue)
          This method gives a hook for the parameter type to react on a renaming of an operator.
 void registerDependencyCondition(ParameterCondition condition)
          Registers the given dependency condition.
abstract  void setDefaultValue(java.lang.Object defaultValue)
          Sets the default value.
 void setDeprecated()
          This method indicates that this parameter is deprecated and isn't used anymore beside from loading old process files.
 void setDescription(java.lang.String description)
          Sets the short description.
 void setExpert(boolean expert)
          Sets if this parameter can be seen in expert mode (true) or beginner mode (false).
 void setHidden(boolean hidden)
          Sets if this parameter is hidden (value true) and will not be shown in the GUI.
 void setKey(java.lang.String key)
          Sets the key.
 void setShowRange(boolean showRange)
           
 boolean showRange()
           
abstract  java.lang.String substituteMacros(java.lang.String parameterValue, MacroHandler mh)
          This method operates on the internal string representation of parameter values and replaces macro expressions of the form %{macroName}.
 java.lang.String toString()
           
 java.lang.String toString(java.lang.Object value)
          Returns a string representation of this value.
 java.lang.String toXMLString(java.lang.Object value)
           
 java.lang.String transformNewValue(java.lang.String value)
          This method will be invoked by the Parameters after a parameter was set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ParameterType

public ParameterType(java.lang.String key,
                     java.lang.String description)
Creates a new ParameterType.

Method Detail

getXML

public abstract org.w3c.dom.Element getXML(java.lang.String key,
                                           java.lang.String value,
                                           boolean hideDefault,
                                           org.w3c.dom.Document doc)

getRange

public abstract java.lang.String getRange()
Returns a human readable description of the range.


getDefaultValue

public abstract java.lang.Object getDefaultValue()
Returns a value that can be used if the parameter is not set.


getDefaultValueAsString

public java.lang.String getDefaultValueAsString()
Returns the correct string representation of the default value. If the default is undefined, it returns null.


setDefaultValue

public abstract void setDefaultValue(java.lang.Object defaultValue)
Sets the default value.


isNumerical

public abstract boolean isNumerical()
Returns true if the values of this parameter type are numerical, i.e. might be parsed by Double.parseDouble(String). Otherwise false should be returned. This method might be used by parameter logging operators.


getXML

@Deprecated
public abstract java.lang.String getXML(java.lang.String indent,
                                                   java.lang.String key,
                                                   java.lang.String value,
                                                   boolean hideDefault)
Deprecated. Use the DOM version of this method. At the moment, we cannot delete it, because Parameters.equals(Object) and Parameters.hashCode() rely on it.

Writes an xml representation of the given key-value pair.


showRange

public boolean showRange()

setShowRange

public void setShowRange(boolean showRange)

transformNewValue

public java.lang.String transformNewValue(java.lang.String value)
This method will be invoked by the Parameters after a parameter was set. The default implementation is empty but subclasses might override this method, e.g. for a decryption of passwords.


isExpert

public boolean isExpert()
Returns true if this parameter can only be seen in expert mode. The default implementation returns true if the parameter is optional. Please note that this method cannot be accessed during getParameterTypes() method invocations, because it relies on getting the Parameters object, which is then not created.


setExpert

public void setExpert(boolean expert)
Sets if this parameter can be seen in expert mode (true) or beginner mode (false).


isHidden

public boolean isHidden()
Returns true if this parameter is hidden or not all dependency conditions are fulfilled. Then the parameter will not be shown in the GUI. The default implementation returns true which should be the normal case. Please note that this method cannot be accessed during getParameterTypes() method invocations, because it relies on getting the Parameters object, which is then not created.


getConditions

public java.util.Collection<ParameterCondition> getConditions()

setHidden

public void setHidden(boolean hidden)
Sets if this parameter is hidden (value true) and will not be shown in the GUI.


setDeprecated

public void setDeprecated()
This method indicates that this parameter is deprecated and isn't used anymore beside from loading old process files. Internally it simply sets the parameter to hidden, but semantically it offers the possibility to find deprecated parameters later on in order to remove them.


registerDependencyCondition

public void registerDependencyCondition(ParameterCondition condition)
Registers the given dependency condition.


getDependencyConditions

public java.util.Collection<ParameterCondition> getDependencyConditions()

isOptional

public boolean isOptional()
Returns true if this parameter is optional. The default implementation returns true. Please note that this method cannot be accessed during getParameterTypes() method invocations, because it relies on getting the Parameters object, which is then not created.


setKey

public void setKey(java.lang.String key)
Sets the key.


getKey

public java.lang.String getKey()
Returns the key.


getDescription

public java.lang.String getDescription()
Returns a short description.


setDescription

public void setDescription(java.lang.String description)
Sets the short description.


notifyOperatorRenaming

public java.lang.String notifyOperatorRenaming(java.lang.String oldOperatorName,
                                               java.lang.String newOperatorName,
                                               java.lang.String parameterValue)
This method gives a hook for the parameter type to react on a renaming of an operator. It must return the correctly modified String value. The default implementation does nothing.


toString

public java.lang.String toString(java.lang.Object value)
Returns a string representation of this value.


toXMLString

public java.lang.String toXMLString(java.lang.Object value)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

illegalValue

public void illegalValue(java.lang.Object illegal,
                         java.lang.Object corrected)
Can be called in order to report an illegal parameter value which is encountered during checkValue().


compareTo

public int compareTo(java.lang.Object o)
ParameterTypes are compared by key.

Specified by:
compareTo in interface java.lang.Comparable

substituteMacros

public abstract java.lang.String substituteMacros(java.lang.String parameterValue,
                                                  MacroHandler mh)
This method operates on the internal string representation of parameter values and replaces macro expressions of the form %{macroName}. NOTE: This method will soon be removed or changed again since the internal representation of parameter values will no longer be strings. Then, this method will accept an Object, (possibly using generics) as input.



Copyright © 2001-2009 by Rapid-I