// 
// Decompiled by Procyon v0.6.0
// 

package org.bouncycastle.crypto.constraints;

import java.util.Iterator;
import org.bouncycastle.util.Strings;
import java.util.HashSet;
import java.util.Collections;
import java.util.Set;
import java.util.logging.Logger;
import org.bouncycastle.crypto.CryptoServicesConstraints;

public abstract class ServicesConstraint implements CryptoServicesConstraints
{
    protected static final Logger LOG;
    private final Set<String> exceptions;
    
    protected ServicesConstraint(final Set<String> set) {
        if (set.isEmpty()) {
            this.exceptions = Collections.EMPTY_SET;
        }
        else {
            this.exceptions = new HashSet<String>(set.size());
            final Iterator<String> iterator = set.iterator();
            while (iterator.hasNext()) {
                this.exceptions.add(Strings.toUpperCase(iterator.next().toString()));
            }
            Utils.addAliases(this.exceptions);
        }
    }
    
    protected boolean isException(final String s) {
        return !this.exceptions.isEmpty() && this.exceptions.contains(Strings.toUpperCase(s));
    }
    
    static {
        LOG = Logger.getLogger(ServicesConstraint.class.getName());
    }
}
