Initialize from ASN.1.

@param Sequence $seq
@throws \UnexpectedValueException
@return self
180739
public static function fromASN1(Sequence $seq): RSAPrivateKey
    {
        $version = $seq->at(0)
            ->asInteger()
            ->intNumber();
        if ($version != 0) {
            throw new \UnexpectedValueException("Version must be 0.");
        }
        // helper function get integer from given index
        $get_int = function ($idx) use ($seq) {
            return $seq->at($idx)
                ->asInteger()
                ->number();
        };
        $n = $get_int(1);
        $e = $get_int(2);
        $d = $get_int(3);
        $p = $get_int(4);
        $q = $get_int(5);
        $dp = $get_int(6);
        $dq = $get_int(7);
        $qi = $get_int(8);
        return new self($n, $e, $d, $p, $q, $dp, $dq, $qi);
    }
383620
public static function fromASN1(Sequence $seq): self
    {
        $issuer_policy = $seq->at(0)
            ->asObjectIdentifier()
            ->oid();
        $subject_policy = $seq->at(1)
            ->asObjectIdentifier()
            ->oid();
        return new self($issuer_policy, $subject_policy);
    }
1187013
public function setSequenceGenerator($sequenceName, $allocationSize = 1, $initialValue = 1)
    {
        $this->sequenceDef = array(
            'sequenceName' => $sequenceName,
            'allocationSize' => $allocationSize,
            'initialValue' => $initialValue,
        );
        return $this;
    }
557671
public static function fromASN1(Sequence $seq): self
    {
        $base = GeneralName::fromASN1($seq->at(0)->asTagged());
        $min = 0;
        $max = null;
        if ($seq->hasTagged(0)) {
            $min = $seq->getTagged(0)
                ->asImplicit(Element::TYPE_INTEGER)
                ->asInteger()
                ->intNumber();
        }
        if ($seq->hasTagged(1)) {
            $max = $seq->getTagged(1)
                ->asImplicit(Element::TYPE_INTEGER)
                ->asInteger()
                ->intNumber();
        }
        return new self($base, $min, $max);
    }
839224
public function toASN1(): Sequence
    {
        $elements = array(new ObjectIdentifier($this->_oid));
        if (count($this->_qualifiers)) {
            $qualifiers = array_map(
                function (PolicyQualifierInfo $pqi) {
                    return $pqi->toASN1();
                }, array_values($this->_qualifiers));
            $elements[] = new Sequence(...$qualifiers);
        }
        return new Sequence(...$elements);
    }
1121295
public function initial(int $to = 1): self
    {
        return $this->firstsImmutable(\count($this->getArray(), \COUNT_NORMAL) - $to);
    }
797876
public static function fromV2ASN1(Sequence $seq): self
    {
        $issuer = null;
        $cert_id = null;
        $digest_info = null;
        if ($seq->has(0, Element::TYPE_SEQUENCE)) {
            $issuer = GeneralNames::fromASN1($seq->at(0)->asSequence());
        }
        if ($seq->hasTagged(0)) {
            $cert_id = IssuerSerial::fromASN1(
                $seq->getTagged(0)
                    ->asImplicit(Element::TYPE_SEQUENCE)
                    ->asSequence());
        }
        if ($seq->hasTagged(1)) {
            $digest_info = ObjectDigestInfo::fromASN1(
                $seq->getTagged(1)
                    ->asImplicit(Element::TYPE_SEQUENCE)
                    ->asSequence());
        }
        $obj = new self($issuer);
        $obj->_baseCertificateID = $cert_id;
        $obj->_objectDigestInfo = $digest_info;
        return $obj;
    }
1252434
public function merge(self $sequence)
    {
        $sequenceArray = $sequence->toArray();

        $this->mergeArray($sequenceArray);

        return $this;
    }
608561
public FastqBuilder withSequence(final String sequence)
	{
		if (sequence == null)
		{
			throw new IllegalArgumentException("sequence must not be null");
		}
		if (this.sequence == null)
		{
			this.sequence = new StringBuilder(sequence.length());
		}
		this.sequence.replace(0, this.sequence.length(), sequence);
		return this;
	}
1193406
public function initializeSequence(int $committedSequence): void
    {
        assert($this->isEmpty(), 'Cannot initialize sequence after adding events');
        $this->committedSequence = $committedSequence;
    }
1324050
protected function incrementBySequence(array $values, $sequence)
    {
        $builder     = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 5)[3]['object'];
        $builderArgs = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 5)[2]['args'];

        if (! isset($builderArgs[1][0][$sequence])) {
            if ($builder instanceof EloquentBuilder) {
                /** @var \Yajra\Oci8\Eloquent\OracleEloquent $model */
                $model = $builder->getModel();
                /** @var \Yajra\Oci8\Oci8Connection $connection */
                $connection = $model->getConnection();
                if ($model->sequence && $model->incrementing) {
                    $values[] = (int) $connection->getSequence()->nextValue($model->sequence);
                }
            }
        }

        return $values;
    }
1034280
public function nextSequence($sequence, $ignore = array())
    {
        $i = $this->index+1;
        $len = count($this->tokens);
        $seqLen = count($sequence);
        $seq = 0;
        $seqStart = 0;
        while ($i < $len) {
            $tok = $this->tokens[$i][0];
            if ($tok === $sequence[$seq]) {
                if ($seq === 0) {
                    $seqStart = $i;
                }
                $seq++;
                $i++;
                if ($seq === $seqLen) {
                    return $seqStart;
                }
            } else {
                if (in_array($tok, $ignore)) {
                } else {
                    $seq = 0;
                }
                $i++;
            }
        }
        return $len;
    }
1019939
public static function fromASN1(Sequence $seq): GeneralNames
    {
        if (!count($seq)) {
            throw new \UnexpectedValueException(
                "GeneralNames must have at least one GeneralName.");
        }
        $names = array_map(
            function (UnspecifiedType $el) {
                return GeneralName::fromASN1($el->asTagged());
            }, $seq->elements());
        return new self(...$names);
    }
878945
public function toASN1(): Sequence
    {
        $elements = array_values(
            array_map(
                function ($ext) {
                    return $ext->toASN1();
                }, $this->_extensions));
        return new Sequence(...$elements);
    }
59467
function setSequenceVar()
    {
        if ( !$this->hasSequence() )
            return;

        $this->Tpl->setVariable( $this->SequenceVarName,  $this->Sequence->val(), $this->RootNamespace );
    }
789160
private function init($name, $first = 0)
    {
        if (null !== $this->find($name)) {
            throw new InvalidArgumentException(sprintf('Sequence with name %s already exists', $name));
        }

        if (false === Numeric::isPositiveInteger($first, false)) {
            throw new InvalidArgumentException('Initial value of a sequence must be a positive integer');
        }

        $query = 'INSERT INTO sequence (name, value) VALUE(:name, :value)';
        $params = array(
            'name'   => $name,
            'value'  => $first,
        );

        $this->getEntityManager()
            ->getConnection()
            ->executeUpdate($query, $params)
        ;

        return $first;
    }
691820
public void sequence(FA seq) {
        int idx;
        int relocation;

        relocation = append(seq);

        if (seq.start != -1) {
            for (idx = ends.first(); idx != -1; idx = ends.next(idx)) {
                states[idx].add(relocation + seq.start, null);
            }
        }

        ends.clear();
        for (idx = seq.ends.first(); idx != -1; idx = seq.ends.next(idx)) {
            ends.add(idx + relocation);
        }
    }