/// <summary> /// Search for DFAgentDescription(s) that match the template passed as argument. /// </summary> /// <returns>The search.</returns> /// <param name="agentTemplate">DFAgentDescription template</param> /// <param name="constraints">Search constraints.</param> public DFAgentDescription[] Search(DFAgentDescription agentTemplate, SearchConstraints constraints) { // TODO: Make use of constraints List <DFAgentDescription> allMatchedAgent = new List <DFAgentDescription>(); foreach (DFAgentDescription existingAgent in this._yellowPages.Values) { // Check if agent has the same ID if (agentTemplate.GetAgentAID() == existingAgent.GetAgentAID()) { allMatchedAgent.Add(existingAgent); continue; } // Check if servive is available on one of the agents foreach (ServiceDescription srv in agentTemplate.GetServices()) { foreach (ServiceDescription srvYellowPage in existingAgent.GetServices()) { if (srv == srvYellowPage) { allMatchedAgent.Add(existingAgent); continue; } } } } return(allMatchedAgent.ToArray()); }
/// <summary> /// Search for a specific agent in AMS. /// </summary> /// <param name="agentTmpl">An agent description template</param> /// <param name="cstrnts">Search constraints</param> /// <returns>Array of results or null</returns> public AMSAgentDescription[] Search(AMSAgentDescription agentTmpl, SearchConstraints cstrnts) { List <AMSAgentDescription> similarAgents = new List <AMSAgentDescription>(); // TODO: Make use of search constraints foreach (AMSAgentDescription existingAgent in _activeAgents.Values) { if (existingAgent.GetAgentAID() == agentTmpl.GetAgentAID()) { similarAgents.Add(existingAgent); } } // TODO: Make use of services and other parameters return(similarAgents.ToArray()); }