protected function computeNoTransitions() {
		$queue = [];
		$this->noTransitions = [];

		foreach ( $this->yesTransitions[0] as $ch => $toState ) {
			$queue[] = $toState;
			$this->noTransitions[$toState] = 0;
		}

		while ( true ) {
			$fromState = array_shift( $queue );
			if ( $fromState === null ) {
				break;
			}
			foreach ( $this->yesTransitions[$fromState] as $ch => $toState ) {
				$queue[] = $toState;
				$state = $this->noTransitions[$fromState];

				while ( $state !== 0 && empty( $this->yesTransitions[$state][$ch] ) ) {
					$state = $this->noTransitions[$state];
				}

				if ( isset( $this->yesTransitions[$state][$ch] ) ) {
					$noState = $this->yesTransitions[$state][$ch];
				} else {
					$noState = 0;
				}

				$this->noTransitions[$toState] = $noState;
				$this->outputs[$toState] = array_merge(
					$this->outputs[$toState], $this->outputs[$noState] );
			}
		}
	}
protected function computeNoTransitions() {
		$queue = [];
		$this->noTransitions = [];

		foreach ( $this->yesTransitions[0] as $ch => $toState ) {
			$queue[] = $toState;
			$this->noTransitions[$toState] = 0;
		}

		while ( true ) {
			$fromState = array_shift( $queue );
			if ( $fromState === null ) {
				break;
			}
			foreach ( $this->yesTransitions[$fromState] as $ch => $toState ) {
				$queue[] = $toState;
				$state = $this->noTransitions[$fromState];

				while ( $state !== 0 && empty( $this->yesTransitions[$state][$ch] ) ) {
					$state = $this->noTransitions[$state];
				}

				if ( isset( $this->yesTransitions[$state][$ch] ) ) {
					$noState = $this->yesTransitions[$state][$ch];
				} else {
					$noState = 0;
				}

				$this->noTransitions[$toState] = $noState;
				$this->outputs[$toState] = array_merge(
					$this->outputs[$toState], $this->outputs[$noState] );
			}
		}
	}
protected function computeNoTransitions ( ) { $ queue = [ ] ; $ this -> noTransitions = [ ] ; foreach ( $ this -> yesTransitions [ 0 ] as $ ch => $ toState ) { $ queue [ ] = $ toState ; $ this -> noTransitions [ $ toState ] = 0 ; } while ( true ) { $ fromState = array_shift ( $ queue ) ; if ( $ fromState === null ) { break ; } foreach ( $ this -> yesTransitions [ $ fromState ] as $ ch => $ toState ) { $ queue [ ] = $ toState ; $ state = $ this -> noTransitions [ $ fromState ] ; while ( $ state !== 0 && empty ( $ this -> yesTransitions [ $ state ] [ $ ch ] ) ) { $ state = $ this -> noTransitions [ $ state ] ; } if ( isset ( $ this -> yesTransitions [ $ state ] [ $ ch ] ) ) { $ noState = $ this -> yesTransitions [ $ state ] [ $ ch ] ; } else { $ noState = 0 ; } $ this -> noTransitions [ $ toState ] = $ noState ; $ this -> outputs [ $ toState ] = array_merge ( $ this -> outputs [ $ toState ] , $ this -> outputs [ $ noState ] ) ; } } }
Get the state transitions which the string-matching automaton
shall make when a partial match proves false.
Get the state transitions which the string - matching automaton shall make when a partial match proves false .