Revision 1c72663d src/eventlog/sequencechartfacade.cc

View differences:

src/eventlog/sequencechartfacade.cc
41 41

  
42 42
    smallestDuration = -1;
43 43
    largestDuration = -1;
44

  
45
    cachedParallelSet.clear();
44 46
}
45 47

  
46 48
void SequenceChartFacade::synchronize(FileReader::FileChangedState change)
......
745 747
{
746 748
    return getLargestParallelSetSize(event) <= threshold;
747 749
}
750
/*
751
 * Returns whether event is in the largest parallel set of selected.
752
 */
753
bool SequenceChartFacade::isParallelWithEvent(IEvent* event, IEvent* selected) {
754

  
755
    if (lastSelected != selected) {
756
        getLargestParallelSet(selected, &cachedParallelSet);
757
    }
758
    return cachedParallelSet.find((ptr_t)event) != cachedParallelSet.end();
759
}
748 760

  
749 761
unsigned int SequenceChartFacade::getLargestParallelSetSize(IEvent* event)
750 762
{
......
767 779
    return previousSize;
768 780
}
769 781

  
782
std::set<ptr_t>* SequenceChartFacade::getLargestParallelSet(IEvent* event, std::set<ptr_t>* parallelSet) {
783
    IEvent* prev = event;
784
    parallelSet->clear();
785
    while (prev)
786
    {
787
        getParallelSet(prev, parallelSet);
788
        if (parallelSet->find((ptr_t) event) == parallelSet->end())
789
        {
790
            break;
791
        }
792
        prev = prev->getPreviousEvent();
793
    }
794

  
795
    if (prev != event) {
796
        getParallelSet(prev->getNextEvent(), parallelSet);
797
    }
798
    return parallelSet;
799
}
800

  
770 801
void SequenceChartFacade::getParallelSet(IEvent* event,
771 802
        std::set<ptr_t>* parallelSet)
772 803
{

Also available in: Unified diff