Example #1
0
        /// <summary>
        /// returns a graph containing events separated by a time less than the given interval
        /// </summary>
        /// <param name="maximum_temoral_separation_sec">maximum time between events</param>
        /// <returns>graph object</returns>
        public UsageGraph GetCommonSequences(float maximum_temoral_separation_sec)
        {
            double maximum_temoral_separation_mS = maximum_temoral_separation_sec * 1000;

            UsageGraph graph = new UsageGraph();

            for (int i = 0; i < Nodes.Count; i++)
            {
                UsageNode n = (UsageNode)Nodes[i];
                for (int j = 0; j < n.Links.Count; j++)
                {
                    UsageLink lnk         = (UsageLink)n.Links[j];
                    double    duration_mS = lnk.GetAverageDuration();
                    if (duration_mS < maximum_temoral_separation_mS)
                    {
                        graph.Update(n.Name);
                        graph.Update(lnk.From.Name);
                        graph.Reset();
                    }
                }
            }

            return(graph);
        }
Example #2
0
        /// <summary>
        /// returns a graph containing events separated by a time less than the given interval
        /// </summary>
        /// <param name="maximum_temoral_separation_sec">maximum time between events</param>
        /// <returns>graph object</returns>
        public UsageGraph GetCommonSequences(float maximum_temoral_separation_sec)
        {
            double maximum_temoral_separation_mS = maximum_temoral_separation_sec * 1000;

            UsageGraph graph = new UsageGraph();

            for (int i = 0; i < Nodes.Count; i++)
            {
                UsageNode n = (UsageNode)Nodes[i];
                for (int j = 0; j < n.Links.Count; j++)
                {
                    UsageLink lnk = (UsageLink)n.Links[j];
                    double duration_mS = lnk.GetAverageDuration();
                    if (duration_mS < maximum_temoral_separation_mS)
                    {
                        graph.Update(n.Name);
                        graph.Update(lnk.From.Name);
                        graph.Reset();
                    }
                }
            }

            return (graph);
        }
        /// <summary>
        /// returns true if the given address is an IP address
        /// </summary>
        /// <param name="nameOrAddress">host name or IP address</param>
        /// <returns>true if the given address is an IP address</returns>
        private bool isIPAddress(string nameOrAddress)
        {
            bool is_ip = true;

            nameOrAddress = nameOrAddress.Trim();
            int i = 0;

            while ((i < nameOrAddress.Length) && (is_ip))
            {
                char c = Convert.ToChar(nameOrAddress.Substring(i, 1));
                if (!((c == '.') || ((c >= 48) && (c <= 57))))
                {
                    is_ip = false;
                }
                i++;
            }

            if (is_ip)
            {
                usage.Update(nameOrAddress + " is an IP address, SurveyorVisionClient, isIPAddress");
            }
            else
            {
                usage.Update(nameOrAddress + " is not an IP address, SurveyorVisionClient, isIPAddress");
            }

            return(is_ip);
        }