Exemple #1
0
        // TODO con quale timestamp si calcola?
        public void ComputeProximityCorrelation()
        {
            DateTime fromDate = new DateTime();
            DateTime toDate   = new DateTime();

            if (fromNode is FuzzyNodeCluster)
            {
                FuzzyNodeCluster fcn = (FuzzyNodeCluster)fromNode;
                DateTime         max = new DateTime();
                foreach (FuzzyNode fn in fcn.GetNodesInCluster())
                {
                    if (Convert.ToDateTime(fn.GetAttributes()["time:timestamp"][0]) > max)
                    {
                        max = Convert.ToDateTime(fn.GetAttributes()["time:timestamp"][0]);
                    }
                }
                fromDate = max;
            }
            else
            {
                fromDate = Convert.ToDateTime(fromNode.GetAttributes()["time:timestamp"][0]);
            }
            if (toNode is FuzzyNodeCluster)
            {
                FuzzyNodeCluster fcn = (FuzzyNodeCluster)toNode;
                DateTime         min = new DateTime();
                foreach (FuzzyNode fn in fcn.GetNodesInCluster())
                {
                    if (Convert.ToDateTime(fn.GetAttributes()["time:timestamp"][0]) < min)
                    {
                        min = Convert.ToDateTime(fn.GetAttributes()["time:timestamp"][0]);
                    }
                }
                fromDate = min;
            }
            else
            {
                toDate = Convert.ToDateTime(toNode.GetAttributes()["time:timestamp"][0]);
            }
            if ((fromDate != null) && (toDate != null))
            {
                long timeFrom = fromDate.Ticks;
                long timeTo   = toDate.Ticks;
                if (timeFrom != timeTo)
                {
                    proximityCorrelation = (1 / (timeFrom - timeTo));
                }
                else
                {
                    proximityCorrelation = 1;
                }
            }
            else
            {
                proximityCorrelation = 0;
            }
        }
Exemple #2
0
 public void RemoveCluster(FuzzyNodeCluster fnc)
 {
     clusters.Remove(fnc);
     nodes.Remove(fnc);
 }
Exemple #3
0
 public void AddCluster(FuzzyNodeCluster fnc)
 {
     clusters.Add(fnc);
     AddNode(fnc);
 }