FileDocCategorySizeDatePackage
SignerInformationStore.javaAPI DocBouncy Castle Crypto API 1.41 (Java 1.5)3465Wed Oct 01 10:55:28 BST 2008org.bouncycastle.cms

SignerInformationStore

public class SignerInformationStore extends Object

Fields Summary
private Map
table
Constructors Summary
public SignerInformationStore(Collection signerInfos)


     
          
    
        Iterator    it = signerInfos.iterator();

        while (it.hasNext())
        {
            SignerInformation   signer = (SignerInformation)it.next();
            SignerId            sid = signer.getSID();

            if (table.get(sid) == null)
            {
                table.put(sid, signer);
            }
            else
            {
                Object o = table.get(sid);
                
                if (o instanceof List)
                {
                    ((List)o).add(signer);
                }
                else
                {
                    List l = new ArrayList();
                    
                    l.add(o);
                    l.add(signer);
                    
                    table.put(sid, l);
                }
            }
        }
    
Methods Summary
public SignerInformationget(SignerId selector)
Return the first SignerInformation object that matches the passed in selector. Null if there are no matches.

param
selector to identify a signer
return
a single SignerInformation object. Null if none matches.

        Object o = table.get(selector);
        
        if (o instanceof List)
        {
            return (SignerInformation)((List)o).get(0);
        }
        else
        {
            return (SignerInformation)o;
        }
    
public java.util.CollectiongetSigners()
Return all signers in the collection

return
a collection of signers.

        List        list = new ArrayList(table.size());
        Iterator    it = table.values().iterator();
        
        while (it.hasNext())
        {
            Object o = it.next();
            
            if (o instanceof List)
            {
                list.addAll((List)o);
            }
            else
            {
                list.add(o);
            }
        }
        
        return list;
    
public java.util.CollectiongetSigners(SignerId selector)
Return possible empty collection with signers matching the passed in SignerId

param
selector a signer id to select against.
return
a collection of SignerInformation objects.

        Object o = table.get(selector);
        
        if (o instanceof List)
        {
            return new ArrayList((List)o);
        }
        else if (o != null)
        {
            return Collections.singletonList(o);
        }
        
        return new ArrayList();
    
public intsize()
Return the number of signers in the collection.

return
number of signers identified.

        Iterator    it = table.values().iterator();
        int         count = 0;
        
        while (it.hasNext())
        {
            Object o = it.next();
            
            if (o instanceof List)
            {
                count += ((List)o).size();
            }
            else
            {
                count++;
            }
        }
        
        return count;