001package org.unix4j.unix.sed;
002
003import org.unix4j.line.Line;
004import org.unix4j.line.SimpleLine;
005import org.unix4j.processor.LineProcessor;
006
007class ChangeProcessor extends AbstractTextProcessor {
008        public ChangeProcessor(Command command, SedArguments args, LineProcessor output) {
009                super(command, args, output);
010        }
011        public ChangeProcessor(Command command, String script, SedArguments args, LineProcessor output) {
012                super(command, script, args, output);
013        }
014
015        @Override
016        public boolean processLine(Line line) {
017                final boolean matches = regexp.matcher(line).find();
018                if (matches) {
019                        return output.processLine(new SimpleLine(text, line.getLineEnding()));
020                }
021                if (!args.isQuiet()) {
022                        return output.processLine(line);
023                }
024                return true;
025        }
026}