Ejemplo n.º 1
0
        static void ReadDataInternal()
        {
            var sb         = new StringBuilder();
            var enumerator = _storage.GetEnumerator();

            while (enumerator.MoveNext())
            {
                sb.Append($"{enumerator.Current}, ");
            }
            Console.WriteLine($"Peek result: {sb} count: {_counter}");
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Shortcut to thread safe enumeration of Concurrent Stacks
 /// </summary>
 /// <typeparam name="TVal"></typeparam>
 /// <param name="collection"></param>
 /// <param name="action"></param>
 public static void ForeachConcurrent <TVal>(
     this ConcurrentStack <TVal> collection,
     Action <TVal> action)
 {
     using (var enumerator = collection.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             action(enumerator.Current);
         }
     }
 }
Ejemplo n.º 3
0
        public void getData()
        {
            ConcurrentStack <DataCollectionStructure> activityTrackerData =
                ActivityTracker.getDataAndResetCollector();
            ConcurrentStack <DataCollectionStructure> userInteractionData =
                UserInteractionManager.getDataAndResetCollector();
            ConcurrentStack <DataCollectionStructure> urlFetcherService =
                URLFetcher.getDataAndResetCollector();

            IEnumerator <DataCollectionStructure> activityTrackerDataIterator = activityTrackerData.GetEnumerator();
            IEnumerator <DataCollectionStructure> userInteractionDataIterator = userInteractionData.GetEnumerator();
            IEnumerator <DataCollectionStructure> urlFetcherServiceIterator   = urlFetcherService.GetEnumerator();

            String data = "Activity Tracker: \r\n";

            while (activityTrackerDataIterator.MoveNext())
            {
                data += activityTrackerDataIterator.Current.ToString();
            }

            data += "\r\nUserInteraction:\r\n";
            while (userInteractionDataIterator.MoveNext())
            {
                data += userInteractionDataIterator.Current.ToString();
            }

            data += "\r\nURL fetcher:\r\n";
            while (urlFetcherServiceIterator.MoveNext())
            {
                data += urlFetcherServiceIterator.Current.ToString();
            }

            ScreenshotManager.takeScreenshot(localCacheFolder + "/photo.jpg");

            writeDataToFile(localCacheFolder + "/fisier.txt", data);
        }
Ejemplo n.º 4
0
 public IEnumerator <TItem> GetEnumerator()
 {
     return(_stack.GetEnumerator());
 }
Ejemplo n.º 5
0
 public void Reset()
 {
     DisposeStackEnumerator();
     DisposeQueueEnumerator();
     _stackEnumerator = _queues.GetEnumerator();
 }
Ejemplo n.º 6
0
 public static IEnumerator <T> GetEnumerator <T>(ConcurrentStack <T> concurrentStack)
 {
     ConcurrentCollectionHelper.Interleave();
     return(concurrentStack.GetEnumerator());
 }
Ejemplo n.º 7
0
 public IEnumerator <Screen> GetEnumerator()
 {
     return(_screens.GetEnumerator());
 }
Ejemplo n.º 8
0
 public IEnumerator <HistoryItem <T> > GetEnumerator()
 {
     return(_stack.GetEnumerator());
 }