protected CODEvent ExtractMin() { if (CODEventQueue.Count != 0) { CODEvent minEvent = CODEventQueue.ElementAt(0); CODEventQueue.RemoveAt(0); return(minEvent); } else { return(null); } }
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()); } }
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; } } } }
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(); }