/*
 * Decompiled with CFR 0.152.
 */
package org.jivesoftware.smack.filter;

import org.jivesoftware.smack.filter.StanzaFilter;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.packet.Stanza;

@Deprecated
public class PacketTypeFilter
implements StanzaFilter {
    public static final PacketTypeFilter PRESENCE = new PacketTypeFilter(Presence.class);
    public static final PacketTypeFilter MESSAGE = new PacketTypeFilter(Message.class);
    private final Class<? extends Stanza> packetType;

    public PacketTypeFilter(Class<? extends Stanza> packetType) {
        this.packetType = packetType;
    }

    @Override
    public boolean accept(Stanza packet) {
        return this.packetType.isInstance(packet);
    }

    public String toString() {
        return this.getClass().getSimpleName() + ": " + this.packetType.getName();
    }
}
