com.rapidminer.operator
Class Operator

java.lang.Object
  extended by com.rapidminer.tools.AbstractObservable<Operator>
      extended by com.rapidminer.operator.Operator
All Implemented Interfaces:
ConfigurationListener, PreviewListener, ResourceConsumer, ParameterHandler, LoggingHandler, Observable<Operator>
Direct Known Subclasses:
AbstractClusterer, AbstractExampleSetEvaluator, AbstractExampleSetJoin, AbstractExampleSetProcessing, AbstractLearner, AbstractPairwiseMatrixOperator, AbstractPerformanceEvaluator, AbstractReader, AbstractRepositoryManagerOperator, AbstractWeighting, AbstractWriter, AgglomerativeClustering, ANOVAMatrixOperator, AssociationRuleGenerator, AssociationRulesApplier, AttributeConstructionsLoader, AttributeWeights2ExampleSet, AttributeWeightsApplier, AverageBuilder, CentroidBasedEvaluator, ClearProcessLog, ClusterDensityEvaluator, ClusterModel2ExampleSet, ClusterNumberEvaluator, ClusterToPrediction, CollectionOperator, CommandLineOperator, ConsolePrintOperator, CorrelationMatrixOperator, CostEvaluator, CovarianceMatrixOperator, CrossDistancesOperator, Data2Log, DatabaseExampleVisualizationOperator, DataMacroDefinitionOperator, DataStatisticsOperator, DelayOperator, DenormalizationOperator, DimensionalityReducer, DummyOperator, ExampleDistributionEvaluator, ExampleSet2ClusterModel, ExampleSet2Similarity, ExampleSet2SimilarityExampleSet, ExampleSetMerge, ExampleSetSuperset, ExampleSetUnion, ExtractClusterPrototypes, FastICA, FileEchoOperator, FlattenClusterModel, ForestBasedWeighting, FormulaExtractor, FPGrowth, FrequentItemSetAttributeCreator, FrequentItemSetsToData, FrequentItemSetUnificator, GHA, GNUPlotOperator, GroupByOperator, GroupedANOVAOperator, GSPOperator, InteractiveAttributeWeighting, IOConsumeOperator, IOContainerReader, IOContainerWriter, IOMerger, IOMultiplier, IOMultiplyOperator, IOObjectWriter, IORetrievalOperator, IOSelectOperator, IOStorageOperator, KernelPCA, LiftChartGenerator, LiftParetoChartGenerator, LoadFileOperator, LocalPolynomialExampleWeightingOperator, Macro2Log, MacroConstructionOperator, MacroDefinitionOperator, MemoryCleanUp, MinMaxWrapper, ModelApplier, ModelGrouper, ModelUngrouper, ModelUpdater, OperatorChain, ParameterCloner, ParameterSetter, PartitionOperator, PCA, PlattScaling, ProcessEmbeddingOperator, ProcessLog2AttributeWeights, ProcessLog2ExampleSet, ProcessLogOperator, RainflowMatrixOperator, RankingEvaluator, RecallChooser, ResultWriter, ROCChartGenerator, ScriptingOperator, SelectionOperator, SendMailOperator, SignificanceTestOperator, Similarity2ExampleSet, SingleMacroDefinitionOperator, SOMDimensionalityReduction, SOMModelVisualization, SQLExecution, SupportVectorCounter, SVDReduction, ThresholdApplier, ThresholdFinder, TransitionGraphOperator, TransitionMatrixOperator, UnfoldOperator, UnsetMacroOperator, WeightedPerformanceCreator, WriteFileOperator

public abstract class Operator
extends AbstractObservable<Operator>
implements ConfigurationListener, PreviewListener, LoggingHandler, ParameterHandler, ResourceConsumer

An operator accepts an array of input objects and generates an array of output objects that can be processed by other operators. Both must implement the IOObject interface. This is the superclass which must be extended by all RapidMiner operators. Please refer to the RapidMiner tutorial for a detailed description how to implement your operator.

As default, operators consume their input by using it. This is often a useful behavior especially in complex processes. For example, a learning operator consumes an example set to produce a model and so does a cross validation to produce a performance value of the learning method. To receive the input IOObject of a certain class simply use getInput(Class class). This method delivers the first object of the desired class which is in the input of this operator. The delivered object is consumed afterwards and thus is removed from input. If the operator alters this object, it should return the altered object as output again. Therefore, you have to add the object to the output array which is delivered by the apply() method of the operator. You also have to declare it in getOutputClasses(). All input objects which are not used by your operator will be automatically passed to the next operators.

In some cases it would be useful if the user can define if the input object should be consumed or not. For example, a validation chain like cross validation should estimate the performance but should also be able to return the example set which is then used to learn the overall model. Operators can change the default behavior for input consumption and a parameter will be automatically defined and queried. The default behavior is defined in the method getInputDescription(Class cls) and should be overridden in these cases. Please note that input objects with a changed input description must not be defined in getOutputClasses() and must not be returned at the end of apply. Both is automatically done with respect to the value of the automatically created parameter. Please refer to the Javadoc comments of this method for further explanations.

Author:
Ralf Klinkenberg, Ingo Mierswa, Simon Fischer
See Also:
OperatorChain

Constructor Summary
Operator(OperatorDescription description)
           Creates an unnamed operator.
 
Method Summary
 boolean acceptsInput(java.lang.Class<? extends IOObject> inputClass)
          Returns true if this operator contains at least one InputPort which accepts an input of the given class (loose checking).
 void addError(ProcessSetupError error)
           
 void addError(java.lang.String message)
          Deprecated. Use addError(ProcessSetupError)
 void addValue(Value value)
          Adds an implementation of Value.
 void addWarning(java.lang.String message)
          Deprecated. Use addError(ProcessSetupError) *
 IOObject[] apply()
          Deprecated. use doWork()
 IOContainer apply(IOContainer input)
          Deprecated. use execute()
 void assumePreconditionsSatisfied()
          Assumes that all preconditions are satisfied.
 void checkAll()
          Clears all errors, checks the operator and its children and propagates meta data, propgatates dirtyness and sorts execution order.
 void checkAllExcludingMetaData()
          As check all, but does not check the meta data for performance reasons.
 int checkDeprecations()
          Will count the number of deprecated operators, i.e. the operators which getDeprecationInfo() method does not return null.
 void checkForStop()
          This method should be called within long running loops of an operator to check if the user has canceled the execution in the mean while.
 java.lang.Class<?>[] checkIO(java.lang.Class<?>[] input)
          Deprecated. As of version 5.0, this method is no longer necessary.
 int checkProperties()
          Will count an error if a non optional property has no default value and is not defined by user.
 void clear(int clearFlags)
          Clears output and input ports.
 void clearErrorList()
          Clears the list of errors.
 Operator cloneOperator(java.lang.String name, boolean forParallelExecution)
          Performs a deep clone on the most parts of this operator.
