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

package org.bouncycastle.oer.its.ieee1609dot2;

import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Integer;
import java.math.BigInteger;
import org.bouncycastle.asn1.ASN1Object;

public class HeaderInfoContributorId extends ASN1Object
{
    private final BigInteger contributorId;
    private static final BigInteger MAX;
    
    public HeaderInfoContributorId(final long val) {
        this(BigInteger.valueOf(val));
    }
    
    public HeaderInfoContributorId(final BigInteger bigInteger) {
        if (bigInteger.signum() < 0 && bigInteger.compareTo(HeaderInfoContributorId.MAX) > 0) {
            throw new IllegalArgumentException("contributor id " + bigInteger + " is out of range 0..255");
        }
        this.contributorId = bigInteger;
    }
    
    private HeaderInfoContributorId(final ASN1Integer asn1Integer) {
        this(asn1Integer.getValue());
    }
    
    public static HeaderInfoContributorId getInstance(final Object o) {
        if (o instanceof HeaderInfoContributorId) {
            return (HeaderInfoContributorId)o;
        }
        if (o != null) {
            return new HeaderInfoContributorId(ASN1Integer.getInstance(o));
        }
        return null;
    }
    
    public BigInteger getContributorId() {
        return this.contributorId;
    }
    
    @Override
    public ASN1Primitive toASN1Primitive() {
        return new ASN1Integer(this.contributorId);
    }
    
    static {
        MAX = BigInteger.valueOf(255L);
    }
}
