Esempio n. 1
0
            public void AddStatesFromEnumerator(int?sourceState, LabeledTransitionEnumerator enumerator)
            {
                while (enumerator.MoveNext())
                {
                    if (!(enumerator.CurrentProbability > 0.0))
                    {
                        continue;
                    }

                    var transitionTargetNodeIndex = TransitionTargetToNodeIndex(enumerator.CurrentIndex);
                    var targetStateNodeIndex      = StateToNodeIndex(enumerator.CurrentTargetState);
                    _baseGraph.AddVerticesAndEdge(new Edge(transitionTargetNodeIndex, targetStateNodeIndex));

                    if (sourceState == null)
                    {
                        continue;
                    }
                    var sourceStateNodeIndex = StateToNodeIndex(sourceState.Value);
                    _baseGraph.AddVerticesAndEdge(new Edge(sourceStateNodeIndex, transitionTargetNodeIndex));
                }
            }
            public void AddStatesFromEnumerator(int?sourceState, LabeledTransitionEnumerator enumerator)
            {
                while (enumerator.MoveNext())
                {
                    // Cannot make the next validation check because such transitions might exist when many small probabilities are
                    // multiplied because of imprecise doubles arithmetic
                    //if (!(enumerator.CurrentProbability > 0.0))
                    //	continue;

                    var transitionTargetNodeIndex = TransitionTargetToNodeIndex(enumerator.CurrentIndex);
                    var targetStateNodeIndex      = StateToNodeIndex(enumerator.CurrentTargetState);
                    _baseGraph.AddVerticesAndEdge(new Edge(transitionTargetNodeIndex, targetStateNodeIndex));

                    if (sourceState == null)
                    {
                        continue;
                    }
                    var sourceStateNodeIndex = StateToNodeIndex(sourceState.Value);
                    _baseGraph.AddVerticesAndEdge(new Edge(sourceStateNodeIndex, transitionTargetNodeIndex));
                }
            }