org.embl.ebi.escience.scuflworkers.java
Class SliceList

java.lang.Object
  extended by org.embl.ebi.escience.scuflworkers.java.SliceList
All Implemented Interfaces:
LocalWorker, LocalWorkerWithPorts, XMLExtensible

public class SliceList
extends java.lang.Object
implements LocalWorkerWithPorts, XMLExtensible

Return a sublist of a list.

The depth can be set with setDepth(int) - as done through the SliceListEditAction.

Author:
Stian Soiland

Field Summary
 
Fields inherited from interface org.embl.ebi.escience.scuflworkers.java.LocalWorker
BINARY, BINARY_ARRAY, HTML, HTML_ARRAY, PNG_IMAGE, PNG_IMAGE_ARRAY, STRING, STRING_ARRAY, UNTYPED, UNTYPED_ARRAY
 
Constructor Summary
SliceList()
           
 
Method Summary
 void consumeXML(org.jdom.Element element)
          Extract the <slicelist depth="X" /> number from the element.
 java.util.Map<java.lang.String,DataThing> execute(java.util.Map inputs)
          Copy each entry in the input list into the output list iff it matches the supplied regular expression.
 int getDepth()
          Get the depth for this slicelist.
 java.lang.String[] inputNames()
          Get an array of the names of input ports for this processor
 java.util.List<InputPort> inputPorts(LocalServiceProcessor processor)
          The InputPorts for this localworker, to be used by LocalServiceProcessor
 java.lang.String[] inputTypes()
          Get an array of the string types for the inputs defined by the inputNames() method, these should probably use the constants defined in this interface but may use any valid Baclava data type specifier.
 java.lang.String[] outputNames()
          Names of the output ports
 java.util.List<OutputPort> outputPorts(LocalServiceProcessor processor)
          The OutputPorts for this localworker, to be used by LocalServiceProcessor
 java.lang.String[] outputTypes()
          Types of the output ports
 org.jdom.Element provideXML()
          Export depth as <extensions><flattenlist depth="X" /></extensions>
 void setDepth(int depth)
          Set the depth of this slicelist.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SliceList

public SliceList()
Method Detail

setDepth

public void setDepth(int depth)
Set the depth of this slicelist. The depth means how deeply it should examine the input before commencing slicing the list. The minimum (and default) depth is 1, which means to sublist lists that contain elements. A depth of 2 would slice lists of lists of elements.

If a depth less than 1 is given, a warning is logged and the depth is set to 1 instead.

Parameters:
depth - Depth of slicelist, minimum 2

getDepth

public int getDepth()
Get the depth for this slicelist. The default value is 1.

Returns:
The current depth

inputNames

public java.lang.String[] inputNames()
Description copied from interface: LocalWorker
Get an array of the names of input ports for this processor

Specified by:
inputNames in interface LocalWorker

inputTypes

public java.lang.String[] inputTypes()
Description copied from interface: LocalWorker
Get an array of the string types for the inputs defined by the inputNames() method, these should probably use the constants defined in this interface but may use any valid Baclava data type specifier.

Specified by:
inputTypes in interface LocalWorker

outputNames

public java.lang.String[] outputNames()
Description copied from interface: LocalWorker
Names of the output ports

Specified by:
outputNames in interface LocalWorker

outputTypes

public java.lang.String[] outputTypes()
Description copied from interface: LocalWorker
Types of the output ports

Specified by:
outputTypes in interface LocalWorker

execute

public java.util.Map<java.lang.String,DataThing> execute(java.util.Map inputs)
                                                  throws TaskExecutionException
Copy each entry in the input list into the output list iff it matches the supplied regular expression.

Specified by:
execute in interface LocalWorker
Throws:
TaskExecutionException - thrown if there is an error during invocation of the task.

inputPorts

public java.util.List<InputPort> inputPorts(LocalServiceProcessor processor)
                                     throws DuplicatePortNameException,
                                            PortCreationException
Description copied from interface: LocalWorkerWithPorts
The InputPorts for this localworker, to be used by LocalServiceProcessor

Specified by:
inputPorts in interface LocalWorkerWithPorts
Throws:
DuplicatePortNameException
PortCreationException

outputPorts

public java.util.List<OutputPort> outputPorts(LocalServiceProcessor processor)
                                       throws DuplicatePortNameException,
                                              PortCreationException
Description copied from interface: LocalWorkerWithPorts
The OutputPorts for this localworker, to be used by LocalServiceProcessor

Specified by:
outputPorts in interface LocalWorkerWithPorts
Throws:
DuplicatePortNameException
PortCreationException

consumeXML

public void consumeXML(org.jdom.Element element)
Extract the <slicelist depth="X" /> number from the element.

Specified by:
consumeXML in interface XMLExtensible

provideXML

public org.jdom.Element provideXML()
Export depth as <extensions><flattenlist depth="X" /></extensions>

Specified by:
provideXML in interface XMLExtensible