| |
|
| java.lang.Object com.jamonapi.AccumulateMonitor
All known Subclasses: com.jamonapi.TimeStatsMonitor, com.jamonapi.ActiveStatsMonitor, com.jamonapi.TimeStatsDistMonitor, com.jamonapi.LastAccessMonitor,
AccumulateMonitor | public class AccumulateMonitor implements AccumulateMonitorInterface(Code) | | AccumulateMonitors represent Monitors that increase in value. AccumulateMonitors use the Gang of 4's decorator pattern to pass
method invocations to the next Monitor in the chain. Note many of the public methods such as start(), stop() and reset() call the
same method of next Monitor in the decorator chain. Any classes that inherit from AccumulateMonitor implement the protected methods
startThis(), stopThis(), and resetThis() and leave the public methods as is. In general the various ...This() (startThis(), stopThis(),
resetThis()) methods perform the action on that instance and the methods without ...This() (start(), stop(), reset()) take care of
passing the command down the decorator chain.
|
Constructor Summary | |
public | AccumulateMonitor() Default constructor.
Note Monitors use the Gang of 4 decorator pattern where each monitor points to and calls the next monitor in the chain. | public | AccumulateMonitor(AccumulateMonitorInterface childMonitor) Monitors use the Gang of 4 decorator pattern where each monitor points to and calls the next monitor in the chain. |
MILLISECONDS | final protected static String MILLISECONDS(Code) | | |
STANDARD_DEVIATION | final protected static String STANDARD_DEVIATION(Code) | | |
accrued | protected long accrued(Code) | | |
AccumulateMonitor | public AccumulateMonitor()(Code) | | Default constructor.
Note Monitors use the Gang of 4 decorator pattern where each monitor points to and calls the next monitor in the chain. With
the default constructor there is no need for a next Monitors in the chain, but to keep the logic identical to when there is
a next Monitor in the chain a NullMonitor (that does nothing) is used as the next Monitor to call in the decorator pattern.
Martin Fowler's Refactoring book discusses NullMonitor's.
|
AccumulateMonitor | public AccumulateMonitor(AccumulateMonitorInterface childMonitor)(Code) | | Monitors use the Gang of 4 decorator pattern where each monitor points to and calls the next monitor in the chain.
This constructor as its argument takes the next AccumulateMonitor in the chain.
Sample Call:
AccumulateMonitor mon=new AccumulateMonitor(new AccumulateMonitor(new AccumulateMonitor()));
|
convertToString | protected static String convertToString(double value)(Code) | | Convert a float value to a String
Sample Call:
String number=AccumulateMonitor.convertToString(1234.5); // returns 1,234.5
|
getAccrued | public synchronized long getAccrued()(Code) | | Get the value of the monitor. What this value means depends on what the monitor does. In the case of a Timing monitor it would be
the elapsed time since the monitor was started.
Sample call:
long accrued=monitor.getAccrued();
|
getAccruedString | public String getAccruedString()(Code) | | Return the accrued value in String format *
|
getData | public void getData(ArrayList rowData)(Code) | | Populate the ArrayList with data from this Monitor as well as all other Monitors in the decorator chain *
|
getDataThis | protected void getDataThis(ArrayList rowData)(Code) | | Add this Monitor's accrued value in string format to an ArrayList. *
|
getHeader | public void getHeader(ArrayList header)(Code) | | Add the display header that is associated with this Monitor to the header (as an ArrayList entry). Also give all Monitors in the
decorator chain the opportunity to add their header entries.
|
getType | public String getType()(Code) | | Display this Monitors type *
|
getUnits | public String getUnits()(Code) | | Dispay the units appropriate for this monitor *
|
increase | public void increase(long increaseValue)(Code) | | Increase the monitors accrued value by the ammount specified in the parameter, and call increase on all monitors in the
decorator chain.
Sample Call:
monitor.increase(100);
|
increase | public void increase()(Code) | | Increase the monitors accrued value by 1 unit.
Sample Call:
monitor.increase();
|
increaseThis | protected synchronized void increaseThis(long increase)(Code) | | Add the value passed to this method to the Monitor's accrued value *
|
isPrimary | public boolean isPrimary()(Code) | | Indicates whether or not this Monitor is primary. See www.jamonapi.com for an explanation of primary Monitors. *
|
main | public static void main(String[] args) throws Exception(Code) | | Method that calls test code for this class. *
|
reset | public void reset()(Code) | | Erase/wipe out any accrued statistics for this monitor, and call reset on all monitors in the decorator chain
Sample Call:
monitor.reset();
|
resetThis | protected synchronized void resetThis()(Code) | | Erase/wipe out any accrued statistics for this monitor *
|
setPrimary | public void setPrimary(boolean primary)(Code) | | Specify whether or not this Monitor is primary. See www.jamonapi.com for an explanation of primary Monitors. Call setPrimary()
for all Monitors in the decorator chain
|
start | public void start()(Code) | | Start gathering statistics for this Monitor. The Monitor will run until the stop() method is called. start() will also
call the start() method for all other Monitors in the decorator chain.
|
startThis | protected void startThis()(Code) | | Contains any logic that this Monitor must perform when it is started *
|
stop | public void stop()(Code) | | Stop gathering statistics for the Monitor. stop() is called after a Monitor has been started with the start() method.
stop() will also call the stop() method for all Monitors in the decorator chain.
|
stopThis | protected void stopThis()(Code) | | Contains any logic that this Monitor must perform when it is stopped *
|
toString | public String toString()(Code) | | Display this Monitor as well as all Monitor's in the decorator chain as Strings *
|
toStringChild | protected String toStringChild()(Code) | | Display Monitor's in the Decorator chain in String format *
|
toStringThis | protected synchronized String toStringThis()(Code) | | Display this Monitor in String format *
|
|
|
|