Exemplo n.º 1
0
        public override (INonTerminalExpression parrentTag, string text) Parse(INonTerminalExpression parrentTag, string text)
        {
            int headerLevel = 0;

            if (text.Length > 0)
            {
                while (headerLevel < text.Length && text[headerLevel] == '#')
                {
                    headerLevel++;
                }
            }
            if (headerLevel <= 6 && headerLevel > 0)
            {
                parrentTag.Children.Add(new Header(headerLevel));
                return(parrentTag, text.Remove(0, headerLevel));
            }
            else
            {
                if (Succesor != null)
                {
                    return(Succesor.Parse(parrentTag, text));
                }
                else
                {
                    return(parrentTag, text);
                }
            }
        }
Exemplo n.º 2
0
 public void Add(Network network)
 {
     if (Succesor == network.Head)
     {
         Succesor          = new Device(network);
         Succesor.Succesor = network.Head;
         return;
     }
     Succesor.Add(network);
 }
Exemplo n.º 3
0
 public override void Handle(Receiver receiver)
 {
     if (receiver.BankTransfer)
     {
         Console.WriteLine("Выполняем банковский перевод");
     }
     else if (Succesor != null)
     {
         Succesor.Handle(receiver);
     }
 }
Exemplo n.º 4
0
 public void Print(Device head = null)
 {
     if (head is null)
     {
         head = this;
     }
     Console.WriteLine($"Geraet mit Addresse {NetAddress}: Anzahl Uploads/Downloads = {Upload}/{Download}");
     if (!Succesor.Equals(head))
     {
         Succesor.Print(head);
     }
 }
Exemplo n.º 5
0
        public override void Handle(Receiver receiver)
        {
            if (receiver.MoneyTransfer)
            {
                Console.WriteLine("Выполняем денежные переводы");
            }

            else if (Succesor != null)
            {
                Succesor.Handle(receiver);
            }
        }
Exemplo n.º 6
0
        public override void Handle(Receiver receiver)
        {
            if (receiver.PayPalTransfer)
            {
                Console.WriteLine("Выполняем переводы PayPal");
            }

            else if (Succesor != null)
            {
                Succesor.Handle(receiver);
            }
        }
 public override void Execute(Entities.VolarisReservation reservation, string securityToken)
 {
     if (ServiceCallSuccess(new FraudCheckService {
         Reservation = reservation, SecurityToken = securityToken
     }, MessageToSend))
     {
         if (Succesor != null)
         {
             Succesor.Execute(reservation, securityToken);
         }
     }
 }
Exemplo n.º 8
0
        public override DifficultyType Handle(int value)
        {
            if (value == 1)
            {
                return(DifficultyType.Orta);
            }

            if (Succesor != null)
            {
                return(Succesor.Handle(value));
            }

            throw new System.NotImplementedException();
        }
Exemplo n.º 9
0
        public override QuestionType Handle(int value)
        {
            if (value == 1)
            {
                return(QuestionType.Test);
            }

            if (Succesor != null)
            {
                return(Succesor.Handle(value));
            }

            throw new System.NotImplementedException();
        }
Exemplo n.º 10
0
        public override IAnswerPresenter Handle(int value)
        {
            if (value == 1 || value == 2)
            {
                return(new AbstractTrueFalseAnswerPresenter(null));
            }

            if (Succesor != null)
            {
                return(Succesor.Handle(value));
            }

            throw new System.NotImplementedException();
        }
Exemplo n.º 11
0
        private void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            var worker = (BackgroundWorker)sender;

            worker.DoWork             -= worker_DoWork;
            worker.ProgressChanged    -= _progressChangedEventHandler;
            worker.RunWorkerCompleted -= worker_RunWorkerCompleted;
            var parameter = (WorkerResultInfo)e.Result;

            if (parameter.TestingSubsetIndex.HasValue && parameter.NoOfSubsets.HasValue)
            {
                OnCompleteCallback?.Invoke();
                Succesor?.Start();
            }
        }
 public override void Execute(VolarisReservation reservation, string securityToken)
 {
     if (ServiceCallSuccess(new AirTicketPaymentService {
         Reservation = reservation, SecurityToken = securityToken
     }, MessageToSend))
     {
         if (Succesor != null)
         {
             Succesor.Execute(reservation, securityToken);
         }
     }
     else
     {
         IgnoreAndCloseSession(securityToken);
     }
 }
