com.rapidminer.operator.ports
Class PortPairExtender

java.lang.Object
  extended by com.rapidminer.operator.ports.PortPairExtender
All Implemented Interfaces:
PortExtender
Direct Known Subclasses:
CollectingPortPairExtender, DummyPortPairExtender

public class PortPairExtender
extends java.lang.Object
implements PortExtender

This class observes a set of input and output ports and adds additional ports as needed. Operators probably want to connect these ports by a ManyToManyPassThroughRule. It guarantees that there is always exactly one pair of in and output pairs which is not connected.

Author:
Simon Fischer
See Also:
PortPairExtender, MultiPortPairExtender

Nested Class Summary
static class PortPairExtender.PortPair
          A pair of ports managed by a PortPairExtender.
 
Constructor Summary
PortPairExtender(java.lang.String name, InputPorts inPorts, OutputPorts outPorts)
           
PortPairExtender(java.lang.String name, InputPorts inPorts, OutputPorts outPorts, MetaData preconditionMetaData)
          Creates a new port pair extender
 
Method Summary
 void deliver(java.util.List<? extends IOObject> ioObjectList)
          This method is a convenient method for delivering several IOObjects.
 void ensureMinimumNumberOfPorts(int minNumber)
          Asks the port extender to generate at least this number of ports.
<T extends IOObject>
java.util.List<T>
getData()
          Deprecated. use #getData(Class))
<T extends IOObject>
java.util.List<T>
getData(java.lang.Class<T> desiredClass)
           
 java.util.List<PortPairExtender.PortPair> getManagedPairs()
          Returns an unmodifiable view of all port pairs managed by this port extender.
 java.lang.String getNamePrefix()
          Prefix for the names of the ports generated by this port extender.
<T extends IOObject>
java.util.List<T>
getOutputData()
          Deprecated. use getOutputData(Class)
<T extends IOObject>
java.util.List<T>
getOutputData(java.lang.Class<T> desiredClass)
           
 MDTransformationRule makePassThroughRule()
          The generated rule copies all meta data from the generated input ports to all generated output ports.
 void passCloneThrough()
          Does the same as passDataThrough() but copies the IOObjects.
 void passDataThrough()
          Passes the actual data from the output ports to their connected input ports.
 void start()
          Creates an initial port and starts to listen.
protected  MetaData transformMetaData(MetaData md)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PortPairExtender

public PortPairExtender(java.lang.String name,
                        InputPorts inPorts,
                        OutputPorts outPorts)

PortPairExtender

public PortPairExtender(java.lang.String name,
                        InputPorts inPorts,
                        OutputPorts outPorts,
                        MetaData preconditionMetaData)
Creates a new port pair extender

Parameters:
name - The name prefix for all generated ports.
inPorts - Add generated input ports to these InputPorts
outPorts - Add generated output ports to these OutputPorts
preconditionMetaData - If non-null, create a SimplePrecondition for each newly generated input port.
Method Detail

start

public void start()
Creates an initial port and starts to listen.


makePassThroughRule

public MDTransformationRule makePassThroughRule()
The generated rule copies all meta data from the generated input ports to all generated output ports.


transformMetaData

protected MetaData transformMetaData(MetaData md)

passDataThrough

public void passDataThrough()
Passes the actual data from the output ports to their connected input ports.


passCloneThrough

public void passCloneThrough()
Does the same as passDataThrough() but copies the IOObjects.


getManagedPairs

public java.util.List<PortPairExtender.PortPair> getManagedPairs()
Returns an unmodifiable view of all port pairs managed by this port extender.


getData

@Deprecated
public <T extends IOObject> java.util.List<T> getData()
                                           throws UserError
Deprecated. use #getData(Class))

Returns a list of all non-null data delivered to the input ports created by this port extender.

Throws:
UserError

getData

public <T extends IOObject> java.util.List<T> getData(java.lang.Class<T> desiredClass)
                                           throws UserError
Throws:
UserError

getOutputData

@Deprecated
public <T extends IOObject> java.util.List<T> getOutputData()
                                                 throws UserError
Deprecated. use getOutputData(Class)

Returns a list of all non-null data delivered to the input ports created by this port extender.

Throws:
UserError

getOutputData

public <T extends IOObject> java.util.List<T> getOutputData(java.lang.Class<T> desiredClass)
                                                 throws UserError
Throws:
UserError

deliver

public void deliver(java.util.List<? extends IOObject> ioObjectList)
This method is a convenient method for delivering several IOObjects. But keep in mind that you cannot deliver more IObjects than you received first hand. First objects in list will be delivered on the first port. If input ports are not connected or got not delivered an objects unequal null, the corresponding output port is skipped.


getNamePrefix

public java.lang.String getNamePrefix()
Description copied from interface: PortExtender
Prefix for the names of the ports generated by this port extender.

Specified by:
getNamePrefix in interface PortExtender

ensureMinimumNumberOfPorts

public void ensureMinimumNumberOfPorts(int minNumber)
Description copied from interface: PortExtender
Asks the port extender to generate at least this number of ports.

Specified by:
ensureMinimumNumberOfPorts in interface PortExtender


Copyright © 2001-2009 by Rapid-I