<commit_before>
part of asn1lib;

class ASN1Integer extends ASN1Object {

  var intValue;

  ASN1Integer(this.intValue):super(tag:INTEGER_TYPE);

  ASN1Integer.fromBytes(Uint8List bytes) {
    _encodedBytes = bytes;
    _initFromBytes();
    intValue = decodeInteger(this.valueBytes());
  }

  @override
  Uint8List _encode() {
    var t = encodeIntValue(this.intValue);
    valueByteLength  = t.length;
    super._encodeHeader();
    _setValueBytes(t);
    return _encodedBytes;
  }

<commit_msg>Added explicit BigInteger getters to ASN1Integer<commit_after>
part of asn1lib;

class ASN1Integer extends ASN1Object {

  var intValue;

  ASN1Integer(this.intValue):super(tag:INTEGER_TYPE);

  ASN1Integer.fromBytes(Uint8List bytes) {
    _encodedBytes = bytes;
    _initFromBytes();
    intValue = decodeInteger(this.valueBytes());
  }

  BigInteger get valueAsBigInteger {
    if(intValue is BigInteger) return intValue;
    if(isEncoded) return new BigInteger(valueBytes());
    return new BigInteger(intValue);
  }

  BigInteger get valueAsPositiveBigInteger {
    if(!isEncoded) _encode();
    return new BigInteger.fromBytes(1, valueBytes());
  }

  @override
  Uint8List _encode() {
    var t = encodeIntValue(this.intValue);
    valueByteLength  = t.length;
    super._encodeHeader();
    _setValueBytes(t);
    return _encodedBytes;
  }


{'fraction_non_alphanumeric': 0.09962825278810408, 'fraction_numerical': 0.011895910780669145, 'mean_word_length': 4.157088122605364, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4185949', 'n_tokens_mistral': 453, 'n_tokens_neox': 440, 'n_words': 89}