protected  void collectErrors(java.util.List<ProcessSetupError> errors)
           
 java.lang.String createExperimentTree(int indent)
          Deprecated. Use createProcessTree(int) instead
protected  java.lang.String createExperimentTree(int indent, java.lang.String selfPrefix, java.lang.String childPrefix, Operator markOperator, java.lang.String mark)
          Deprecated. Use createProcessTree(int,String,String,Operator,String) instead
static Operator createFromXML(org.w3c.dom.Element element, Process targetProcess, java.util.List<UnknownParameterInformation> unknownParameterInformation)
           
static Operator createFromXML(org.w3c.dom.Element element, Process process, java.util.List<UnknownParameterInformation> unknownParameterInformation, ProgressListener l)
          This will create an operator by interpreting the given XML element as being generated from the current RapidMiner version.
static Operator createFromXML(org.w3c.dom.Element element, Process process, java.util.List<UnknownParameterInformation> unknownParameterInformation, ProgressListener progressListener, VersionNumber originatingVersion)
          This will create an operator from a XML element describing this operator.
 java.lang.String createMarkedExperimentTree(int indent, java.lang.String mark, Operator markOperator)
          Deprecated. Use createMarkedProcessTree(int,String,Operator) instead
 java.lang.String createMarkedProcessTree(int indent, java.lang.String mark, Operator markOperator)
          Returns this operator's name and class.
 java.lang.String createProcessTree(int indent)
          Returns this operator's name and class.
protected  java.lang.String createProcessTree(int indent, java.lang.String selfPrefix, java.lang.String childPrefix, Operator markOperator, java.lang.String mark)
          Returns this operator's name and class.
 void disconnectPorts()
          This method will disconnect all ports from as well the input ports as well as the outputports.
 void doWork()
          Performs the actual work of the operator and must be implemented by subclasses.
 void execute()
          Applies the operator.
protected  void fireUpdate(Operator operator)
          Updates all observers with the given argument.
 void freeMemory()
          Releases of any resources held by this operator due since its execution.
 boolean getAddOnlyAdditionalOutput()
          Deprecated.  
 int getApplyCount()
          Returns the number of times this operator was already applied.
 OperatorVersion getCompatibilityLevel()
           
protected  java.lang.Class<?>[] getDeliveredOutputClasses()
          Returns the classes that are guaranteed to be returned by apply().
 java.lang.String getDeprecationInfo()
          Deprecated. Use getOperatorDescription().getDeprecationInfo()
protected  java.lang.Class<?>[] getDesiredInputClasses()
          Returns the classes that are needed as input.
 org.w3c.dom.Document getDOMRepresentation()
          This returns this operator with all its parameter settings as a Document
 java.nio.charset.Charset getEncoding()
          Deprecated. This method is rubbish. Use the Encoding to add a custom encoding parameter to this operator.
 java.util.List<ProcessSetupError> getErrorList()
          Returns a List of Strings containing error messages.
 ExecutionUnit getExecutionUnit()
          Returns the ExecutionUnit that contains this operator.
 Process getExperiment()
          Deprecated. Please use getProcess() instead
 OperatorVersion[] getIncompatibleVersionChanges()
          Returns the versions of an operator after which its behavior incompatibly changed in ascending order.
protected  IOContainer getInput()
          Deprecated. Use getInputPorts()
protected
<T extends IOObject>
T
getInput(java.lang.Class<T> cls)
          Deprecated. Use input ports
protected
<T extends IOObject>
T
getInput(java.lang.Class<T> cls, int nr)
          Deprecated. use the input ports directly
 java.lang.Class<?>[] getInputClasses()
          Deprecated. create input ports instead
protected  InputDescription getInputDescription(java.lang.Class<?> inputClass)
          Deprecated.  
 InputPorts getInputPorts()
          This method returns the InputPorts object that gives access to all defined InputPorts of this operator.
protected  IODescription getIODescription()
          Deprecated. As of version 5.0, this method is no longer necessary.
 LoggingHandler getLog()
          Returns the logging of the process if this operator is part of an process and the global logging service otherwise.
 java.util.logging.Logger getLogger()
           
 java.lang.String getName()
          Returns the name of the operator.
 int getNumberOfBreakpoints()
          This returns the number of breakpoints: 0, 1 or 2.
 java.lang.String getOperatorClassName()
          Returns the "class name" of this operator from the operator description of the operator.
 OperatorDescription getOperatorDescription()
          Returns the operator description of this operator.
 java.lang.Class<?>[] getOutputClasses()
          Deprecated. create output ports
 OutputPorts getOutputPorts()
          This method returns the OutputPorts object that gives access to all defined OutputPorts of this operator.
 java.lang.String getParameter(java.lang.String key)
          Returns a single parameter retrieved from the Parameters of this Operator.
 boolean getParameterAsBoolean(java.lang.String key)
          Returns a single named parameter and casts it to boolean.
 char getParameterAsChar(java.lang.String key)
          Returns a single named parameter and casts it to char.
 java.awt.Color getParameterAsColor(java.lang.String key)
          Returns a single named parameter and casts it to Color.
 double getParameterAsDouble(java.lang.String key)
          Returns a single named parameter and casts it to double.
 java.io.File getParameterAsFile(java.lang.String key)
          Returns a single named parameter and casts it to File.
 java.io.File getParameterAsFile(java.lang.String key, boolean createMissingDirectories)
          Returns a single named parameter and casts it to File.
 java.io.InputStream getParameterAsInputStream(java.lang.String key)
          Returns a single named parameter and tries to handle it as URL.
 int getParameterAsInt(java.lang.String key)
          Returns a single named parameter and casts it to int.
 double[][] getParameterAsMatrix(java.lang.String key)
          Returns a single named parameter and casts it to a double matrix.
 RepositoryLocation getParameterAsRepositoryLocation(java.lang.String key)
          This method returns the parameter identified by key as a RepositoryLocation.
 java.lang.String getParameterAsString(java.lang.String key)
          Returns a single named parameter and casts it to String.
 ParameterHandler getParameterHandler()
           
 java.util.List<java.lang.String[]> getParameterList(java.lang.String key)
          Returns a single named parameter and casts it to List.
 Parameters getParameters()
          Returns a collection of all parameters of this operator.
 java.lang.String[] getParameterTupel(java.lang.String key)
          Returns a Pair of Strings, the Strings are in the order of type definition of the subtypes.
 ParameterType getParameterType(java.lang.String name)
          Returns the parameter type with the given name.
 java.util.List<ParameterType> getParameterTypes()
          Returns a list of ParameterTypes describing the parameters of this operator.
 OperatorChain getParent()
          Returns the operator containing the enclosing process or null if this is the root operator.
 PortOwner getPortOwner()
          This returns the PortOwner of this operator.
 Process getProcess()
          Returns the process of this operator by asking the parent operator.
 ResourceConsumptionEstimator getResourceConsumptionEstimator()
          Subclasses can override this method if they are able to estimate the consumed resources (CPU time and memory), based on their input.
 Operator getRoot()
          Returns the first ancestor that does not have a parent.
 long getStartTime()
          Returns the system time when the operator was started.
