private bool TraversePort(List <Guid> signals, List <Guid> ports, List <Guid> buses, Port port, Signal target, bool ignoreHold, IScanVisitor visitor) { bool again = true; if (!ports.Contains(port.InstanceId)) { again = false; ports.Add(port.InstanceId); } if (visitor.EnterPort(port, target, again, target == null)) { // LEAF PORT? if (port.InputSignalCount == 0 && port.BusCount == 0) { if (!visitor.VisitLeaf(port, again)) { return(false); // finished } } // HANDLE BUSES foreach (Bus b in port.Buses) { if (buses.Contains(b.InstanceId)) { if (!visitor.VisitLeaf(b, true)) { return(false); // finished } } else { buses.Add(b.InstanceId); if (!visitor.VisitLeaf(b, false)) { return(false); // finished } } } // HANDLE INPUT SIGNALS foreach (Signal s in port.InputSignals) { if (!TraverseSignal(signals, ports, buses, s, port, ignoreHold, visitor)) { return(false); // finished } } } return(visitor.LeavePort(port, target, again, target == null)); }
private bool TraversePort(List<Guid> ports, Port port, Signal target, bool ignoreHold, IScanVisitor visitor) { if(ports.Contains(port.InstanceId)) return true; ports.Add(port.InstanceId); if(visitor.EnterPort(port, target, false, target == null)) { foreach(Signal input in port.InputSignals) if(input != null && input.BehavesAsBeingDriven(ignoreHold)) if(!TraversePort(ports, input.DrivenByPort, input, ignoreHold, visitor)) return false; // finished } return visitor.LeavePort(port, target, false, target == null); }
private void TraverseRootPort(Stack <Guid> signals, Port rootPort, bool ignoreHold, IScanVisitor visitor) { if (visitor.EnterPort(rootPort, null, false, true)) { foreach (Bus b in rootPort.Buses) { if (!visitor.VisitLeaf(b, false)) { return; // finished } } foreach (Signal s in rootPort.InputSignals) { if (!TraverseSignal(signals, s, rootPort, ignoreHold, visitor)) { return; // finished } } } visitor.LeavePort(rootPort, null, false, true); }
private bool TraversePort(List <Guid> ports, Port port, Signal target, bool ignoreHold, IScanVisitor visitor) { if (ports.Contains(port.InstanceId)) { return(true); } ports.Add(port.InstanceId); if (visitor.EnterPort(port, target, false, target == null)) { foreach (Signal input in port.InputSignals) { if (input != null && input.BehavesAsBeingDriven(ignoreHold)) { if (!TraversePort(ports, input.DrivenByPort, input, ignoreHold, visitor)) { return(false); // finished } } } } return(visitor.LeavePort(port, target, false, target == null)); }
private bool TraversePort(List<Guid> signals, List<Guid> ports, List<Guid> buses, Port port, Signal target, bool ignoreHold, IScanVisitor visitor) { if(ports.Contains(port.InstanceId)) return true; ports.Add(port.InstanceId); if(visitor.EnterPort(port, target, false, target == null)) { // 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(buses.Contains(b.InstanceId)) continue; buses.Add(b.InstanceId); if(!visitor.VisitLeaf(b, false)) return false; // finished } // HANDLE INPUT SIGNALS foreach(Signal s in port.InputSignals) if(!TraverseSignal(signals, ports, buses, s, port, ignoreHold, visitor)) return false; // finished } return visitor.LeavePort(port, 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 void TraverseRootPort(Stack<Guid> signals, Port rootPort, bool ignoreHold, IScanVisitor visitor) { if(visitor.EnterPort(rootPort, null, false, true)) { foreach(Bus b in rootPort.Buses) if(!visitor.VisitLeaf(b, false)) return; // finished foreach(Signal s in rootPort.InputSignals) if(!TraverseSignal(signals, s, rootPort, ignoreHold, visitor)) return; // finished } visitor.LeavePort(rootPort, null, false, true); }
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); }