edu.isi.pegasus.planner.parser.pdax
Class PDAX2MDAG.GrepCallback

java.lang.Object
  extended by edu.isi.pegasus.planner.parser.pdax.PDAX2MDAG.GrepCallback
All Implemented Interfaces:
StreamGobblerCallback
Enclosing class:
PDAX2MDAG

private class PDAX2MDAG.GrepCallback
extends Object
implements StreamGobblerCallback

An inner class, that implements the StreamGobblerCallback to count the occurences of a word in a document.


Field Summary
private  int mCount
          The number of times the word appears.
private  String mWord
          The word that is to be searched for.
private  int mWordLength
          The length of the word to be searched for.
 
Constructor Summary
PDAX2MDAG.GrepCallback(String word)
          Overloaded Constructor.
 
Method Summary
 int getCount()
          Returns the number of words counted so far.
 void reset()
          Resets the internal counters.
 void work(String line)
          Callback whenever a line is read from the stream by the StreamGobbler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mWord

private String mWord
The word that is to be searched for.


mWordLength

private int mWordLength
The length of the word to be searched for.


mCount

private int mCount
The number of times the word appears.

Constructor Detail

PDAX2MDAG.GrepCallback

public PDAX2MDAG.GrepCallback(String word)
Overloaded Constructor.

Parameters:
word - the word to be searched for.
Method Detail

work

public void work(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 interface StreamGobblerCallback
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.



Copyright © 2011 The University of Southern California. All Rights Reserved.