Class BranchingPipe

  • All Implemented Interfaces:

    public class BranchingPipe
    extends Pipe
    A Pipe that works like a rule list. Evaluate predicate() on each Pipe in the array; the first one that returns true, call that one ("the called Pipe"), and ignore the remainder in the array. The called Pipe will then get control of the source InstanceIterator until it produces an Instance---in other words it will be able to call next() on the source Pipe as often as necessary to produce an Instance. You must be very careful that none of the iterators from Pipes in the rule list buffer any Instances---in other words they shouldn't call next() to pre-gather any Instances they they themselves don't consume and process immediately. Otherwise, Instances that should have been processed by some other constituent Pipe could get lost in this buffering process.
    Andrew McCallum
    See Also:
    Serialized Form
    • Constructor Detail

      • BranchingPipe

        public BranchingPipe()
      • BranchingPipe

        public BranchingPipe​(Pipe[] pipes)
      • BranchingPipe

        public BranchingPipe​(java.util.Collection<Pipe> pipeList)
    • Method Detail

      • newIteratorFrom

        public java.util.Iterator<Instance> newIteratorFrom​(java.util.Iterator<Instance> source)
        Description copied from class: Pipe
        Given an InstanceIterator, return a new InstanceIterator whose instances have also been processed by this pipe. If you override this method, be sure to check and obey this pipe's skipIfFalse(Instance) method.
        newIteratorFrom in class Pipe