Exemplo n.º 1
0
        // *****************************************************************************
        // getter and setter methods
        // *****************************************************************************
        public virtual void ChangeEdgeNode(int direction, StatEdge edge, Statement value)
        {
            Dictionary <int, List <StatEdge> > mapEdges = direction == Direction_Backward ? mapPredEdges
                                 : mapSuccEdges;
            Dictionary <int, List <Statement> > mapStates = direction == Direction_Backward ?
                                                            mapPredStates : mapSuccStates;
            int type = edge.GetType();

            int[] arrtypes;
            if (type == StatEdge.Type_Exception)
            {
                arrtypes = new int[] { Statedge_All, StatEdge.Type_Exception };
            }
            else
            {
                arrtypes = new int[] { Statedge_All, Statedge_Direct_All, type };
            }
            foreach (int edgetype in arrtypes)
            {
                List <StatEdge> lst = mapEdges.GetOrNull(edgetype);
                if (lst != null)
                {
                    int index = lst.IndexOf(edge);
                    if (index >= 0)
                    {
                        mapStates.GetOrNull(edgetype)[index] = value;
                    }
                }
            }
            if (direction == Direction_Backward)
            {
                edge.SetSource(value);
            }
            else
            {
                edge.SetDestination(value);
            }
        }