protected  MDTransformer getTransformer()
          This method returns the MDTransformer object of this operator.
 java.lang.String getUserDescription()
          The user specified comment for this operator.
 Value getValue(java.lang.String key)
          Returns the value of the Value with the given key.
 java.util.Collection<Value> getValues()
          Returns all Values sorted by key.
 java.lang.String getXML(boolean hideDefault)
          Same as getXML(hideDefault, false).
 java.lang.String getXML(boolean hideDefault, boolean onlyCoreElements)
          Returns the XML representation of this operator.
 java.lang.String getXML(java.lang.String indent, boolean hideDefault)
          Deprecated. indent is not used any more. Use getXML(boolean).
 boolean hasBreakpoint()
          Returns true iff this operator has a breakpoint at any possible position.
 boolean hasBreakpoint(int position)
          Returns true iff a breakpoint is set at the given position
protected  boolean hasInput(java.lang.Class<? extends IOObject> cls)
          Deprecated. use the input ports directly
 void inApplyLoop()
          Should be called if this operator performs a loop (for the loop time resetting used for Value creation used by DataTables).
 boolean isDebugMode()
           
 boolean isDirty()
          Returns whether the results on the output ports of this operator are dirty.
 boolean isEnabled()
          Returns true if this operator is enabled and the parent (if not null) is also enabled.
 boolean isExpanded()
          Returns true if this operator should be painted expanded.
 boolean isParallel()
          This method must return true if the operator performs parallel execution of child operators and false otherwise.
 boolean isParameterSet(java.lang.String key)
          Returns true iff the parameter with the given name is set.
 boolean isRunning()
          Returns if this operators execute() method is currently executed.
 void log(java.lang.String message)
          Logs a status message.
 void log(java.lang.String message, int level)
          Logs a message with the given log level.
 void logError(java.lang.String message)
          Logs an error message.
 void logNote(java.lang.String message)
          Logs a note message.
 void logWarning(java.lang.String message)
          Logs a warning message.
protected  Operator lookupOperator(java.lang.String operatorName)
          Looks up an operator with the given name in the containing process.
 void makeDirty()
          This method will flag this operator's results as dirty.
protected  void makeDirtyOnUpdate(Observable<? extends java.lang.Object> observable)
          Observes the given Observable and sets this operators dirty flag to true upon any update.
 void notifyRenaming(java.lang.String oldName, java.lang.String newName)
          This method is called when the operator with "oldName" is renamed to "newName".
protected  void performAdditionalChecks()
          This method is invoked during the validation checks.
protected  java.util.LinkedList<OutputPort> preAutoWire(java.util.LinkedList<OutputPort> readyOutputs)
          This method is called before auto-wiring an operator.
 void processFinished()
          Called at the end of the process.
 void processStarts()
          Called when the process starts.
 boolean producesOutput(java.lang.Class<? extends IOObject> outputClass)
          Returns true if this operator contains at least one OutputPort provided that its input ports are satisfied.
protected  void propagateDirtyness()
           
 void register(Process process, java.lang.String name)
          Deprecated. No longer necessary since the registering / unregistering will be performed during operator adding
protected  void registerOperator(Process process)
          Registers this operator in the given process.
 void remove()
          Removes this operator from its parent.
 void removeAndKeepConnections(java.util.List<Operator> keepConnectionsTo)
           
 java.lang.String rename(java.lang.String newName)
          This method unregisters the old name if this operator is already part of a Process.
 void resume()
          Deprecated. Use Process.resume()
 void setBreakpoint(int position, boolean on)
          Sets or clears a breakpoint at the given position.
 void setCompatibilityLevel(OperatorVersion compatibilityLevel)
           
 void setEnabled(boolean enabled)
          Sets the activation mode.
protected  void setEnclosingProcess(ExecutionUnit parent)
           
 void setExpanded(boolean expanded)
          Sets the expansion mode which indicates if this operator is drawn expanded or not.
protected  void setInput(IOContainer input)
          Deprecated. use the ports
 void setListParameter(java.lang.String key, java.util.List<java.lang.String[]> list)
          Sets the given parameter list to the Parameters object of this operator.
 void setPairParameter(java.lang.String key, java.lang.String firstValue, java.lang.String secondValue)
           
 void setParameter(java.lang.String key, java.lang.String value)
          Sets the given single parameter to the Parameters object of this operator.
 void setParameters(Parameters parameters)
          Sets all parameters of this operator.
 void setUserDescription(java.lang.String description)
          Sets the user specified comment for this operator.
 boolean shouldAutoConnect(InputPort inputPort)
           
 boolean shouldAutoConnect(OutputPort outputPort)
          By default, all ports will be auto-connected by ExecutionUnit.autoWire(CompatibilityLevel, boolean, boolean).
 void shouldStopStandaloneExecution()
          This method will cause the execution of this operator to stop at the next call of checkForStop() in the executing thread.
 java.lang.String toString()
          Returns the name.
 void transformMetaData()
          If this method is called for perform the meta data transformation on this operator.
