Exemplo n.º 1
0
        public FrozenPeriod(
			DateTime StartTime, DateTime EndTime, CompactionLevel Compaction)
        {
            this.StartTime = StartTime;
            this.EndTime = EndTime;
            this.Compaction = Compaction;
        }
Exemplo n.º 2
0
 public FrozenPeriod(
     DateTime StartTime, DateTime EndTime, CompactionLevel Compaction)
 {
     this.StartTime  = StartTime;
     this.EndTime    = EndTime;
     this.Compaction = Compaction;
 }
Exemplo n.º 3
0
        /// <summary>
        /// Partitions the given time period by its compaction level. The resulting
        /// sequence of compaction periods is ordered.
        /// </summary>
        public static Task <IEnumerable <FrozenPeriod> > PartitionByCompaction(
            DataConnection Connection, DateTime Start, DateTime End,
            CompactionLevel Compaction = CompactionLevel.None)
        {
            // Use '0' as a dummy sensor ID. We won't be looking at
            // the sensor's measurements, anyway.
            // TODO: maybe create a separate class for this.
            var cache = new AggregationCache(Connection, 0, Start, End);

            return(cache.PartitionByCompaction(Start, End, Compaction));
        }
Exemplo n.º 4
0
 public static CompactionLevel Min(CompactionLevel Left, CompactionLevel Right)
 {
     if ((int)Left > (int)Right)
     {
         return(Right);
     }
     else
     {
         return(Left);
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// Partitions the given time period by its compaction level. The resulting
        /// sequence of compaction periods is ordered. The given compaction level
        /// specifies the minimal compaction for this period of time.
        /// </summary>
        public async Task <IEnumerable <FrozenPeriod> > PartitionByCompaction(
            DateTime Start, DateTime End, CompactionLevel Compaction)
        {
            // Start with a single period of time,
            // and then subdivide that iteratively.
            var results = new List <FrozenPeriod>();

            results.Add(new FrozenPeriod(Start, End, Compaction));
            foreach (var item in await FetchFrozenPeriodsAsync())
            {
                var newResults = new List <FrozenPeriod>();
                foreach (var range in results)
                {
                    newResults.AddRange(SubdivideCompactionPeriod(range, item));
                }
                results = newResults;
            }
            return(results);
        }
Exemplo n.º 6
0
 public static CompactionLevel Min(CompactionLevel Left, CompactionLevel Right)
 {
     if ((int)Left > (int)Right)
         return Right;
     else
         return Left;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Partitions the given time period by its compaction level. The resulting
 /// sequence of compaction periods is ordered.
 /// </summary>
 public static Task<IEnumerable<FrozenPeriod>> PartitionByCompaction(
     DataConnection Connection, DateTime Start, DateTime End,
     CompactionLevel Compaction = CompactionLevel.None)
 {
     // Use '0' as a dummy sensor ID. We won't be looking at
     // the sensor's measurements, anyway.
     // TODO: maybe create a separate class for this.
     var cache = new AggregationCache(Connection, 0, Start, End);
     return cache.PartitionByCompaction(Start, End, Compaction);
 }
Exemplo n.º 8
0
		/// <summary>
		/// Partitions the given time period by its compaction level. The resulting
		/// sequence of compaction periods is ordered. The given compaction level
        /// specifies the minimal compaction for this period of time.
		/// </summary>
		public async Task<IEnumerable<FrozenPeriod>> PartitionByCompaction(
            DateTime Start, DateTime End, CompactionLevel Compaction)
		{
			// Start with a single period of time,
			// and then subdivide that iteratively.
			var results = new List<FrozenPeriod>();
            results.Add(new FrozenPeriod(Start, End, Compaction));
			foreach (var item in await FetchFrozenPeriodsAsync())
			{
				var newResults = new List<FrozenPeriod>();
				foreach (var range in results)
				{
					newResults.AddRange(SubdivideCompactionPeriod(range, item));
				}
				results = newResults;
			}
			return results;
		}