001package org.unix4j.operation;
002
003import org.unix4j.context.ExecutionContext;
004import org.unix4j.line.Line;
005import org.unix4j.processor.LineProcessor;
006
007/**
008 * An interface implemented by simple ad-hoc commands that are taking a single
009 * line as input. Output lines can be written to an output object. An input line
010 * can lead to single or multiple output lines or to no output at all.
011 */
012public interface LineOperation {
013        /**
014         * Performs an operation for the given input line. Result lines can be
015         * written to the provided output object. If the
016         * {@link LineProcessor#finish()} method of the output object is called, no
017         * further calls are expected for this execution context and lines
018         * subsequently written to the output object will be ignored.
019         * 
020         * @param context
021         *            the execution context
022         * @param input
023         *            the input line
024         * @param output
025         *            the output object to write result lines
026         */
027        void operate(ExecutionContext context, Line input, LineProcessor output);
028}