Smack

org.jivesoftware.smack.filter
Class AndFilter

java.lang.Object
  extended by org.jivesoftware.smack.filter.AndFilter
All Implemented Interfaces:
PacketFilter

public class AndFilter
extends java.lang.Object
implements PacketFilter

Implements the logical AND operation over two or more packet filters. In other words, packets pass this filter if they pass all of the filters.

Author:
Matt Tucker

Constructor Summary
AndFilter()
          Creates an empty AND filter.
AndFilter(PacketFilter... filters)
          Creates an AND filter using the specified filters.
 
Method Summary
 boolean accept(Packet packet)
          Tests whether or not the specified packet should pass the filter.
 void addFilter(PacketFilter filter)
          Adds a filter to the filter list for the AND operation.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AndFilter

public AndFilter()
Creates an empty AND filter. Filters should be added using the addFilter(PacketFilter) method.


AndFilter

public AndFilter(PacketFilter... filters)
Creates an AND filter using the specified filters.

Parameters:
filters - the filters to add.
Method Detail

addFilter

public void addFilter(PacketFilter filter)
Adds a filter to the filter list for the AND operation. A packet will pass the filter if all of the filters in the list accept it.

Parameters:
filter - a filter to add to the filter list.

accept

public boolean accept(Packet packet)
Description copied from interface: PacketFilter
Tests whether or not the specified packet should pass the filter.

Specified by:
accept in interface PacketFilter
Parameters:
packet - the packet to test.
Returns:
true if and only if packet passes the filter.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Smack

Copyright © 2003-2007 Jive Software.