public abstract class Pipe extends Object implements Serializable
A pipe operates on an Instance, which is a carrier of data.
A pipe reads from and writes to fields in the Instance when it is requested
to process the instance. It is up to the pipe which fields in the Instance it
reads from and writes to, but usually a pipe will read its input from and write
its output to the "data" field of an instance.
A pipe doesn't have any direct notion of input or output - it merely modifies instances
that are handed to it. A set of helper classes, subclasses of AbstractPipeInputIterator,
iterate over commonly encountered input data structures and feed the elements of these
data structures to a pipe as instances.
A pipe is frequently used in conjunction with an InstanceList As instances are added
to the list, they are processed by the pipe associated with the instance list and
the processed Instance is kept in the list.
In one common usage, a FileIterator is given a list of directories to operate over.
The FileIterator walks through each directory, creating an instance for each
file and putting the data from the file in the data field of the instance.
The directory of the file is stored in the target field of the instance. The
FileIterator feeds instances to an InstanceList, which processes the instances through
its associated pipe and keeps the results.
Pipes can be hierachically composed. In a typical usage, a SerialPipe is created which holds instances of other pipes in an ordered list. Piping in instance through a SerialPipe means piping the instance through the child pipes in sequence.
A pipe holds onto two separate Alphabets: one for the symbols (feature names) encountered in the data fields of the instances processed through the pipe, and one for the symbols encountered in the target fields.
| Constructor and Description |
|---|
Pipe()
Construct a pipe with no data and target dictionaries
|
Pipe(Alphabet dataDict,
Alphabet targetDict)
Construct pipe with data and target dictionaries.
|
Pipe(Class dataDictClass,
Class targetDictClass)
Construct pipe with type specifications for dictionaries.
|
| Modifier and Type | Method and Description |
|---|---|
Alphabet |
getDataAlphabet() |
VMID |
getInstanceId() |
Pipe |
getParent() |
Pipe |
getParentRoot() |
Alphabet |
getTargetAlphabet() |
boolean |
isDataAlphabetSet() |
boolean |
isTargetProcessing()
Return true iff this pipe expects and processes information in
the target slot.
|
abstract Instance |
pipe(Instance carrier)
Process an Instance.
|
Instance |
pipe(Object data,
Object target,
Object name,
Object source,
Instance parent,
PropertyList properties)
Create and process an Instance.
|
Object |
readResolve()
This gets called after readObject; it lets the object decide whether
to return itself or return a previously read in version.
|
protected Alphabet |
resolveDataAlphabet() |
protected Alphabet |
resolveTargetAlphabet() |
void |
setDataAlphabet(Alphabet dDict) |
void |
setParent(Pipe p) |
void |
setTargetAlphabet(Alphabet tDict) |
void |
setTargetProcessing(boolean lookForAndProcessTarget)
Set whether input is taken from target field of instance during processing.
|
public Pipe(Class dataDictClass, Class targetDictClass)
dataDictClass - Class that will be used to create a data dictionary.targetDictClass - Class that will be used to create a data dictionary.
WHEN WHEN WHEN WHENpublic Pipe()
public Pipe(Alphabet dataDict, Alphabet targetDict)
dataDict - Alphabet that will be used as the data dictionary.targetDict - Alphabet that will be used as the target dictionary.
WHEN WHEN WHEN WHENpublic abstract Instance pipe(Instance carrier)
One can create a new concrete subclass of Pipe simply by implementing this method.
carrier - Instance to be processed.public Instance pipe(Object data, Object target, Object name, Object source, Instance parent, PropertyList properties)
data - Object used to initialize data field of new instance.target - Object used to initialize target field of new instance.name - Object used to initialize name field of new instance.source - Object used to initialize source field of new instance.parent - Unusedproperties - Unusedpublic void setTargetProcessing(boolean lookForAndProcessTarget)
public boolean isTargetProcessing()
public void setParent(Pipe p)
public Pipe getParent()
public Pipe getParentRoot()
protected Alphabet resolveDataAlphabet()
protected Alphabet resolveTargetAlphabet()
public Alphabet getDataAlphabet()
public Alphabet getTargetAlphabet()
public void setDataAlphabet(Alphabet dDict)
public boolean isDataAlphabetSet()
public void setTargetAlphabet(Alphabet tDict)
public VMID getInstanceId()
public Object readResolve() throws ObjectStreamException
ObjectStreamExceptionCopyright © 2019 JULIE Lab, Germany. All rights reserved.