protected  void unregisterOperator(Process process)
          Deletes this operator removing it from the name map of the process.
 void updateExecutionOrder()
           
 void walk(Visitor<Operator> visitor)
          Visitor pattern visiting all operators in subprocesses and the operator itself.
 void writeXML(java.io.Writer out, boolean hideDefault)
          This will report this operator with all its parameter settings to the given writer as XML.
 void writeXML(java.io.Writer out, java.lang.String indent, boolean hideDefault)
          Deprecated. indent is not considered any more. Use writeXML(Writer, boolean)
 
Methods inherited from class com.rapidminer.tools.AbstractObservable
addObserver, addObserverAsFirst, fireUpdate, removeObserver
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Operator

public Operator(OperatorDescription description)

Creates an unnamed operator. Subclasses must pass the given description object to this super-constructor (i.e. invoking super(OperatorDescription)). They might also add additional values for process logging.

NOTE: the preferred way for operator creation is using one of the factory methods of OperatorService.

Method Detail

makeDirtyOnUpdate

protected void makeDirtyOnUpdate(Observable<? extends java.lang.Object> observable)
Observes the given Observable and sets this operators dirty flag to true upon any update.


getOperatorDescription

public final OperatorDescription getOperatorDescription()
Returns the operator description of this operator.


getOperatorClassName

public final java.lang.String getOperatorClassName()
Returns the "class name" of this operator from the operator description of the operator. This is the name which is defined in the operator.xml file.


getExperiment

@Deprecated
public Process getExperiment()
Deprecated. Please use getProcess() instead

Returns the experiment (process) of this operator by asking the parent operator. If the operator itself and all of its parents are not part of an process, this method will return null. Please note that some operators (e.g. ProcessLog) must be part of an process in order to work properly.


getProcess

public Process getProcess()
Returns the process of this operator by asking the parent operator. If the operator itself and all of its parents are not part of an process, this method will return null. Please note that some operators (e.g. ProcessLog) must be part of an process in order to work properly.

Specified by:
getProcess in interface ConfigurationListener
Specified by:
getProcess in interface PreviewListener

getLog

public LoggingHandler getLog()
Returns the logging of the process if this operator is part of an process and the global logging service otherwise.


getLogger

public java.util.logging.Logger getLogger()

log

public void log(java.lang.String message,
                int level)
Description copied from interface: LoggingHandler
Logs a message with the given log level.

Specified by:
log in interface LoggingHandler

log

public void log(java.lang.String message)
Description copied from interface: LoggingHandler
Logs a status message.

Specified by:
log in interface LoggingHandler

logNote

public void logNote(java.lang.String message)
Description copied from interface: LoggingHandler
Logs a note message.

Specified by:
logNote in interface LoggingHandler

logWarning

public void logWarning(java.lang.String message)
Description copied from interface: LoggingHandler
Logs a warning message.

Specified by:
logWarning in interface LoggingHandler

logError

public void logError(java.lang.String message)
Description copied from interface: LoggingHandler
Logs an error message.

Specified by:
logError in interface LoggingHandler

getName

public final java.lang.String getName()
Returns the name of the operator.


rename

public final java.lang.String rename(java.lang.String newName)
This method unregisters the old name if this operator is already part of a Process. Afterwards, the new name is set and registered in the process. Please note that the name might be changed during registering in order to ensure that each operator name is unique in its process. The new name will be returned.


setUserDescription

public void setUserDescription(java.lang.String description)
Sets the user specified comment for this operator.


getUserDescription

public java.lang.String getUserDescription()
The user specified comment for this operator.


getDeprecationInfo

@Deprecated
public final java.lang.String getDeprecationInfo()
Deprecated. Use getOperatorDescription().getDeprecationInfo()

Returns null if this operator is not deprecated. This implementation returns the return value of OperatorDescription.getDeprecationInfo() which is usually null. If a non-null value is returned this should describe a a workaround for a user. In this case the workaround is displayed during the validation of the process.


removeAndKeepConnections

public void removeAndKeepConnections(java.util.List<Operator> keepConnectionsTo)

remove

public void remove()
Removes this operator from its parent.


register

@Deprecated
public void register(Process process,
                                java.lang.String name)
Deprecated. No longer necessary since the registering / unregistering will be performed during operator adding

This methods was used in older RapidMiner version for registering the operator in the process and to ensure that all operator names are unique. This is now automatically done during operator adding and therefore this method is now deprecated.


registerOperator

protected void registerOperator(Process process)
Registers this operator in the given process. Please note that this might change the name of the operator.


unregisterOperator

protected void unregisterOperator(Process process)
Deletes this operator removing it from the name map of the process.


setEnabled

public void setEnabled(boolean enabled)
Sets the activation mode. Inactive operators do not perform their action.


setExpanded

public void setExpanded(boolean expanded)
Sets the expansion mode which indicates if this operator is drawn expanded or not.


isExpanded

public boolean isExpanded()
Returns true if this operator should be painted expanded.


isEnabled

public boolean isEnabled()
Returns true if this operator is enabled and the parent (if not null) is also enabled.


isParallel

public boolean isParallel()
This method must return true if the operator performs parallel execution of child operators and false otherwise.


getApplyCount

public int getApplyCount()
Returns the number of times this operator was already applied.


cloneOperator

public Operator cloneOperator(java.lang.String name,
                              boolean forParallelExecution)
Performs a deep clone on the most parts of this operator. The breakpointThread is empty (as it is in initialization). The parent will be clone in the method of OperatorChain overwriting this one. The in- and output containers and the error list are only cloned by reference copying. Use this method only if you are sure what you are doing.

Parameters:
name - This parameter is not used at all.

apply

@Deprecated
public IOObject[] apply()
                 throws OperatorException
Deprecated. use doWork()

Implement this method in subclasses.

Throws:
OperatorException

doWork

public void doWork()
            throws OperatorException
Performs the actual work of the operator and must be implemented by subclasses. Replaces the old method apply().

Throws:
OperatorException

getInputClasses

@Deprecated
public java.lang.Class<?>[] getInputClasses()
Deprecated. create input ports instead

