public void SendSignal <T>(T signal, SignalDirection direction) where T : ISignal { var type = typeof(T); if (_subscribeInfoDict.TryGetValue(type, out var infos)) { foreach (var callBack in infos) { callBack.Invoke(signal); } } switch (direction) { case SignalDirection.Upward: _parentNeuron?.SendSignal(signal, direction); break; case SignalDirection.Downward: foreach (var n in _childNeurons) { n.SendSignal(signal, direction); } break; case SignalDirection.Local: // do nothing break; default: throw new ArgumentOutOfRangeException(nameof(direction), direction, null); } }
/// <summary> /// Creates a new bus signal declaration /// </summary> /// <param name="source">The token source</param> /// <param name="name">The signal name</param> /// <param name="type">The signal type</param> /// <param name="initializer">The optional initializer</param> /// <param name="direction">The optional signal direction</param> public BusSignalDeclaration(ParseToken source, Identifier name, TypeName type, Expression initializer, SignalDirection direction) : base(source) { Name = name; Type = type; Initializer = initializer; Direction = direction; }
private RegisterType GetRegistryType(SignalDirection direction, bool discrete = false) { switch (direction) { case SignalDirection.Read: return(discrete ? RegisterType.BINARY_INPUT : RegisterType.ANALOG_INPUT); case SignalDirection.ReadWrite: return(discrete ? RegisterType.BINARY_OUTPUT : RegisterType.ANALOG_OUTPUT); case SignalDirection.Write: return(discrete ? RegisterType.BINARY_OUTPUT : RegisterType.ANALOG_OUTPUT); default: return(RegisterType.ANALOG_INPUT); } }
public void Draw(LetterView from, LetterView to, SignalDirection direction) { switch (direction) { case SignalDirection.In: DrawFirst(from, to); break; case SignalDirection.Out: DrawSecond(from, to); break; default: break; } }
public static SignalDirection GetDMSSignalDirection(SignalDirection signalDirection) { switch (signalDirection) { case SignalDirection.Read: return(SignalDirection.Read); case SignalDirection.ReadWrite: return(SignalDirection.ReadWrite); case SignalDirection.Write: return(SignalDirection.Write); default: return(SignalDirection.ReadWrite); } }
public void Draw(LetterView from, LetterView to, SignalDirection direction) { Point start = DrawerHelper.GetLocation(from, _grid, _xOffset, _yOffset); Point end = DrawerHelper.GetLocation(to, _grid, _xOffset, _yOffset); Point middlePoint = DrawerHelper.GetMiddlePoint(start, end); DrawerHelper.SetLine(_mainLineIn, start, middlePoint); DrawerHelper.SetLine(_mainLineOut, middlePoint, end); DrawerHelper.SetHorizontalLine(_firstLine, start, 5); DrawerHelper.SetHorizontalLine(_secondLine, end, 5); var v = new Vector(from.Width + 4, 0); DrawerHelper.SetHorizontalLine(_outFirstLine, start + v, 50); DrawerHelper.SetHorizontalLine(_outSecondLine, end + v, 50); }
public int NumBarGraphLED(SignalDirection orientation) { if (orientation == SignalDirection.ORIENTATION_FRONT) { return(FrontSignalNumberOfLEDs); } else if (orientation == SignalDirection.ORIENTATION_SIDE) { if (FrontSignalNumberOfLEDs > RearSignalNumberOfLEDs) { return(FrontSignalNumberOfLEDs); } else { return(RearSignalNumberOfLEDs); } } else if (orientation == SignalDirection.ORIENTATION_REAR) { return(RearSignalNumberOfLEDs); } return(4); }
public Task <Signal> CreateSignal(int value, bool step, SignalDirection direction) { return(Task.Run(() => new Signal(value, step, direction))); }
public LetterTranslation CreateTranslation(char from, char to, SignalDirection direction) { return(new LetterTranslation(from, to, direction)); }
public LetterTranslation(char input, char result, SignalDirection direction) { Input = input; Result = result; Direction = direction; }
/// <summary> /// Creates a new bus shape value /// </summary> /// <param name="type">The type of the signal</param> /// <param name="direction">The direction of the signal</param> public BusShapeValue(TypeName type, SignalDirection direction) { Type = type ?? throw new ArgumentNullException(nameof(type)); Direction = direction; }
private void SendTranslationToUI(char from, char to, SignalDirection direction) { var translation = _utilityFactory.CreateTranslation(from, to, direction); RotorAggregator.PublishOnUIThread(translation); }
public Signal(int value, bool step, SignalDirection direction) { Value = value; Step = step; Direction = direction; }