Ejemplo n.º 1
0
        public void SerializeCache(Graph graph)
        {
            Graph.SerializedData serializedData = new Graph.SerializedData(graph);

            serializedData.States.Clear();
            serializedData.AnyStates.Clear();

            foreach (var node in Nodes)
            {
                if (node is State state)
                {
                    serializedData.States.Add(state);
                }
                else if (node is AnyState anyState)
                {
                    serializedData.AnyStates.Add(anyState);
                }
            }

            serializedData.Transitions.Clear();

            foreach (var transition in Transitions)
            {
                serializedData.Transitions.Add(transition);
            }
        }
Ejemplo n.º 2
0
        void CacheTransitions(Graph.SerializedData serializedData)
        {
            Transitions.Clear();

            foreach (var transition in serializedData.Transitions)
            {
                Transitions.Add(transition);
            }
        }
Ejemplo n.º 3
0
        public void BuildCache(Graph graph)
        {
            Graph.SerializedData serializedData = new Graph.SerializedData(graph);

            CacheNodes(serializedData);
            CacheTransitions(serializedData);
            BuildNodeDictionary();
            BuildTransitionDictionary();
        }
Ejemplo n.º 4
0
        void CacheNodes(Graph.SerializedData serializedData)
        {
            Nodes.Clear();

            foreach (var node in serializedData.States)
            {
                Nodes.Add(node);
            }

            foreach (var node in serializedData.AnyStates)
            {
                Nodes.Add(node);
            }
        }