Returns the classes that are needed as input. May be null or an empty (no desired input). As default, all delivered input objects are consumed and must be also delivered as output in both getOutputClasses() and apply() if this is necessary. This default behavior can be changed by overriding getInputDescription(Class). Subclasses which implement this method should not make use of parameters since this method is invoked by getParameterTypes(). Therefore, parameters are not fully available at this point of time and this might lead to exceptions. Please use InputDescriptions instead.


getOutputClasses

@Deprecated
public java.lang.Class<?>[] getOutputClasses()
Deprecated. create output ports

Returns the classes that are guaranteed to be returned by apply() as additional output. Please note that input objects which should not be consumed must also be defined by this method (e.g. an example set which is changed but not consumed in the case of a preprocessing operator must be defined in both, the methods getInputClasses() and getOutputClasses()). The default behavior for input consumation is defined by getInputDescription(Class) and can be changed by overwriting this method. Objects which are not consumed (defined by changing the implementation in getInputDescription(Class)) must not be defined as additional output in this method.

May deliver null or an empy array (no additional output is produced or guaranteed). Must return the class array of delivered output objects otherwise.


getDesiredInputClasses

protected final java.lang.Class<?>[] getDesiredInputClasses()
Returns the classes that are needed as input. Returns the result of getInputClasses().


getDeliveredOutputClasses

protected final java.lang.Class<?>[] getDeliveredOutputClasses()
Returns the classes that are guaranteed to be returned by apply(). These are all input classes which are not consumed and all guaranteed additional output classes.


getInputDescription

@Deprecated
protected InputDescription getInputDescription(java.lang.Class<?> inputClass)
Deprecated. 

The default implementation returns an input description that consumes the input IOObject without a user parameter. Subclasses may override this method to allow other input handling behaviors.


getIODescription

@Deprecated
protected IODescription getIODescription()
Deprecated. As of version 5.0, this method is no longer necessary.

If you find the getInputClasses() and getOuputClasses() methods for some reason not useful, you may override this method. Otherwise it returns a default IODescription containing the classes returned by the first.


checkIO

@Deprecated
public java.lang.Class<?>[] checkIO(java.lang.Class<?>[] input)
                             throws IllegalInputException,
                                    WrongNumberOfInnerOperatorsException
Deprecated. As of version 5.0, this method is no longer necessary.

Subclasses will throw an exception if something isn't ok. Returns the output that this operator returns when provided with the given input.

Throws:
IllegalInputException
WrongNumberOfInnerOperatorsException

performAdditionalChecks

protected void performAdditionalChecks()
This method is invoked during the validation checks. It is invoked as a last check. The default implementation does nothing. Subclasses might want to override this method to perform some specialized checks, e.g. if an inner operator is of a specific class.


checkProperties

public int checkProperties()
Will count an error if a non optional property has no default value and is not defined by user. Returns the total number of errors.


checkDeprecations

public int checkDeprecations()
Will count the number of deprecated operators, i.e. the operators which getDeprecationInfo() method does not return null. Returns the total number of deprecations.


apply

@Deprecated
public final IOContainer apply(IOContainer input)
                        throws OperatorException
Deprecated. use execute()

Throws:
OperatorException

execute

public final void execute()
                   throws OperatorException
Applies the operator. Don't override this method, but doWork()

Throws:
OperatorException

checkForStop

public final void checkForStop()
                        throws ProcessStoppedException
This method should be called within long running loops of an operator to check if the user has canceled the execution in the mean while. This then will throw a ProcessStoppedException to cancel the execution.

Throws:
ProcessStoppedException

shouldStopStandaloneExecution

public final void shouldStopStandaloneExecution()
                                         throws ProcessStoppedException
This method will cause the execution of this operator to stop at the next call of checkForStop() in the executing thread. When this will be depends on the operator. Some operations like huge matrix inversions cannot be aborted prematurely at all. A ProcessStoppedException will be thrown in case of stopping, so prepare to catch it when executing the operator. Please keep in mind, that this method will have an effect only if the operator is executed without a process context directly from the API.

Throws:
ProcessStoppedException

resume

@Deprecated
public final void resume()
Deprecated. Use Process.resume()

This method should only be called by the command line breakpoint listener to resume the process after a breakpoint.


getAddOnlyAdditionalOutput

@Deprecated
public boolean getAddOnlyAdditionalOutput()
Deprecated. 

Indicates how additional output should be added to the IOContainer. Usually the additional output should be preprended to the input container but some operators, especially operator chains might override this method in order add only the additional output instead of the complete IOContainer. This prevents doubling the IOObjects e.g. for SimpleOperatorChains. The default implementation returns false.


getInput

@Deprecated
protected <T extends IOObject> T getInput(java.lang.Class<T> cls)
                               throws MissingIOObjectException
Deprecated. Use input ports

Returns an IOObject of class cls. The object is removed from the input IOContainer if the input description defines this behavior (default).

Throws:
MissingIOObjectException

getInput

@Deprecated
protected <T extends IOObject> T getInput(java.lang.Class<T> cls,
                                                     int nr)
                               throws MissingIOObjectException
Deprecated. use the input ports directly

Returns the nr-th IOObject of class cls. The object is removed from the input IOContainer if the input description defines this behavior (default).

Throws:
MissingIOObjectException

hasInput

@Deprecated
protected boolean hasInput(java.lang.Class<? extends IOObject> cls)
Deprecated. use the input ports directly

Returns true if this operator has an input object of the desired class. The object will not be removed by using this method.


getInput

@Deprecated
protected final IOContainer getInput()
Deprecated. Use getInputPorts()

Returns the complete input. Operators should usually not directly use this method but should use getInput(Class). However, some operator chains must handle their inner input and have to use the IOContainer directly.


setInput

@Deprecated
protected void setInput(IOContainer input)
Deprecated. use the ports

ATTENTION: Use this method only if you are ABSOLUTELY sure what you are doing! This method might be useful for some meta optimization operators but wrong usage can cause serious errors.


processStarts

public void processStarts()
                   throws OperatorException
Called when the process starts. Resets all counters.

Throws:
OperatorException

processFinished

public void processFinished()
                     throws OperatorException
Called at the end of the process. The default implementation does nothing.

Throws:
OperatorException

setBreakpoint

public void setBreakpoint(int position,
                          boolean on)
Sets or clears a breakpoint at the given position.

