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 int
mCount
The number of times the word appears.private java.lang.String
mWord
The word that is to be searched for.private int
mWordLength
The 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 int
getCount()
Returns the number of words counted so far.void
reset()
Resets the internal counters.void
work(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:
work
in 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.
-
-