/// <summary>
        /// Gets all data points since the supplied data point.
        /// Points older than 500 ms will not be included.
        /// </summary>
        public IEnumerable <T> GetDataPointsSince(ITimestamped dataPoint)
        {
            var dataPointTimestamp = dataPoint.IsValid ? dataPoint.Timestamp : 0.0;

            return(_lastDataPoints.FindAll(point =>
                                           (point.Timestamp > dataPointTimestamp) &&
                                           (point.Timestamp > Time.unscaledTime - 0.5f)));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets all data points since the supplied data point.
        /// Points older than 500 ms will not be included.
        /// </summary>
        public IEnumerable <T> GetDataPointsSince(ITimestamped dataPoint)
        {
            var dataPointSequentialId = dataPoint.IsValid ? dataPoint.SequentialId : 0.0;

            lock (_lock)
            {
                return(_lastDataPoints.FindAll(point =>
                                               (point.SequentialId > dataPointSequentialId) &&
                                               (point.Timestamp > Time.time - 0.5f)));
            }
        }
Ejemplo n.º 3
0
        public override void Replace(TItem oldItem, TItem newItem)
        {
            if (oldItem is ITimestamped)
            {
                ITimestamped o = (ITimestamped)oldItem, n = (ITimestamped)newItem;
                if (n.LastUpdated <= o.LastUpdated)
                {
                    // Do nothing: old item is newer or same
                    return;
                }
            }

            ItemChange <TItem>[] changes;

            Debug.WriteLine("ThreadSafeAsyncLoader.Replace: Taking mutex");
            lock (mutex)
            {
                // NOTE: Cannot use LinqExtensions.Replace here, since we need to know which items
                // were replaced for event notifications
                changes = seq.Select(item =>
                {
                    if (identityComparer.Equals(item, oldItem))
                    {
                        return(new ItemChange <TItem>(ChangeType.Updated, newItem));
                    }
                    else
                    {
                        return(new ItemChange <TItem>(ChangeType.Unchanged, item));
                    }
                }).ToArray();

                // Perform replacement
                seq.ReplaceAll(changes.Select(c => c.Item));
            }
            Debug.WriteLine("ThreadSafeAsyncLoader.Replace: Released mutex");

            NotifyCollectionChanged(changes.Where(c => c.Type == ChangeType.Updated));
        }
Ejemplo n.º 4
0
 public static DateTime GetDateTimeInUTC(this ITimestamped timestampedObj) =>
 TimeZoneInfo.ConvertTimeToUtc(DateTime.Parse(timestampedObj.date + ' ' + timestampedObj.minute), EST);
Ejemplo n.º 5
0
 public IEnumerable <T> GetDataPointsSince(ITimestamped dataPoint)
 {
     return(new List <T>());
 }
Ejemplo n.º 6
0
 public int CompareTimestamps(ITimestamped a, ITimestamped b)
 {
     return(b.StartTime - a.StartTime);
 }
Ejemplo n.º 7
0
 public Interval(ITimestamped start, ITimestamped end, bool startIncluded, bool endIncluded) :
     this(start.Timestamp, end.Timestamp, startIncluded, endIncluded)
 {
 }