Exemplo n.º 13
0
        public override (string, INonTerminalExpression) ParseString(ParsingMode mode, INonTerminalExpression parrentNode, string text, char character)
        {
            if (mode == ParsingMode.Text)
            {
                text += character;
            }

            if (Succesor != null)
            {
                return(Succesor.ParseString(mode, parrentNode, text, character));
            }
            else
            {
                return(text, parrentNode);
            }
        }
 public override void Execute(VolarisReservation reservation, string securityToken)
 {
     if (ServiceCallSuccess(new SabreCommandService {
         SecurityToken = securityToken
     }, MessageToSend))
     {
         if (Succesor != null)
         {
             Succesor.Execute(reservation, securityToken);
         }
     }
     else
     {
         IgnoreAndCloseSession(securityToken);
     }
 }
 public override void Execute(VolarisReservation reservation, string securityToken)
 {
     if (ServiceCallSuccess(new AirPriceService {
         Reservation = reservation, SecurityToken = securityToken
     }, MessageToSend))
     {
         if (Succesor != null)
         {
             Succesor.Execute(reservation, securityToken);
         }
     }
     else
     {
         reservation.Status = VolarisReservationStatus.NotAccepted;
         IgnoreAndCloseSession(securityToken);
     }
 }
Exemplo n.º 16
0
 public override ParsingMode SwitchMode(ParsingMode mode, char character)
 {
     if (mode == ParsingMode.AddMediaNode && character != ')')
     {
         return(ParsingMode.Text);
     }
     else
     {
         if (Succesor != null)
         {
             return(Succesor.SwitchMode(mode, character));
         }
         else
         {
             return(mode);
         }
     }
 }
Exemplo n.º 17
0
 public void Insert(Network network, int netAddress)
 {
     if (NetAddress != netAddress)
     {
         if (network.CheckOverflow())
         {
             throw new Exception("Addresse konnte nicht gefunden werden");
         }
         Succesor.Insert(network, netAddress);
     }
     else
     {
         var tmp = new Device(network);
         tmp.Succesor = Succesor;
         Succesor     = tmp;
     }
     network.RunLength = 0; // reset
     return;
 }
Exemplo n.º 18
0
            public void Pop(Network network, int netAddress)
            {
                if (network.CheckOverflow())
                {
                    throw new Exception("Addresse konnte nicht gefunden werden");
                }

                if (!Succesor.NetAddress.Equals(netAddress))
                {
                    Succesor.Pop(network, netAddress);
                }
                else
                {
                    Succesor = Succesor.Succesor;
                }

                network.Size--;
                network.RunLength = 0; // reset
            }
Exemplo n.º 19
0
        public override void Execute(VolarisReservation reservation, string securityToken)
        {
            var service = new OpenSessionService {
                SecurityToken = securityToken
            };

            if (ServiceCallSuccess(service, MessageToSend))
            {
                if (Succesor != null)
                {
                    Succesor.Execute(reservation, service.SecurityToken);
                }
            }
            else
            {
                reservation.Status = VolarisReservationStatus.NotAccepted;
                CloseSession(service.SecurityToken);
            }
        }
Exemplo n.º 20
0
        public Graph ToGLEEGraph()
        {
            Graph g = new Graph("CFG");

            foreach (CFGNode Node in ListOfCfgNodes)
            {
                Node n = (Node)g.AddNode(Node.GetHashCode().ToString());
                n.Attr.Label = Node.ToString();
            }

            foreach (CFGNode Node in ListOfCfgNodes)
            {
                if (Node is CFGNodeProcedure)
                {
                    List <CFGNode> Succ = (Node as CFGNodeProcedure).Succesor;

                    foreach (CFGNode Succesor in Succ)
                    {
                        g.AddEdge(Node.GetHashCode().ToString(), Succesor.GetHashCode().ToString());
                    }
                }
                else if (Node is CFGNodeStmtConditional)
                {
                    g.AddEdge(Node.GetHashCode().ToString(), (Node as CFGNodeStmtConditional).FalseSuccesor.GetHashCode().ToString());
                    g.AddEdge(Node.GetHashCode().ToString(), (Node as CFGNodeStmtConditional).TrueSuccesor.GetHashCode().ToString());
                }
                else if (Node is CFGNodeError)
                {
                }
                else
                {
                    g.AddEdge(Node.GetHashCode().ToString(), Node.Succesor.GetHashCode().ToString());
                }
            }

            return(g);
        }
Exemplo n.º 21
0
        private void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            var worker = (BackgroundWorker)sender;

            worker.DoWork             -= worker_DoWork;
            worker.ProgressChanged    -= _progressChangedEventHandler;
            worker.RunWorkerCompleted -= worker_RunWorkerCompleted;
            var parameter = (WorkerResultInfo)e.Result;
            var network   = parameter.Network;

            var savePath = _trainingModel.NeuralNetworkPath;

            var nnModel = new NnModel
            {
                Path        = savePath,
                InputNodes  = string.Join(";", _trainingModel.TrainingData.InputVariables),
                OutputNodes = string.Join(";", _trainingModel.TrainingData.OutputVariables)
            };

            if (File.Exists(savePath))
            {
                File.Delete(savePath);
                _nnRepository.Update(nnModel);
            }
            else
            {
                _nnRepository.Add(nnModel);
            }

            network.Save(savePath);

            if (parameter.TestingSubsetIndex.HasValue && parameter.NoOfSubsets.HasValue)
            {
                OnCompleteCallback?.Invoke();
                Succesor?.Start(parameter.NoOfSubsets, parameter.TestingSubsetIndex);
            }
        }