Parameters:
position - One out of BREAKPOINT_BEFORE and BREAKPOINT_AFTER

hasBreakpoint

public boolean hasBreakpoint()
Returns true iff this operator has a breakpoint at any possible position.


hasBreakpoint

public boolean hasBreakpoint(int position)
Returns true iff a breakpoint is set at the given position

Parameters:
position - One out of BREAKPOINT_BEFORE and BREAKPOINT_AFTER

inApplyLoop

public void inApplyLoop()
                 throws ProcessStoppedException
Should be called if this operator performs a loop (for the loop time resetting used for Value creation used by DataTables). This method also invokes checkForStop().

Throws:
ProcessStoppedException

addValue

public void addValue(Value value)
Adds an implementation of Value.


getValue

public final Value getValue(java.lang.String key)
Returns the value of the Value with the given key.


getValues

public java.util.Collection<Value> getValues()
Returns all Values sorted by key.


getParameters

public Parameters getParameters()
Returns a collection of all parameters of this operator. If the parameters object has not been created yet, it will now be created. Creation had to be moved out of constructor for meta data handling in subclasses needing a port.

Specified by:
getParameters in interface ConfigurationListener
Specified by:
getParameters in interface PreviewListener
Specified by:
getParameters in interface ParameterHandler

getParameterHandler

public ParameterHandler getParameterHandler()
Specified by:
getParameterHandler in interface PreviewListener

setParameters

public void setParameters(Parameters parameters)
Sets all parameters of this operator. The given parameters are not allowed to be null and must correspond to the parameter types defined by this operator.

Specified by:
setParameters in interface ConfigurationListener
Specified by:
setParameters in interface ParameterHandler

setParameter

public void setParameter(java.lang.String key,
                         java.lang.String value)
Sets the given single parameter to the Parameters object of this operator. For parameter list the method setListParameter(String, List) should be used.

Specified by:
setParameter in interface ParameterHandler

setListParameter

public void setListParameter(java.lang.String key,
                             java.util.List<java.lang.String[]> list)
Sets the given parameter list to the Parameters object of this operator. For single parameters the method setParameter(String, String) should be used.

Specified by:
setListParameter in interface ParameterHandler

setPairParameter

public void setPairParameter(java.lang.String key,
                             java.lang.String firstValue,
                             java.lang.String secondValue)

getParameter

public java.lang.String getParameter(java.lang.String key)
                              throws UndefinedParameterError
Returns a single parameter retrieved from the Parameters of this Operator.

Specified by:
getParameter in interface ParameterHandler
Throws:
UndefinedParameterError

isParameterSet

public boolean isParameterSet(java.lang.String key)
Returns true iff the parameter with the given name is set. If no parameters object has been created yet, false is returned. This can be used to break initialization loops.

Specified by:
isParameterSet in interface ParameterHandler

getParameterAsString

public java.lang.String getParameterAsString(java.lang.String key)
                                      throws UndefinedParameterError
Returns a single named parameter and casts it to String.

Specified by:
getParameterAsString in interface ParameterHandler
Throws:
UndefinedParameterError

getParameterAsChar

public char getParameterAsChar(java.lang.String key)
                        throws UndefinedParameterError
Returns a single named parameter and casts it to char.

Specified by:
getParameterAsChar in interface ParameterHandler
Throws:
UndefinedParameterError

getParameterAsInt

public int getParameterAsInt(java.lang.String key)
                      throws UndefinedParameterError
Returns a single named parameter and casts it to int.

Specified by:
getParameterAsInt in interface ParameterHandler
Throws:
UndefinedParameterError

getParameterAsDouble

public double getParameterAsDouble(java.lang.String key)
                            throws UndefinedParameterError
Returns a single named parameter and casts it to double.

Specified by:
getParameterAsDouble in interface ParameterHandler
Throws:
UndefinedParameterError

getParameterAsBoolean

public boolean getParameterAsBoolean(java.lang.String key)
Returns a single named parameter and casts it to boolean. This method never throws an exception since there are no non-optional boolean parameters.

Specified by:
getParameterAsBoolean in interface ParameterHandler

getParameterList

public java.util.List<java.lang.String[]> getParameterList(java.lang.String key)
                                                    throws UndefinedParameterError
Returns a single named parameter and casts it to List. The list returned by this method contains the user defined key-value pairs. Each element is a String array of length 2. The first element is the key, the second the parameter value. The caller have to perform the casts to the correct types himself.

Specified by:
getParameterList in interface ParameterHandler
Throws:
UndefinedParameterError

getParameterTupel

public java.lang.String[] getParameterTupel(java.lang.String key)
                                     throws UndefinedParameterError
Returns a Pair of Strings, the Strings are in the order of type definition of the subtypes.

Specified by:
getParameterTupel in interface ParameterHandler
Throws:
UndefinedParameterError

getParameterAsColor

public java.awt.Color getParameterAsColor(java.lang.String key)
                                   throws UndefinedParameterError
Returns a single named parameter and casts it to Color.

Specified by:
getParameterAsColor in interface ParameterHandler
Throws:
UndefinedParameterError

getParameterAsInputStream

public java.io.InputStream getParameterAsInputStream(java.lang.String key)
                                              throws UndefinedParameterError,
                                                     java.io.IOException
Returns a single named parameter and tries to handle it as URL. If this works, this method creates an input stream from this URL and delivers it. If not, this method tries to cast the parameter value to a file. This file is already resolved against the process definition file. If the parameter name defines a non-optional parameter which is not set and has no default value, a UndefinedParameterError will be thrown. If the parameter is optional and was not set this method returns null. Operators should always use this method instead of directly using the method Process.resolveFileName(String).

Specified by:
getParameterAsInputStream in interface ParameterHandler
Throws:
UndefinedParameterError
java.io.IOException

getParameterAsFile

public java.io.File getParameterAsFile(java.lang.String key)
                                throws UndefinedParameterError
Returns a single named parameter and casts it to File. This file is already resolved against the process definition file but missing directories will not be created. If the parameter name defines a non-optional parameter which is not set and has no default value, a UndefinedParameterError will be thrown. If the parameter is optional and was not set this method returns null. Operators should always use this method instead of directly using the method Process.resolveFileName(String).

Specified by:
getParameterAsFile in interface ParameterHandler
Throws:
UndefinedParameterError

getParameterAsFile

