public abstract class Filter extends Object
Modifier and Type | Method and Description |
---|---|
protected void |
addFieldPort(String name,
Field field,
boolean hasDefault,
boolean isFinal) |
protected void |
addInputPort(String name)
Adds an input port to the filter.
|
protected void |
addMaskedInputPort(String name,
FrameFormat formatMask)
Adds an input port to the filter.
|
protected void |
addOutputBasedOnInput(String outputName,
String inputName)
Adds an output port to the filter.
|
protected void |
addOutputPort(String name,
FrameFormat format)
Adds an output port to the filter with a fixed output format.
|
protected void |
addProgramPort(String name,
String varName,
Field field,
Class varType,
boolean hasDefault) |
void |
close(FilterContext context) |
protected void |
closeOutputPort(String name) |
protected void |
delayNextProcess(int millisecs) |
void |
fieldPortValueUpdated(String name,
FilterContext context) |
String |
getFilterClassName() |
FrameFormat |
getInputFormat(String portName) |
InputPort |
getInputPort(String portName) |
String |
getName() |
int |
getNumberOfConnectedInputs() |
int |
getNumberOfConnectedOutputs() |
int |
getNumberOfInputs() |
int |
getNumberOfOutputs() |
FrameFormat |
getOutputFormat(String portName,
FrameFormat inputFormat) |
OutputPort |
getOutputPort(String portName) |
int |
getSleepDelay() |
void |
init() |
protected void |
initProgramInputs(Program program,
FilterContext context)
Assigns all program variables to the ports they are connected to.
|
void |
initWithAssignmentList(Object... keyValues) |
void |
initWithAssignmentString(String assignments) |
void |
initWithValueMap(KeyValueMap valueMap) |
static boolean |
isAvailable(String filterName)
Tests to see if a given filter is installed on the system.
|
boolean |
isOpen() |
void |
open(FilterContext context) |
protected void |
parametersUpdated(Set<String> updated) |
protected void |
prepare(FilterContext context) |
abstract void |
process(FilterContext context) |
protected Frame |
pullInput(String name) |
protected void |
pushOutput(String name,
Frame frame) |
void |
setInputFrame(String inputName,
Frame frame) |
void |
setInputValue(String inputName,
Object value) |
abstract void |
setupPorts() |
protected void |
setWaitsOnInputPort(String portName,
boolean waits)
Specifies whether the filter should not be scheduled until a frame is available on that
input port.
|
protected void |
setWaitsOnOutputPort(String portName,
boolean waits)
Specifies whether the filter should not be scheduled until the output port is free, i.e.
|
void |
tearDown(FilterContext context) |
String |
toString()
Returns a string containing a concise, human-readable description of this
object.
|
protected void |
transferInputPortFrame(String name,
FilterContext context)
Transfers any frame from an input port to its destination.
|
public Filter(String name)
public static final boolean isAvailable(String filterName)
public final void initWithValueMap(KeyValueMap valueMap)
public final void initWithAssignmentString(String assignments)
public final void initWithAssignmentList(Object... keyValues)
public final void init() throws ProtocolException
ProtocolException
public String getFilterClassName()
public final String getName()
public boolean isOpen()
protected void prepare(FilterContext context)
protected void delayNextProcess(int millisecs)
public abstract void setupPorts()
public FrameFormat getOutputFormat(String portName, FrameFormat inputFormat)
public final FrameFormat getInputFormat(String portName)
public void open(FilterContext context)
public abstract void process(FilterContext context)
public final int getSleepDelay()
public void close(FilterContext context)
public void tearDown(FilterContext context)
public final int getNumberOfConnectedInputs()
public final int getNumberOfConnectedOutputs()
public final int getNumberOfInputs()
public final int getNumberOfOutputs()
public final OutputPort getOutputPort(String portName)
public void fieldPortValueUpdated(String name, FilterContext context)
protected void transferInputPortFrame(String name, FilterContext context)
protected void initProgramInputs(Program program, FilterContext context)
protected void addInputPort(String name)
addMaskedInputPort
instead.name
- the name of the input portprotected void addMaskedInputPort(String name, FrameFormat formatMask)
name
- the name of the input portformatMask
- a format mask, which filters the allowable input typesprotected void addOutputPort(String name, FrameFormat format)
addOutputBasedOnInput
instead.name
- the name of the output portformat
- the fixed output format of this portprotected void addOutputBasedOnInput(String outputName, String inputName)
getOutputFormat
to specify what format your
filter will output for a given input. If the output format of your filter port does not
depend on the input, use addOutputPort
instead.outputName
- the name of the output portinputName
- the name of the input port, that this output depends onprotected void addFieldPort(String name, Field field, boolean hasDefault, boolean isFinal)
protected void addProgramPort(String name, String varName, Field field, Class varType, boolean hasDefault)
protected void closeOutputPort(String name)
protected void setWaitsOnInputPort(String portName, boolean waits)
portName
- the name of the input port.waits
- true, if the filter should wait for a frame on this port.protected void setWaitsOnOutputPort(String portName, boolean waits)
portName
- the name of the output port.waits
- true, if the filter should wait for the port to become free.public String toString()
Object
getClass().getName() + '@' + Integer.toHexString(hashCode())
See Writing a useful
toString
method
if you intend implementing your own toString
method.