コード例 #1
0
 protected CODEvent ExtractMin()
 {
     if (CODEventQueue.Count != 0)
     {
         CODEvent minEvent = CODEventQueue.ElementAt(0);
         CODEventQueue.RemoveAt(0);
         return(minEvent);
     }
     else
     {
         return(null);
     }
 }
コード例 #2
0
        protected void Insert(CODTuple q)
        {
            /*if (q.numberOfSucceedingNeighbour > neighbourThreshold)
             * {
             *  throw new Exception("错误,将SafeInlier插入了");
             * }*/
            CODEvent newCODEvent = new CODEvent(q, q.FindMinExpTime());

            if (newCODEvent.eventTrigger.eventTime != int.MaxValue)
            {
                CODEventQueue.Add(newCODEvent);
                CODEventQueue.Sort(new CODEventComparor());
            }
        }
コード例 #3
0
        public void DepartureNotDuplicateCompute(CODTuple oldTuple, int currentStep)
        {
            CODEvent x = FindMin();

            while (x != null && x.eventTrigger.eventTime < currentStep)
            {
                x = ExtractMin();
            }

            x = FindMin();
            if (x != null)
            {
                while (x.eventTrigger.eventTime == currentStep && FindMin() != null)
                {
                    if (FindMin().codTuple.preceedingNeighboursExpTime.Keys.Contains(oldTuple.tuple.ID))
                    {
                        x = ExtractMin();
                        ExtractCount++;
                        x.codTuple.DeleteFromPreceedingExpTime(oldTuple.tuple.ID);

                        if (x.codTuple.numberOfSucceedingNeighbour + x.codTuple.preceedingNeighboursExpTime.Count < neighbourThreshold)
                        {
                            AddToOutlier(x.codTuple.tuple);
                        }
                        else if (x.codTuple.numberOfSucceedingNeighbour < neighbourThreshold)
                        {
                            //update the event time for next check
                            Insert(x.codTuple);
                        }
                        else if (x.codTuple.numberOfSucceedingNeighbour >= neighbourThreshold)
                        {
                            SavedCount++;
                        }
                        x = FindMin();
                    }
                    else
                    {
                        MisCalTimeCount++;
                        break;
                    }
                }
            }
        }
コード例 #4
0
        public void DepartureWithNotConsiderSlideSpan(CODTuple oldTuple, int currentStep)
        {
            CODEvent x = FindMin();

            if (x != null)
            {
                while (x.eventTrigger.eventTime == currentStep && FindMin() != null)
                {
                    x = ExtractMin();
                    ExtractCount++;
                    if (x.codTuple.preceedingNeighboursExpTime.Keys.Contains(oldTuple.tuple.ID))
                    {
                        x.codTuple.DeleteFromPreceedingExpTime(oldTuple.tuple.ID);

                        if (x.codTuple.numberOfSucceedingNeighbour + x.codTuple.preceedingNeighboursExpTime.Count < neighbourThreshold)
                        {
                            AddToOutlier(x.codTuple.tuple);
                        }
                        else
                        {
                            //update the event time for next check
                            Insert(x.codTuple);
                        }
                        x = FindMin();
                    }
                    else
                    {
                        //把x加回去
                        CODEventQueue.Add(x);
                    }
                }
            }

            //free the memory
            oldTuple.Dispose();
        }