Exemplo n.º 1
0
        private bool TraverseSignal(List <Guid> signals, List <Guid> ports, List <Guid> buses, Signal signal, Port target, bool ignoreHold, IScanVisitor visitor)
        {
            if (signal == null || signals.Contains(signal.InstanceId))
            {
                return(true);
            }
            signals.Add(signal.InstanceId);

            if (visitor.EnterSignal(signal, target, false, target == null))
            {
                // LEAF SIGNAL?
                if (!signal.BehavesAsBeingDriven(ignoreHold))
                {
                    if (!visitor.VisitLeaf(signal, false))
                    {
                        return(false); // finished
                    }
                }
                else // HANDLE PORT
                {
                    TraversePort(signals, ports, buses, signal.DrivenByPort, signal, ignoreHold, visitor);
                }
            }
            return(visitor.LeaveSignal(signal, target, false, target == null));
        }
Exemplo n.º 2
0
 private bool TraverseSignal(List<Guid> signals, Signal signal, Port target, bool ignoreHold, IScanVisitor visitor)
 {
     if(signal == null || signals.Contains(signal.InstanceId))
         return true;
     signals.Add(signal.InstanceId);
     if(visitor.EnterSignal(signal, target, false, target == null))
     {
         if(signal.BehavesAsBeingDriven(ignoreHold))
         {
             Port port = signal.DrivenByPort;
             foreach(Signal input in port.InputSignals)
                 if(!TraverseSignal(signals, input, port, ignoreHold, visitor))
                     return false; // finished
         }
     }
     return visitor.LeaveSignal(signal, target, false, target == null);
 }
Exemplo n.º 3
0
 private bool TraverseSignal(List <Guid> signals, Signal signal, Port target, bool ignoreHold, IScanVisitor visitor)
 {
     if (signal == null || signals.Contains(signal.InstanceId))
     {
         return(true);
     }
     signals.Add(signal.InstanceId);
     if (visitor.EnterSignal(signal, target, false, target == null))
     {
         if (signal.BehavesAsBeingDriven(ignoreHold))
         {
             Port port = signal.DrivenByPort;
             foreach (Signal input in port.InputSignals)
             {
                 if (!TraverseSignal(signals, input, port, ignoreHold, visitor))
                 {
                     return(false); // finished
                 }
             }
         }
     }
     return(visitor.LeaveSignal(signal, target, false, target == null));
 }
        private bool TraverseSignal(List<Guid> signals, List<Guid> ports, List<Guid> buses, Signal signal, Port target, bool ignoreHold, IScanVisitor visitor)
        {
            if(signal == null || signals.Contains(signal.InstanceId))
                return true;
            signals.Add(signal.InstanceId);

            if(visitor.EnterSignal(signal, target, false, target == null))
            {
                // LEAF SIGNAL?
                if(!signal.BehavesAsBeingDriven(ignoreHold))
                {
                    if(!visitor.VisitLeaf(signal, false))
                        return false; // finished
                }
                else // HANDLE PORT
                {
                    TraversePort(signals, ports, buses, signal.DrivenByPort, signal, ignoreHold, visitor);
                }
            }
            return visitor.LeaveSignal(signal, target, false, target == null);
        }
        private bool TraverseSignal(Stack <Guid> signals, Signal signal, Port target, bool ignoreHold, IScanVisitor visitor)
        {
            if (signal == null)
            {
                return(true);
            }

            if (visitor.EnterSignal(signal, target, false, target == null))
            {
                signals.Push(signal.InstanceId);

                // HANDLE PORT
                if (signal.BehavesAsBeingDriven(ignoreHold))
                {
                    Port port = signal.DrivenByPort;

                    if (visitor.EnterPort(port, signal, false, false))
                    {
                        // LEAF PORT?
                        if (port.InputSignalCount == 0 && port.BusCount == 0)
                        {
                            if (!visitor.VisitLeaf(port, false))
                            {
                                return(false); // finished
                            }
                        }
                        // HANDLE BUSES
                        foreach (Bus b in port.Buses)
                        {
                            if (!visitor.VisitLeaf(b, false))
                            {
                                return(false); // finished
                            }
                        }
                        // HANDLE INPUT SIGNALS
                        foreach (Signal s in port.InputSignals)
                        {
                            if (signals.Contains(s.InstanceId))
                            {
                                if (!visitor.VisitCycle(port, signal, s))
                                {
                                    return(false); //finished
                                }
                            }
                            else if (!TraverseSignal(signals, s, port, ignoreHold, visitor))
                            {
                                return(false); // finished
                            }
                        }
                    }
                    if (!visitor.LeavePort(port, signal, false, false))
                    {
                        return(false); // finished
                    }
                }
                else if (!visitor.VisitLeaf(signal, false))
                {
                    return(false); // finished
                }
                signals.Pop();
            }
            return(visitor.LeaveSignal(signal, target, false, target == null));
        }
        private bool TraverseSignal(Stack<Guid> signals, Signal signal, Port target, bool ignoreHold, IScanVisitor visitor)
        {
            if(signal == null)
                return true;

            if(visitor.EnterSignal(signal, target, false, target == null))
            {
                signals.Push(signal.InstanceId);

                // HANDLE PORT
                if(signal.BehavesAsBeingDriven(ignoreHold))
                {
                    Port port = signal.DrivenByPort;

                    if(visitor.EnterPort(port, signal, false, false))
                    {
                        // LEAF PORT?
                        if(port.InputSignalCount == 0 && port.BusCount == 0)
                            if(!visitor.VisitLeaf(port, false))
                                return false; // finished

                        // HANDLE BUSES
                        foreach(Bus b in port.Buses)
                            if(!visitor.VisitLeaf(b, false))
                                return false; // finished

                        // HANDLE INPUT SIGNALS
                        foreach(Signal s in port.InputSignals)
                        {
                            if(signals.Contains(s.InstanceId))
                            {
                                if(!visitor.VisitCycle(port, signal, s))
                                    return false; //finished
                            }
                            else if(!TraverseSignal(signals, s, port, ignoreHold, visitor))
                                return false; // finished
                        }
                    }
                    if(!visitor.LeavePort(port, signal, false, false))
                        return false; // finished
                }
                else if(!visitor.VisitLeaf(signal, false))
                    return false; // finished

                signals.Pop();
            }
            return visitor.LeaveSignal(signal, target, false, target == null);
        }