*/ protected $transitions = []; /** * Used to cache lookahead during parsing, not used during construction. * * @var IntervalSet|null */ public $nextTokenWithinRule; public function equals(object $other) : bool { if ($this === $other) { return true; } return $other instanceof static && $this->stateNumber === $other->stateNumber; } public function isNonGreedyExitState() : bool { return false; } /** * @return array */ public function getTransitions() : array { return $this->transitions; } public function getNumberOfTransitions() : int { return \count($this->transitions); } public function addTransition(Transition $trans, int $index = -1) : void { if (\count($this->transitions) === 0) { $this->epsilonOnlyTransitions = $trans->isEpsilon(); } elseif ($this->epsilonOnlyTransitions !== $trans->isEpsilon()) { $this->epsilonOnlyTransitions = false; } if ($index === -1) { $this->transitions[] = $trans; } else { \array_splice($this->transitions, $index, 1, [$trans]); } } public function getTransition(int $index) : Transition { return $this->transitions[$index]; } public function setTransition(Transition $trans, int $index) : void { $this->transitions[$index] = $trans; } /** * @param array $transitions */ public function setTransitions(array $transitions) : void { $this->transitions = $transitions; } public function removeTransition(int $index) : void { \array_splice($this->transitions, $index, 1); } public function onlyHasEpsilonTransitions() : bool { return $this->epsilonOnlyTransitions; } public function setRuleIndex(int $ruleIndex) : void { $this->ruleIndex = $ruleIndex; } public function __toString() : string { return (string) $this->stateNumber; } public function hashCode() : int { return $this->getStateType(); } abstract public function getStateType() : int; }