private void TransDrawer_TransitionRangeSelectChanged(TransitionRange tr) { grdProperties.SelectedObject = null; if (tr != null) { grdProperties.SelectedObject = tr.OwnerTrans; } else if (ProjectDoc.Instance.SelectedElementInfo != null) { grdProperties.SelectedObject = ProjectDoc.Instance.SelectedElementInfo; } }
public FSMLexerBuilder <N> RangeTransitionTo(char start, char end, int toNode) { AbstractTransitionCheck checker = new TransitionRange(start, end); if (!Fsm.HasState(toNode)) { Fsm.AddNode(); } var transition = new FSMTransition(checker, CurrentState, toNode); Fsm.AddTransition(transition); CurrentState = toNode; return(this); }
/// <summary> /// Adds the <paramref name="state" /> and all of its <see cref="transitions" /> to the state graph. /// </summary> /// <param name="state">The state that should be added.</param> /// <param name="isInitial">Indicates whether the state is an initial state.</param> /// <param name="transitions">The transitions leaving the state.</param> /// <param name="transitionCount">The number of valid transitions leaving the state.</param> internal void AddStateInfo(int state, bool isInitial, TransitionCollection transitions, int transitionCount) { Assert.That(!isInitial || _initialTransitionCount == 0, "Initial transitions can only be added once."); if (isInitial) _initialTransitionCount = transitionCount; else Interlocked.Increment(ref _stateCount); Interlocked.Add(ref _transitionCount, transitionCount); // Transitions are synchronized by atomatically incrementing the offset counter var offset = InterlockedExtensions.AddFetch(ref _transitionOffset, transitionCount); if (offset + transitionCount > _transitionCapacity) throw new OutOfMemoryException("Unable to store transitions. Try increasing the transition capacity."); // No need to synchronize state addition, as all states are only discovered once if (!isInitial) _stateMap[state] = new TransitionRange { StartIndex = offset, Count = transitionCount }; // Copy the transitions into the buffer foreach (var transition in transitions) { Assert.That(((CandidateTransition*)transition)->IsValid, "Attempted to add an invalid transition."); MemoryBuffer.Copy((byte*)transition, _transitions + offset * TransitionSize, TransitionSize); ++offset; } }