org.mbari.siam.distributed
Class PacketSubsampler

java.lang.Object
  extended by org.mbari.siam.distributed.PacketFilter
      extended by org.mbari.siam.distributed.PacketSubsampler
All Implemented Interfaces:
java.io.Serializable

public class PacketSubsampler
extends PacketFilter
implements java.io.Serializable

PacketSubsampler filters every nth packet of specified types.

See Also:
Serialized Form

Field Summary
protected  int _currentCount
          Number of packets that have been read.
protected  int _skipInterval
          Number of packets to skip between subsamples.
 
Fields inherited from class org.mbari.siam.distributed.PacketFilter
_log4j
 
Constructor Summary
PacketSubsampler(int skipInterval, int packetTypeFlags)
          Specify subsample skip interval for specified packet types; interval of 0 means don't skip any packets, interval of -1 means never sample any packets.
 
Method Summary
 boolean pass(DevicePacket packet)
          If filter is not applicable to specified packet's type, or specified packet passes filter criteria, return true; else return false.
 void reset()
          Reset filter in preparation for starting on an input data set.
 java.lang.String toString()
          Print string representation
 
Methods inherited from class org.mbari.siam.distributed.PacketFilter
filteredType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_skipInterval

protected int _skipInterval
Number of packets to skip between subsamples. _skipInterval of 0 means to sample every packet. _skipInterval of -1 means to never sample.


_currentCount

protected int _currentCount
Number of packets that have been read.

Constructor Detail

PacketSubsampler

public PacketSubsampler(int skipInterval,
                        int packetTypeFlags)
Specify subsample skip interval for specified packet types; interval of 0 means don't skip any packets, interval of -1 means never sample any packets.

Method Detail

reset

public void reset()
Reset filter in preparation for starting on an input data set.

Specified by:
reset in class PacketFilter

pass

public boolean pass(DevicePacket packet)
If filter is not applicable to specified packet's type, or specified packet passes filter criteria, return true; else return false.

Specified by:
pass in class PacketFilter

toString

public java.lang.String toString()
Print string representation

Overrides:
toString in class PacketFilter


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.