<commit_before><?php

namespace PhpDisruptor;

use PhpDisruptor\Lists\SequenceList;
use PhpDisruptor\Pthreads\StackableArray;
use PhpDisruptor\Pthreads\UuidStackable;
use PhpDisruptor\WaitStrategy\WaitStrategyInterface;

require_once __DIR__ . '/Exception/AlertException.php'; // @todo: why is this required ???

final class ProcessingSequenceBarrier extends UuidStackable implements SequenceBarrierInterface
{
    /**
     * @var WaitStrategyInterface
     */
    public $waitStrategy;

    /**
     * @var Sequence
     */
    public $dependentSequence;

    /**
     * @var bool
     */
    public $alerted;

    /**
     * @var Sequence
     */
    public $cursorSequence;

    /**
     * @var SequencerInterface
     */
    public $sequencer;

    /**
     * @var string
     */
    public $hash;

    /**
     * Constructor
     *
     * @param SequencerInterface $sequencer
     * @param WaitStrategyInterface $waitStrategy
     * @param Sequence $cursorSequence
     * @param SequenceList $dependentSequences
     */
    public function __construct(
        SequencerInterface $sequencer,
        WaitStrategyInterface $waitStrategy,
        Sequence $cursorSequence,
        SequenceList $dependentSequences
    ) {
        parent::__construct();
        $this->sequencer = $sequencer;
        $this->waitStrategy = $waitStrategy;
        $this->cursorSequence = $cursorSequence;
        if (0 == count($dependentSequences)) {
            $this->dependentSequence = $cursorSequence;
        } else {
            $this->dependentSequence = new FixedSequenceGroup($dependentSequences);
        }
        $this->alerted = false;
    }

    /**
     * Wait for the given sequence to be available for consumption.
     *
     * @param int $sequence to wait for
     * @return int the sequence up to which is available
     * @throws Exception\AlertException if a status change has occurred for the Disruptor
     * @throws Exception\InterruptedException if the thread needs awaking on a condition variable.
     * @throws Exception\TimeoutException
     */
    public function waitFor($sequence)
    {
        $this->checkAlert();

        $availableSequence = $this->waitStrategy->waitFor(
            $sequence,
            $this->cursorSequence,<commit_msg>autoload exception during construct of processing sequence barrier<commit_after><?php

namespace PhpDisruptor;

use PhpDisruptor\Exception;
use PhpDisruptor\Lists\SequenceList;
use PhpDisruptor\Pthreads\UuidStackable;
use PhpDisruptor\WaitStrategy\WaitStrategyInterface;

final class ProcessingSequenceBarrier extends UuidStackable implements SequenceBarrierInterface
{
    /**
     * @var WaitStrategyInterface
     */
    public $waitStrategy;

    /**
     * @var Sequence
     */
    public $dependentSequence;

    /**
     * @var bool
     */
    public $alerted;

    /**
     * @var Sequence
     */
    public $cursorSequence;

    /**
     * @var SequencerInterface
     */
    public $sequencer;

    /**
     * @var string
     */
    public $hash;

    /**
     * Constructor
     *
     * @param SequencerInterface $sequencer
     * @param WaitStrategyInterface $waitStrategy
     * @param Sequence $cursorSequence
     * @param SequenceList $dependentSequences
     */
    public function __construct(
        SequencerInterface $sequencer,
        WaitStrategyInterface $waitStrategy,
        Sequence $cursorSequence,
        SequenceList $dependentSequences
    ) {
        // @todo: why is this required ???
        if (!class_exists('PhpDisruptor\Exception\AlertException', false)) {
            spl_autoload_call('PhpDisruptor\Exception\AlertException');
        }
        parent::__construct();
        $this->sequencer = $sequencer;
        $this->waitStrategy = $waitStrategy;
        $this->cursorSequence = $cursorSequence;
        $this->alerted = false;

        if (0 == count($dependentSequences)) {
            $this->dependentSequence = $cursorSequence;
        } else {
            $this->dependentSequence = new FixedSequenceGroup($dependentSequences);
        }
    }

    /**
     * Wait for the given sequence to be available for consumption.
     *
     * @param int $sequence to wait for
     * @return int the sequence up to which is available
     * @throws Exception\AlertException if a status change has occurred for the Disruptor
     * @throws Exception\InterruptedException if the thread needs awaking on a condition variable.
     * @throws Exception\TimeoutException
     */
    public function waitFor($sequence)
    {
        $this->checkAlert();

        $availableSequence = $this->waitStrategy->waitFor(
            $sequence,
            $this->cursorSequence,
{'fraction_non_alphanumeric': 0.09512612227447627, 'fraction_numerical': 0.00042753313381787086, 'mean_word_length': 2.579954093343535, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '2359282', 'n_tokens_mistral': 1261, 'n_tokens_neox': 1227, 'n_words': 305}