harpoon.Analysis.Quads
Class QuadCounter

java.lang.Object
  extended by harpoon.Analysis.Quads.QuadCounter
All Implemented Interfaces:
HCodeFactory, Serializable

public class QuadCounter
extends Object
implements HCodeFactory, Serializable

QuadCounter is an harpoon.ClassFile.HCodeFactory which counts the number of quads that have been converted thus far. count() returns the current count. Use in conjunction with a harpoon.ClassFile.CachingCodeFactory to create an accurate count: hcf = new CachingCodeFactory(new QuadCounter(hcf));

Version:
$Id: QuadCounter.java,v 1.3 2002/08/14 20:50:11 wbeebee Exp $
Author:
Wes Beebee <wbeebee@mit.edu>
See Also:
Serialized Form

Constructor Summary
QuadCounter(HCodeFactory hcf)
          Creates a new QuadCounter with hcf as its parent.
 
Method Summary
 void clear(HMethod m)
          Clears HMethod m from the cache.
 HCode convert(HMethod m)
          Converts HMethod m into an HCode and counts the number of Quads returned.
 long count()
          Returns the current count of the number of Quads converted.
 String getCodeName()
          Gets the code name of this HCodeFactory.
 String toString()
          Print a textual representation of this QuadCounter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QuadCounter

public QuadCounter(HCodeFactory hcf)
Creates a new QuadCounter with hcf as its parent.

Method Detail

convert

public HCode convert(HMethod m)
Converts HMethod m into an HCode and counts the number of Quads returned.

Specified by:
convert in interface HCodeFactory

getCodeName

public String getCodeName()
Gets the code name of this HCodeFactory.

Specified by:
getCodeName in interface HCodeFactory

clear

public void clear(HMethod m)
Clears HMethod m from the cache. Note: this does not remove the Quads from the total count.

Specified by:
clear in interface HCodeFactory

count

public long count()
Returns the current count of the number of Quads converted.


toString

public String toString()
Print a textual representation of this QuadCounter.

Overrides:
toString in class Object