Writes a sequence history to a string representation of the expression.

@param \Collection\Collection $sequences

@return string
197215
public function write(Collection $sequences)
    {
        $sequences = clone $sequences;
        $expression = '';
        if ($sequences->count() > 0) {
            $sequences = $sequences->reverse();

            $length = $sequences->count();
            for ($i = 0; $i < $length; $i++) {
                $sequence = $sequences[$i];
                if (isset($sequences[$i + 1])) {
                    $next = $sequences[$i + 1];
                } else {
                    $next = null;
                }
                $expression = $this->getNextPart($sequence[0], $sequence[1], $next) . $expression;
            }
        }

        return $expression;
    }
242912
public function addSequence(Sequence $sequence)
    {
        if ($this->hasSequence($sequence->getName())) {
            throw SchemaException::schemaSequenceAlreadyExists($this->getName(), $sequence->getName());
        }

        $this->sequences[$sequence->getName()] = $sequence;
    }
753639
public function insertGetId(array $values, $sequence = null)
	{
		$result = $this->collection->insert($values);
		return $result['_id'];
	}
758967
public function setSequences(array $sequences)
    {
        $this->sequences = array();

        foreach ($sequences as $sequence) {
            $this->addSequence($sequence);
        }
    }
1285026
public void fitOnSequences(Integer[][] sequences) {
        documentCount += 1;
        for (Integer[] sequence: sequences) {
            Set<Integer> sequenceSet = new HashSet<>(Arrays.asList(sequence));
            for (Integer index: sequenceSet)
                indexDocs.put(index, indexDocs.get(index) + 1);
        }
    }
1328976
private function parseEscapeSequence()
    {
        $sequence = "'" === $this->next || '"' === $this->next
            ? $this->next
            : '\\'.$this->next;

        $this->next();
        $this->next();

        return $sequence;
    }
881202
private function _lockSequence($sequence)
    {
        $result = $this->_connection->execute(
            "SELECT id FROM sequences WHERE name=? FOR UPDATE", $sequence);

        switch (count($result)) {
            case 0:
                // sequence not in table; insert and use startId value
                $this->_connection->execute(
                    "INSERT INTO sequences VALUES (?,?)",
                    $sequence, $this->_startId);
                $id = $this->_startId;
                break;

            case 1:
                // sequence already in table; remember its current ID
                $id = $result[0]['id'];
                break;

            default:
                // multiple rows for sequence; bad
                throw new \Pheasant\Exception("Multiple rows exist for sequence '$sequence'");
                break;
        }

        return $id;
    }
598130
public function toASN1(): Sequence
    {
        $elements = array($this->_base->toASN1());
        if (isset($this->_min) && $this->_min != 0) {
            $elements[] = new ImplicitlyTaggedType(0, new Integer($this->_min));
        }
        if (isset($this->_max)) {
            $elements[] = new ImplicitlyTaggedType(1, new Integer($this->_max));
        }
        return new Sequence(...$elements);
    }
849320
private function getSequenceCacheSQL(Sequence $sequence)
    {
        if ($sequence->getCache() === 0) {
            return ' NOCACHE';
        }

        if ($sequence->getCache() === 1) {
            return ' NOCACHE';
        }

        if ($sequence->getCache() > 1) {
            return ' CACHE ' . $sequence->getCache();
        }

        return '';
    }
632881
public function getLastInsID($sequence = null)
    {
        if ($sequence === null) {
            return '';
        }
        $pdo    = $this->linkID->query("select {$sequence}.currval as id from dual");
        $result = $pdo->fetchColumn();
        return $result;
    }
139176
public function insertGetId(array $values, $sequence = null)
    {
        $result = $this->collection->insertOne($values);

        if (1 == (int) $result->isAcknowledged()) {
            if (is_null($sequence)) {
                $sequence = '_id';
            }

            // Return id
            return $sequence == '_id' ? trim($result->getInsertedId()) : $values[$sequence];
        }

        return null;
    }
126247
public List<List<Writable>> transformRawStringsToInputSequence(List<List<String>> sequence) {
        List<List<Writable>> ret = new ArrayList<>();
        for(List<String> input : sequence)
            ret.add(transformRawStringsToInputList(input));
        return ret;
    }
432045
public function dropSequence($sequence)
    {
        $changeSetElt = $this->createChangeSet('drop-sequence-' . $sequence->getName());

        $sequenceName = QualifiedName::fromAsset($sequence);
        $dropSequenceElt = $this->document->createElement('dropSequence');

        if ($sequenceName->getNamespaceName()) {
            $dropSequenceElt->setAttribute('schemaName', $sequenceName->getNamespaceName());
        }

        $dropSequenceElt->setAttribute('sequenceName', $sequenceName->getName());

        $changeSetElt->appendChild($dropSequenceElt);
        $this->root->appendChild($changeSetElt);
    }
1296936
public function insertGetId(array $values, $sequence = null)
    {
        foreach(event(new QueryInsert($this, $values)) as $attributes){

            $values = array_merge($values, $attributes);

        }

        return parent::insertGetid($values, $sequence);
    }
871314
public String[] sequencesToTexts(Integer[][] sequences) {
        Integer oovTokenIndex  = wordIndex.get(outOfVocabularyToken);
        ArrayList<String> texts = new ArrayList<>();
        for (Integer[] sequence: sequences) {
            ArrayList<String> wordVector = new ArrayList<>();
            for (Integer index: sequence) {
                if (indexWord.containsKey(index)) {
                    String word = indexWord.get(index);
                    if (numWords != null && index >= numWords) {
                        if (oovTokenIndex != null) {
                            wordVector.add(indexWord.get(oovTokenIndex));
                        } else {
                            wordVector.add(word);
                        }
                    }
                } else if (oovTokenIndex != null) {
                    wordVector.add(indexWord.get(oovTokenIndex));
                }
            }
            StringBuilder builder = new StringBuilder();
            for (String word: wordVector) {
                builder.append(word + split);
            }
            String text = builder.toString();
            texts.add(text);
        }
        return texts.toArray(new String[texts.size()]);
    }
1252434
public function merge(self $sequence)
    {
        $sequenceArray = $sequence->toArray();

        $this->mergeArray($sequenceArray);

        return $this;
    }
721282
public static function flatten (array $sequence)
    {
        $flat = array();
        array_walk_recursive($sequence, function ($element) use (&$flat) { $flat []= $element; });
        return $flat;
    }