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 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 filter1, PacketFilter filter2)
          Creates an AND filter using the two 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.
 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 filter1,
                 PacketFilter filter2)
Creates an AND filter using the two specified filters.

Parameters:
filter1 - the first packet filter.
filter2 - the second packet filter.
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 String toString()
Overrides:
toString in class Object

Smack

Copyright © 2003 Jive Software.