org.mbari.jddac
Class AggregationBlock

java.lang.Object
  extended by net.java.jddac.common.fblock.Entity
      extended by net.java.jddac.jmdi.fblock.FunctionBlock
          extended by org.mbari.jddac.RelayBlock
              extended by org.mbari.jddac.AggregationBlock
All Implemented Interfaces:
java.io.Serializable, net.java.jddac.common.util.ConfigurationInterface, net.java.jddac.jmdi.service.SubscriberCallback
Direct Known Subclasses:
StatsBlock

public class AggregationBlock
extends RelayBlock

FunctionBlock used for aggregating measurements or records. Measurements/Records can be filtered by adding implementations of IFilter. A Filter generally accepts or rejects a Measurement but can also be more complicated.

Author:
brian
See Also:
IFilter, SampleCountFilter, Serialized Form

Field Summary
static java.lang.String OpIdAddArgArray
          Operation ID for adding an argument array
 
Fields inherited from class org.mbari.jddac.RelayBlock
OpIdAddFunction
 
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
AggregationBlock()
           
 
Method Summary
 boolean addArgArray(net.java.jddac.common.type.ArgArray argArray)
          Add a sample to the aggregation data.
 boolean addFilter(IFilter filter)
          Add a sample filter.
 void addNewArgArrayListener(NewArgArrayListener listener)
           
 void clear()
          Clear all the samples out of the AggregationBlock
 net.java.jddac.common.type.ArgArray[] getArgArrays()
          Retreive all the samples that have been stored in the AggregationBlock
 IFilter[] getFilters()
          Retreive all filters registered with the AggregationBlock
 NewArgArrayListener[] getNewArgArrayListeners()
           
 java.util.Vector getSamples()
          Retrieves the underlying Vector that is used to hold all the samples.
 net.java.jddac.common.type.ArgArray perform(java.lang.String server_operation_id, net.java.jddac.common.type.ArgArray server_input_arguments)
          Performs the operation using server_input_arguments as the argument to the function used for processing
 boolean removeFilter(IFilter filter)
          Removes a filter
 void removeNewArgArrayListener(NewArgArrayListener listener)
           
 int size()
           
 
Methods inherited from class org.mbari.jddac.RelayBlock
addChild, addFunction, getChildren, removeChild
 
Methods inherited from class net.java.jddac.jmdi.fblock.FunctionBlock
configure, destroy, destroyDeferredThread, getBlockMajorState, getBlockModelNumber, getBlockVersion, getEntityMetaData, getFunctionBlockState, getGroupIDs, getPubIDFromName, getSubIDFromName, goActive, initialize, notifySubscriber, 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

OpIdAddArgArray

public static final java.lang.String OpIdAddArgArray
Operation ID for adding an argument array

See Also:
Constant Field Values
Constructor Detail

AggregationBlock

public AggregationBlock()
Method Detail

perform

public net.java.jddac.common.type.ArgArray perform(java.lang.String server_operation_id,
                                                   net.java.jddac.common.type.ArgArray server_input_arguments)
                                            throws java.lang.Exception,
                                                   net.java.jddac.common.exception.OpException
Description copied from class: RelayBlock

Performs the operation using server_input_arguments as the argument to the function used for processing

You can set the function used by calling:

 relatyBlock.addFunction(FunctionFactory.createFunctionArg(OpIdIn, OpIdOut, new SomeIFunction());
 

Overrides:
perform in class RelayBlock
Throws:
java.lang.Exception
net.java.jddac.common.exception.OpException

addNewArgArrayListener

public void addNewArgArrayListener(NewArgArrayListener listener)

removeNewArgArrayListener

public void removeNewArgArrayListener(NewArgArrayListener listener)

getNewArgArrayListeners

public NewArgArrayListener[] getNewArgArrayListeners()

addArgArray

public boolean addArgArray(net.java.jddac.common.type.ArgArray argArray)
Add a sample to the aggregation data. To filter which samples get added use addFilter(IFilter filter). If an ArgArray fails any of the acceptance tests then it will not be added.

Parameters:
argArray - An argArray to add
Returns:
true if the argArray was successfully added. false otherwise

getArgArrays

public net.java.jddac.common.type.ArgArray[] getArgArrays()
Retreive all the samples that have been stored in the AggregationBlock

Returns:
The ArgArray objects that have been stored.

addFilter

public boolean addFilter(IFilter filter)
Add a sample filter. When a ArgArray (i.e. sample) is added using addArgArray, it must be tested by every filter registered to see if it is added as to the aggregation of samples.

Parameters:
filter - The filter to add
Returns:
true if the filter was added.
See Also:
IFilter

removeFilter

public boolean removeFilter(IFilter filter)
Removes a filter

Parameters:
filter - The filter to remove
Returns:
true if the filter was removed
See Also:
IFilter

getFilters

public IFilter[] getFilters()
Retreive all filters registered with the AggregationBlock

Returns:
An array of IFilters registered with the AggregationBlock

size

public int size()
Returns:
the number of ArgArrays that have been stored in the aggregation

clear

public void clear()
Clear all the samples out of the AggregationBlock

Overrides:
clear in class net.java.jddac.jmdi.fblock.FunctionBlock

getSamples

public java.util.Vector getSamples()
Retrieves the underlying Vector that is used to hold all the samples. You should only use this if you really, really need to have direct access to underlying data.



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.