Esempio n. 1
0
        /// <summary>
        /// Find all entries in the response list that are not null and didnt timeout.
        /// </summary>
        /// <param name="results">response list</param>
        /// <param name="type">type of response to fetch</param>
        /// <returns>List of entries found</returns>
        public static ArrayList GetAllNonNullRsp(RspList results, Type type)
        {
            ArrayList list = new ArrayList();
            if (results == null)
                return null;

            Rsp rsp = null;
            for (int i = 0; i < results.size(); i++)
            {
                rsp = (Rsp)results.elementAt(i);

                if (rsp.wasSuspected())
                {
                    results.removeElementAt(i);
                    continue;
                }
                if (!rsp.wasReceived())
                {
                    results.removeElementAt(i);
                    continue;
                }

                if (rsp.Value != null && rsp.Value.GetType().Equals(type))
                {
                    list.Add(rsp);
                }
            }
            return list;
        }
Esempio n. 2
0
        /// <summary>
        /// Find first entry in the response list that is not null and didnt timeout.
        /// </summary>
        /// <param name="results">response list</param>
        /// <param name="type">type of response to fetch</param>
        /// <returns>found entry</returns>
        public static Rsp GetFirstNonNullRsp(RspList results, Type type)
        {
            if (results == null)
                return null;

            Rsp rsp = null;
            for (int i = 0; i < results.size(); i++)
            {
                rsp = (Rsp)results.elementAt(i);

                if (rsp.wasSuspected())
                {
                    
                    results.removeElementAt(i);
                    continue;
                }
                if (!rsp.wasReceived())
                {
                    
                    results.removeElementAt(i);
                    continue;
                }

                if (rsp.Value != null && rsp.Value.GetType().Equals(type)) return rsp;
            }
            return null;
        }