001package org.unix4j.unix.head; 002 003import org.unix4j.context.ExecutionContext; 004import org.unix4j.line.Line; 005import org.unix4j.processor.LineProcessor; 006 007final class HeadLinesProcessor extends AbstractHeadProcessor { 008 HeadLinesProcessor(HeadCommand command, ExecutionContext context, LineProcessor output) { 009 super(command, context, output); 010 } 011 012 @Override 013 public boolean processLine(Line line) { 014 if (counter.getCount() < count) { 015 final boolean more = getOutput().processLine(line); 016 return counter.increment() < count && more; 017 } else { 018 return false; 019 } 020 } 021}