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); } } }
public void Add(Network network) { if (Succesor == network.Head) { Succesor = new Device(network); Succesor.Succesor = network.Head; return; } Succesor.Add(network); }
public override void Handle(Receiver receiver) { if (receiver.BankTransfer) { Console.WriteLine("Выполняем банковский перевод"); } else if (Succesor != null) { Succesor.Handle(receiver); } }
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); } }
public override void Handle(Receiver receiver) { if (receiver.MoneyTransfer) { Console.WriteLine("Выполняем денежные переводы"); } else if (Succesor != null) { Succesor.Handle(receiver); } }
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); } } }
public override DifficultyType Handle(int value) { if (value == 1) { return(DifficultyType.Orta); } if (Succesor != null) { return(Succesor.Handle(value)); } throw new System.NotImplementedException(); }
public override QuestionType Handle(int value) { if (value == 1) { return(QuestionType.Test); } if (Succesor != null) { return(Succesor.Handle(value)); } throw new System.NotImplementedException(); }
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(); }
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); } }
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); } }
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); } } }
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; }
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 }
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); } }
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); }
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); } }