Beispiel #1
0
        public HttpResponseMessage getIdleAgent([FromBody] AgentRequest nAgentRequest)
        {
            AgentResult agentResult_ = new AgentResult();

            agentResult_.mErrorCode  = ConstAspect.mFail;
            agentResult_.mServerInfo = ServerAspect.getServerInfo(nAgentRequest.mOperatorName, nAgentRequest.mVersionNo, nAgentRequest.mServerId);
            agentResult_.mAgentIp    = "";
            agentResult_.mAgentPort  = "";

            int classify_ = 0;

            if (null != agentResult_.mServerInfo)
            {
                classify_ = agentResult_.mServerInfo.mClassify;
            }
            if (0 == classify_)
            {
                agentResult_.mErrorCode = ConstAspect.mServerId;
                return(toJson(agentResult_));
            }

            AgentInfo agentInfo_ = AgentAspect.getIdleAgent(nAgentRequest.mOperatorName, nAgentRequest.mVersionNo, classify_);

            if (null == agentInfo_)
            {
                agentResult_.mErrorCode = ConstAspect.mAgent;
                return(toJson(agentResult_));
            }
            agentResult_.mErrorCode = ConstAspect.mSucess;
            agentResult_.mAgentIp   = agentInfo_.mAgentIp;
            agentResult_.mAgentPort = agentInfo_.mAgentPort;
            return(toJson(agentResult_));
        }
Beispiel #2
0
	/// <summary>
	/// Initializes a new instance of the <see cref="DBDBOPAgent"/> class.
	/// </summary>
	/// <param name="_searchMaster">_search master.</param>
	/// <param name="_grid">_grid.</param>
	/// <param name="_startNode">_start node.</param>
	/// <param name="_targetNode">_target node.</param>
	/// <param name="_nodesToExpand">_nodes to expand.</param>
    public DBDBOPAgent(DynBiDirBeamPath _searchMaster, Node[,] _grid, Node _startNode, Node _targetNode, int _nodesToExpand)
    {
        searchMaster = _searchMaster;
        grid = _grid;
        startNode = _startNode;
        targetNode = _targetNode;
        nodesToExpand = _nodesToExpand;
        openSet = new Heap<Node>(grid.GetLength(0) * grid.GetLength(1));
        closedSet = new HashSet<Node>();
        agentResult = new AgentResult(false);
        doneEvent = new ManualResetEvent(false);
    }