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

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

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

    public StanzaTypeFilter(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();
    }
}
