JVM Languages
jgrep.txt
Associated article: The Visitor Pattern and a Java Grep Utility
Tags: JVM Languages
Published source code accompanying the article by W. David Pitt in which he uses the Visitor pattern to implement the familiar grep utility, which searches for a string pattern defined in a file. David implements grep in Java. Also see JGREP.ZIP.
The Visitor Pattern and a Java Grep Utility
by W. David Pitt
Listing One
public void acceptVisitor( GrepVisitor aVisitor)
Visitor = aVisitor;
Listing Two
/** Return true if current line contains pattern
* @return boolean
*/
public boolean match() {
String aLine = subject.processor.currentLine;
...