public java.io.File getParameterAsFile(java.lang.String key,
                                       boolean createMissingDirectories)
                                throws UndefinedParameterError
Returns a single named parameter and casts it to File. This file is already resolved against the process definition file and missing directories will be created. If the parameter name defines a non-optional parameter which is not set and has no default value, a UndefinedParameterError will be thrown. If the parameter is optional and was not set this method returns null. Operators should always use this method instead of directly using the method Process.resolveFileName(String).

Specified by:
getParameterAsFile in interface ParameterHandler
Throws:
UndefinedParameterError

getParameterAsRepositoryLocation

public RepositoryLocation getParameterAsRepositoryLocation(java.lang.String key)
                                                    throws UserError
This method returns the parameter identified by key as a RepositoryLocation. For this the string is resolved against this operators process location in the Repository.

Throws:
UserError

getParameterAsMatrix

public double[][] getParameterAsMatrix(java.lang.String key)
                                throws UndefinedParameterError
Returns a single named parameter and casts it to a double matrix.

Specified by:
getParameterAsMatrix in interface ParameterHandler
Throws:
UndefinedParameterError

getParameterTypes

public java.util.List<ParameterType> getParameterTypes()
Returns a list of ParameterTypes describing the parameters of this operator. The default implementation returns an empty list if no input objects can be retained and special parameters for those input objects which can be prevented from being consumed. ATTENTION! This will create new parameterTypes. For calling already existing parameter types use getParameters().getParameterTypes();

Specified by:
getParameterTypes in interface ParameterHandler

getParameterType

public ParameterType getParameterType(java.lang.String name)
Returns the parameter type with the given name. Will return null if this operator does not have a parameter with the given name.


writeXML

@Deprecated
public void writeXML(java.io.Writer out,
                                java.lang.String indent,
                                boolean hideDefault)
              throws java.io.IOException
Deprecated. indent is not considered any more. Use writeXML(Writer, boolean)

Writes the XML representation of this operator.

Throws:
java.io.IOException

writeXML

public void writeXML(java.io.Writer out,
                     boolean hideDefault)
              throws java.io.IOException
This will report this operator with all its parameter settings to the given writer as XML.

Throws:
java.io.IOException

getDOMRepresentation

public org.w3c.dom.Document getDOMRepresentation()
                                          throws java.io.IOException
This returns this operator with all its parameter settings as a Document

Throws:
java.io.IOException

getXML

@Deprecated
public java.lang.String getXML(java.lang.String indent,
                                          boolean hideDefault)
Deprecated. indent is not used any more. Use getXML(boolean).


getXML

public java.lang.String getXML(boolean hideDefault)
Same as getXML(hideDefault, false).


getXML

public java.lang.String getXML(boolean hideDefault,
                               boolean onlyCoreElements)
Returns the XML representation of this operator.

Parameters:
hideDefault - if true, default parameters will be ignored when creating the xml representation
onlyCoreElements - if true, GUI and other additional information will be ignored.

createFromXML

public static Operator createFromXML(org.w3c.dom.Element element,
                                     Process targetProcess,
                                     java.util.List<UnknownParameterInformation> unknownParameterInformation)
                              throws XMLException
Throws:
XMLException

createFromXML

public static Operator createFromXML(org.w3c.dom.Element element,
                                     Process process,
                                     java.util.List<UnknownParameterInformation> unknownParameterInformation,
                                     ProgressListener l)
                              throws XMLException
This will create an operator by interpreting the given XML element as being generated from the current RapidMiner version. No Import Rules will be applied to adapt it to version changes.

Throws:
XMLException

createFromXML

public static Operator createFromXML(org.w3c.dom.Element element,
                                     Process process,
                                     java.util.List<UnknownParameterInformation> unknownParameterInformation,
                                     ProgressListener progressListener,
                                     VersionNumber originatingVersion)
                              throws XMLException
This will create an operator from a XML element describing this operator. The given version will be passed to the XMLImporter to enable the handling of this element as if it would have been created from this version. See XMLImporter.VERSION_RM_5 for details.

Throws:
XMLException

clearErrorList

public void clearErrorList()
Clears the list of errors.

See Also:
addError(String)

checkAll

public void checkAll()
Clears all errors, checks the operator and its children and propagates meta data, propgatates dirtyness and sorts execution order.


checkAllExcludingMetaData

public void checkAllExcludingMetaData()
As check all, but does not check the meta data for performance reasons.


updateExecutionOrder

public void updateExecutionOrder()

addError

public void addError(ProcessSetupError error)

addError

@Deprecated
public void addError(java.lang.String message)
Deprecated. Use addError(ProcessSetupError)

Adds an error message.


addWarning

@Deprecated
public void addWarning(java.lang.String message)
Deprecated. Use addError(ProcessSetupError) *

Adds a warning message to the error list.


getErrorList

public java.util.List<ProcessSetupError> getErrorList()
Returns a List of Strings containing error messages.

See Also:
addError(String)

collectErrors

protected void collectErrors(java.util.List<ProcessSetupError> errors)

getStartTime

public long getStartTime()
Returns the system time when the operator was started.


toString

public java.lang.String toString()
Returns the name.

Overrides:
toString in class java.lang.Object

createExperimentTree

@Deprecated
public java.lang.String createExperimentTree(int indent)
Deprecated. Use createProcessTree(int) instead

Returns this operator's name and class.


createProcessTree

public java.lang.String createProcessTree(int indent)
Returns this operator's name and class.


createMarkedExperimentTree

@Deprecated
public java.lang.String createMarkedExperimentTree(int indent,
                                                              java.lang.String mark,
                                                              Operator markOperator)
Deprecated. Use createMarkedProcessTree(int,String,Operator) instead

Returns this operator's name and class.


createMarkedProcessTree

public java.lang.String createMarkedProcessTree(int indent,
                                                java.lang.String mark,
                                                Operator markOperator)
Returns this operator's name and class.


createExperimentTree

@Deprecated
protected java.lang.String createExperimentTree(int indent,
                                                           java.lang.String selfPrefix,
                                                           java.lang.String childPrefix,
                                                           Operator markOperator,
                                                           java.lang.String mark)
Deprecated. Use createProcessTree(int,String,String,Operator,String) instead

Returns this operator's name and class.


createProcessTree

