private void BuildNetwork(IEnqueueCommand <NetworkCommand> commandQueue)
        {
            var node1 = new NodeIdentifier();
            var node2 = new NodeIdentifier();
            var node3 = new NodeIdentifier();

            var linkAttributes = new LinkAttributes(2, 2f);

            commandQueue.Enqueue(BuildAddNodeCommand(node1, 0, 0));
            commandQueue.Enqueue(BuildAddNodeCommand(node2, 4, 4));
            commandQueue.Enqueue(BuildAddNodeCommand(node3, -4, -4));

            commandQueue.Enqueue(new NetworkCommand.LinkNodes(node1, PortDirection.Right, node2, PortDirection.Bottom, linkAttributes));
            commandQueue.Enqueue(new NetworkCommand.LinkNodes(node1, PortDirection.Bottom, node3, PortDirection.Right, linkAttributes));
        }
Beispiel #2
0
        private void BuildNetwork(IEnqueueCommand <NetworkCommand> commandQueue)
        {
            var gateway   = new NodeIdentifier();
            var router    = new NodeIdentifier();
            var consumer1 = new NodeIdentifier();
            var consumer2 = new NodeIdentifier();
            var consumer3 = new NodeIdentifier();

            var linkAttributes = new LinkAttributes(2, 2f);

            commandQueue.Enqueue(new NetworkCommand.AddGatewayNode(gateway, new NodePosition(0, 4), 50));
            commandQueue.Enqueue(new NetworkCommand.AddRouterNode(router, new NodePosition(0, 0), 5));
            commandQueue.Enqueue(new NetworkCommand.AddConsumerNode(consumer1, new NodePosition(4, -4), 5));
            commandQueue.Enqueue(new NetworkCommand.AddConsumerNode(consumer2, new NodePosition(-4, -4), 5));
            commandQueue.Enqueue(new NetworkCommand.AddConsumerNode(consumer3, new NodePosition(0, -4), 5));

            commandQueue.Enqueue(new NetworkCommand.LinkNodes(gateway, PortDirection.Bottom, router, PortDirection.Top, new LinkAttributes(50, .5f)));
            commandQueue.Enqueue(new NetworkCommand.LinkNodes(router, PortDirection.Right, consumer1, PortDirection.Left, linkAttributes));
            commandQueue.Enqueue(new NetworkCommand.LinkNodes(router, PortDirection.Left, consumer2, PortDirection.Right, linkAttributes));
            commandQueue.Enqueue(new NetworkCommand.LinkNodes(router, PortDirection.Bottom, consumer3, PortDirection.Top, linkAttributes));
        }
 public ProcessNodeQueuePeriodically(NodeIdentifier nodeId, IEnqueueCommand <NetworkCommand> commandQueue, TimeSpan period)
 {
     Observable.Interval(period)
     .Subscribe(_ => commandQueue.Enqueue(new NetworkCommand.ProcessNodeQueue(nodeId)));
 }
Beispiel #4
0
 private void AddPacket(NodeIdentifier nodeId, IEnqueueCommand <NetworkCommand> commandQueue)
 {
     commandQueue.Enqueue(new NetworkCommand.AddPacket(new PacketIdentifier(), RandomPacketType, nodeId));
 }
 private void Initialize(NodeIdentifier nodeId, LinkIdentifier linkId)
 {
     commandQueue.Enqueue(new NetworkCommand.IncrementPacketTypeDirection(nodeId, PacketType.Red));
     commandQueue.Enqueue(new NetworkCommand.IncrementPacketTypeDirection(nodeId, PacketType.Blue));
     commandQueue.Enqueue(new NetworkCommand.IncrementPacketTypeDirection(nodeId, PacketType.Green));
 }
 private void StartWorkOnJob(JobIdentifier jobId)
 => _workshopCommands.Enqueue(new WorkshopCommand.StartWork(jobId));
Beispiel #7
0
 private void CompleteTransmission(PacketIdentifier packetId, LinkIdentifier linkId)
 {
     commandQueue.Enqueue(new NetworkCommand.CompleteTransmission(packetId, linkId));
 }