org.mbari.siam.distributed.measurement
Class Averager

java.lang.Object
  extended by net.java.jddac.common.fblock.Entity
      extended by net.java.jddac.jmdi.fblock.FunctionBlock
          extended by org.mbari.siam.distributed.measurement.SummarizerBlock
              extended by org.mbari.siam.distributed.measurement.Averager
All Implemented Interfaces:
net.java.jddac.common.util.ConfigurationInterface, net.java.jddac.jmdi.service.SubscriberCallback, ScheduleOwner

public class Averager
extends SummarizerBlock

Keep a running average of all passed-in numeric measurements. Summary for each measurement includes mean, standard deviation, number of samples, min value, max value, and times at which min and max values occurred.


Field Summary
protected static org.apache.log4j.Logger _log4j
          Log4j logger
static java.lang.String MAX_VALUE
           
static java.lang.String MAX_VALUE_TIME
           
static java.lang.String MEAN
           
static java.lang.String MIN_VALUE
           
static java.lang.String MIN_VALUE_TIME
           
static java.lang.String NSAMPLES
           
static java.lang.String START_TIME
           
static java.lang.String STD_DEV
           
static java.lang.String STOP_TIME
           
 
Fields inherited from class org.mbari.siam.distributed.measurement.SummarizerBlock
OpIdAddListener, OpIdAddSample, SCHEDULE_NAME
 
Fields inherited from class net.java.jddac.jmdi.fblock.FunctionBlock
BL_ACTIVE, BL_INACTIVE, BL_UNINITIALIZED, blockMajorState, blockModelNumber, blockVersion, FB_IDLE, FB_RUNNING, FB_STOPPED, functionBlockState, groupIds, META_TEDS, OpIdClear, OpIdConfigure, OpIdGetAllMetaData, OpIdGetBlockMajorState, OpIdGetFunctionBlockState, OpIdGetGroupIDs, OpIdGetMetaData, OpIdPause, OpIdResume, OpIdStart, pubPortsProperty, subPortsProperty
 
Fields inherited from class net.java.jddac.common.fblock.Entity
description, instanceName, META_CLASS, META_NAME, META_OPERATIONS, objectProperties, OpIdGetAttribute, OpIdGetClassName, OpIdGetDescription, OpIdGetInstanceName, OpIdGetObjectProperties, OpIdGetOwningBlockObjectTag, OpIdSetAttribute, OpIdSetInstanceName, owningBlockObjectName, PerformInputArg, PerformResult
 
Constructor Summary
Averager(int everyNthSample)
          Create an Averager, summarize on every nth sample.
Averager(ScheduleSpecifier schedule)
          Create an Averager, summarize on specified schedule.
 
Method Summary
protected  void addSampleRecord(SiamRecord payload)
          Incorporate specified SiamRecord into SummaryRecord.
 SiamRecord computeSummary()
          Compute summary statistics and return to caller.
 void configure(net.java.jddac.common.type.ArgArray config)
           
protected  boolean include(java.lang.String measurementName)
          Return false if this measurement should be skipped, else return true.
 void resetSummary()
          Reset statistics
 
Methods inherited from class org.mbari.siam.distributed.measurement.SummarizerBlock
addListener, addSample, addSchedule, doScheduledTask, getAllSchedules, getScheduleKey, goActive, notifySubscriber, perform, removeAllSchedules, removeSchedule, resumeSchedule, setSchedule, sleepingUntil, summarizeEveryNthSample, suspendSchedule, syncSchedule
 
Methods inherited from class net.java.jddac.jmdi.fblock.FunctionBlock
clear, destroy, destroyDeferredThread, getBlockMajorState, getBlockModelNumber, getBlockVersion, getEntityMetaData, getFunctionBlockState, getGroupIDs, getPubIDFromName, getSubIDFromName, initialize, pause, publish, publishDeferred, reset, resume, setGroupIDs, start
 
Methods inherited from class net.java.jddac.common.fblock.Entity
addOpTableMeta, getDescription, getInstanceName, getObjectProperties, getObjectPropery, getOwningBlockObjectName, setDescription, setInstanceName, setObjectProperties, setObjectProperty, setOwningBlockObjectName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MEAN

public static final java.lang.String MEAN
See Also:
Constant Field Values

STD_DEV

public static final java.lang.String STD_DEV
See Also:
Constant Field Values

MIN_VALUE

public static final java.lang.String MIN_VALUE
See Also:
Constant Field Values

MIN_VALUE_TIME

public static final java.lang.String MIN_VALUE_TIME
See Also:
Constant Field Values

MAX_VALUE

public static final java.lang.String MAX_VALUE
See Also:
Constant Field Values

MAX_VALUE_TIME

public static final java.lang.String MAX_VALUE_TIME
See Also:
Constant Field Values

NSAMPLES

public static final java.lang.String NSAMPLES
See Also:
Constant Field Values

START_TIME

public static final java.lang.String START_TIME
See Also:
Constant Field Values

STOP_TIME

public static final java.lang.String STOP_TIME
See Also:
Constant Field Values

_log4j

protected static org.apache.log4j.Logger _log4j
Log4j logger

Constructor Detail

Averager

public Averager(ScheduleSpecifier schedule)
         throws ScheduleParseException
Create an Averager, summarize on specified schedule.

Throws:
ScheduleParseException

Averager

public Averager(int everyNthSample)
Create an Averager, summarize on every nth sample.

Method Detail

configure

public void configure(net.java.jddac.common.type.ArgArray config)
               throws java.lang.Exception
Specified by:
configure in interface net.java.jddac.common.util.ConfigurationInterface
Overrides:
configure in class net.java.jddac.jmdi.fblock.FunctionBlock
Throws:
java.lang.Exception

computeSummary

public SiamRecord computeSummary()
Compute summary statistics and return to caller.

Specified by:
computeSummary in class SummarizerBlock

addSampleRecord

protected void addSampleRecord(SiamRecord payload)
                        throws java.lang.Exception
Incorporate specified SiamRecord into SummaryRecord.

Specified by:
addSampleRecord in class SummarizerBlock
Throws:
java.lang.Exception

resetSummary

public void resetSummary()
Reset statistics

Specified by:
resetSummary in class SummarizerBlock

include

protected boolean include(java.lang.String measurementName)
Return false if this measurement should be skipped, else return true.



Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.