protected java.lang.String createProcessTree(int indent,
                                             java.lang.String selfPrefix,
                                             java.lang.String childPrefix,
                                             Operator markOperator,
                                             java.lang.String mark)
Returns this operator's name and class.


getEncoding

@Deprecated
public final java.nio.charset.Charset getEncoding()
Deprecated. This method is rubbish. Use the Encoding to add a custom encoding parameter to this operator.

Returns the encoding if defined by the root operator if this operator is part of a process or the standard encoding defined via the system property. If both is not possible or if the defined encoding name is 'SYSTEM', the default encoding of the underlying operating system is returned.


isDebugMode

public boolean isDebugMode()

getParent

public final OperatorChain getParent()
Returns the operator containing the enclosing process or null if this is the root operator.


getInputPorts

public final InputPorts getInputPorts()
This method returns the InputPorts object that gives access to all defined InputPorts of this operator. This object can be used to create a new InputPort for an operator using one of the Ports.createPort(String) methods.


getOutputPorts

public final OutputPorts getOutputPorts()
This method returns the OutputPorts object that gives access to all defined OutputPorts of this operator. This object can be used to create a new OutputPort for an operator using one of the Ports.createPort(String) methods.


getTransformer

protected final MDTransformer getTransformer()
This method returns the MDTransformer object of this operator. This object will process all meta data of all ports of this operator according to the rules registered to it. This method can be used to get the transformer and register new Rules for MetaDataTransformation for the ports using the MDTransformer.addRule(com.rapidminer.operator.ports.metadata.MDTransformationRule) method or one of it's more specialized sisters.


getExecutionUnit

public final ExecutionUnit getExecutionUnit()
Returns the ExecutionUnit that contains this operator.


setEnclosingProcess

protected final void setEnclosingProcess(ExecutionUnit parent)

clear

public void clear(int clearFlags)
Clears output and input ports.


assumePreconditionsSatisfied

public void assumePreconditionsSatisfied()
Assumes that all preconditions are satisfied. This method is useful to query an operator for its output, given that it was wired correctly.


disconnectPorts

public void disconnectPorts()
This method will disconnect all ports from as well the input ports as well as the outputports.


transformMetaData

public void transformMetaData()
If this method is called for perform the meta data transformation on this operator. It needs the meta data on the input Ports to be already calculated.


shouldAutoConnect

public boolean shouldAutoConnect(OutputPort outputPort)
By default, all ports will be auto-connected by ExecutionUnit.autoWire(CompatibilityLevel, boolean, boolean). Optional outputs were handled up to version 4.4 by parameters. From 5.0 on, optional outputs are computed iff the corresponding port is connected. For backward compatibility, operators can check if we should auto-connect a port by overriding this method (e.g. by checking a deprecated parameter). TODO: Remove in later versions


shouldAutoConnect

public boolean shouldAutoConnect(InputPort inputPort)
See Also:
shouldAutoConnect(OutputPort)

getRoot

public Operator getRoot()
Returns the first ancestor that does not have a parent. Note that this is not necessarily a ProcessRootOperator!


notifyRenaming

public void notifyRenaming(java.lang.String oldName,
                           java.lang.String newName)
This method is called when the operator with "oldName" is renamed to "newName". It provides a hook, when this operator's parameter are depending on operator names. The ParameterTypeInnerOperator is an example for such an dependency. This way it is possible to change the parameter's according to the renaming.


fireUpdate

protected void fireUpdate(Operator operator)
Description copied from class: AbstractObservable
Updates all observers with the given argument.

Overrides:
fireUpdate in class AbstractObservable<Operator>

makeDirty

public void makeDirty()
This method will flag this operator's results as dirty. Currently unused feature.


propagateDirtyness

protected void propagateDirtyness()

isDirty

public boolean isDirty()
Returns whether the results on the output ports of this operator are dirty. This is the case when the results depend on old parameter settings or old data from an input port, whose connected output port is flaged as dirty.


getNumberOfBreakpoints

public int getNumberOfBreakpoints()
This returns the number of breakpoints: 0, 1 or 2.


acceptsInput

public boolean acceptsInput(java.lang.Class<? extends IOObject> inputClass)
Returns true if this operator contains at least one InputPort which accepts an input of the given class (loose checking).


producesOutput

public boolean producesOutput(java.lang.Class<? extends IOObject> outputClass)
Returns true if this operator contains at least one OutputPort provided that its input ports are satisfied.


getPortOwner

public PortOwner getPortOwner()
This returns the PortOwner of this operator. See PortOwner for more details.


preAutoWire

protected java.util.LinkedList<OutputPort> preAutoWire(java.util.LinkedList<OutputPort> readyOutputs)
                                                throws OperatorException
This method is called before auto-wiring an operator. Operators can reorder outputs in order to influence how subsequent operators are wired. This is only necessary for legacy operators like IOConsumer or IOSelector. Don't override this method for new operators.

Throws:
OperatorException

freeMemory

public void freeMemory()
Releases of any resources held by this operator due since its execution. In particular, removes all hard references to IOObjects stored at the ports.


lookupOperator

protected Operator lookupOperator(java.lang.String operatorName)
Looks up an operator with the given name in the containing process. TODO: This method is slow since it scans operators several times. Simply looking at the Process.operatorNameMap does not work for parallel execution, however.


isRunning

public boolean isRunning()
Returns if this operators execute() method is currently executed.


setCompatibilityLevel

public void setCompatibilityLevel(OperatorVersion compatibilityLevel)
See Also:
OperatorVersion

getCompatibilityLevel

public OperatorVersion getCompatibilityLevel()
See Also:
OperatorVersion

getIncompatibleVersionChanges

public OperatorVersion[] getIncompatibleVersionChanges()
Returns the versions of an operator after which its behavior incompatibly changed in ascending order. Only the versions after which the new behaviour was introduced are returned. See comment of OperatorVersion for details.


getResourceConsumptionEstimator

public ResourceConsumptionEstimator getResourceConsumptionEstimator()
Subclasses can override this method if they are able to estimate the consumed resources (CPU time and memory), based on their input. The default implementation returns null.

Specified by:
getResourceConsumptionEstimator in interface ResourceConsumer

walk

public void walk(Visitor<Operator> visitor)
Visitor pattern visiting all operators in subprocesses and the operator itself.



Copyright © 2001-2009 by Rapid-I