private void Process_NOT_OK(Message message) { CPA Not_OK = message.cpa(); if (AgentView.contains(Not_OK)) { AgentView = Not_OK; AgentView_consistent = false; } else if (!AgentView.contains(Not_OK)) { if (message.SC() > AgentView.SC()) { AgentView = Not_OK; AgentView_consistent = false; } } }
private void Recieve_CPA(Message message) throws Exception { CPA cpa = message.cpa(); System.out.println( ID + "is running and AV is " + AgentView + " and AV_consi is " + AgentView_consistent); if (!AgentView_consistent) { if (cpa.contains(AgentView)) { backtrack(cpa); } else { AgentView_consistent = true; } } if (AgentView_consistent) { if (message.type() == "Backtrack_CPA") { cpa.remove_assignment(); assignCPA(cpa); } else { if (updateAgentView(cpa)) { assignCPA(cpa); } else { System.out.println( ID + "is running and AV is " + AgentView + " and cpa is " + cpa + " func recieve cpa"); backtrack(cpa); } } } }
private void ForwardCheck(Message message) throws InterruptedException { System.out.println("HELLO"); CPA fc_cpa = message.cpa(); if (message.SC() > AgentView.SC()) { if (!AgentView_consistent) { if (!fc_cpa.contains(new CPA(AgentView))) { AgentView_consistent = true; } } if (AgentView_consistent) { if (!updateAgentView(fc_cpa)) { send(new Message("Not_OK", AgentView), other_unassigned_agents_excep(ID, AgentView)); } } } }