com.limegroup.gnutella.statistics
Class AbstractStatHandler

java.lang.Object
  extended bycom.limegroup.gnutella.statistics.AbstractStatHandler
Direct Known Subclasses:
com.limegroup.gnutella.statistics.AbstractMessageStatHandler, DroppedSentMessageStatHandler, SentMessageStatHandler

public abstract class AbstractStatHandler
extends java.lang.Object

Abstract class that is a general implementation of a message statistics handling class. These classes track multiple statistics at once. For a given message, this includes keeping track of the raw number of messages past, the number of bytes past, and whether or not that message was from another LimeWire.


Field Summary
 Statistic BANDWIDTH_BYTE_STAT
          Statistic for the bandwidth stat to also record message data to.
 Statistic BYTE_STAT
          The Statistic for the number of bytes for this message type.
 Statistic LIME_BYTE_STAT
          Statistic for the bytes of the given message that came from other LimeWires.
 Statistic LIME_NUMBER_STAT
          Statistic for the number of the given message that came from other LimeWires.
 Statistic NUMBER_STAT
          The Statistic that should be incremented for each new message.
protected static StatisticsManager STATS_MANAGER
          Constant for the StatisticsManager for use in subclasses.
 
Constructor Summary
protected AbstractStatHandler(Statistic numberStat, Statistic byteStat, Statistic limeNumberStat, Statistic limeByteStat)
          Creates a new ReceivedMessageStatHandler instance.
protected AbstractStatHandler(Statistic numberStat, Statistic byteStat, Statistic limeNumberStat, Statistic limeByteStat, Statistic bandwidthByteStat)
          Creates a new ReceivedMessageStatHandler instance.
protected AbstractStatHandler(java.lang.String fileName)
          No argument constructor simply creates new stats classes for all required fields.
 
Method Summary
 void addMessage(Message msg)
          Adds the specified Message to the stored data
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NUMBER_STAT

public final Statistic NUMBER_STAT
The Statistic that should be incremented for each new message.


BYTE_STAT

public final Statistic BYTE_STAT
The Statistic for the number of bytes for this message type. For each new message added, the number of bytes are added to this Statistic.


LIME_NUMBER_STAT

public final Statistic LIME_NUMBER_STAT
Statistic for the number of the given message that came from other LimeWires.


LIME_BYTE_STAT

public final Statistic LIME_BYTE_STAT
Statistic for the bytes of the given message that came from other LimeWires.


BANDWIDTH_BYTE_STAT

public final Statistic BANDWIDTH_BYTE_STAT
Statistic for the bandwidth stat to also record message data to.


STATS_MANAGER

protected static final StatisticsManager STATS_MANAGER
Constant for the StatisticsManager for use in subclasses.

Constructor Detail

AbstractStatHandler

protected AbstractStatHandler(java.lang.String fileName)
No argument constructor simply creates new stats classes for all required fields. For the bandwidth stat, it uses the stub that does not record bandwidth data.


AbstractStatHandler

protected AbstractStatHandler(Statistic numberStat,
                              Statistic byteStat,
                              Statistic limeNumberStat,
                              Statistic limeByteStat,
                              Statistic bandwidthByteStat)
Creates a new ReceivedMessageStatHandler instance. Private constructor to ensure that no other classes can construct this class, following the type-safe enum pattern.

Parameters:
numberStat - the statistic that is simply incremented with each new message
byteStat - the statistic for keeping track of the total bytes

AbstractStatHandler

protected AbstractStatHandler(Statistic numberStat,
                              Statistic byteStat,
                              Statistic limeNumberStat,
                              Statistic limeByteStat)
Creates a new ReceivedMessageStatHandler instance. Private constructor to ensure that no other classes can construct this class, following the type-safe enum pattern.

Parameters:
numberStat - the statistic that is simply incremented with each new message
byteStat - the statistic for keeping track of the total bytes
Method Detail

addMessage

public void addMessage(Message msg)
Adds the specified Message to the stored data

Parameters:
msg - the received Message to add to the data