Class PDAX2MDAG.GrepCallback
- java.lang.Object
-
- edu.isi.pegasus.planner.parser.pdax.PDAX2MDAG.GrepCallback
-
- All Implemented Interfaces:
StreamGobblerCallback
- Enclosing class:
- PDAX2MDAG
private class PDAX2MDAG.GrepCallback extends java.lang.Object implements StreamGobblerCallback
An inner class, that implements the StreamGobblerCallback to count the occurences of a word in a document.
-
-
Field Summary
Fields Modifier and Type Field Description private intmCountThe number of times the word appears.private java.lang.StringmWordThe word that is to be searched for.private intmWordLengthThe length of the word to be searched for.
-
Constructor Summary
Constructors Constructor Description GrepCallback(java.lang.String word)Overloaded Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetCount()Returns the number of words counted so far.voidreset()Resets the internal counters.voidwork(java.lang.String line)Callback whenever a line is read from the stream by the StreamGobbler.
-
-
-
Method Detail
-
work
public void work(java.lang.String line)
Callback whenever a line is read from the stream by the StreamGobbler. Counts the occurences of the word that are in the line, and increments to the global counter.- Specified by:
workin interfaceStreamGobblerCallback- Parameters:
line- the line that is read.
-
getCount
public int getCount()
Returns the number of words counted so far.- Returns:
- the number of words
-
reset
public void reset()
Resets the internal counters.
-
-