Esempio n. 1
0
        /// <summary>
        /// Returns true if it added a new reocrd, false if updated a current record
        /// </summary>
        /// <param name="R"></param>
        /// <param name="CM"></param>
        /// <returns></returns>
        public bool Merge(Record R, CompoundRecord CM)
        {

            // Check to see if it exists //
            CompoundRecord cr;
            bool b = this._cache.TryGetValue(R, out cr);

            // If exists, then merge //
            if (b == true)
            {
                this._Reducers.Merge(CM, cr);
            }
            else
            {
                this._cache.Add(R, CM);
            }
            return !b;

        }
Esempio n. 2
0
        // Statics //
        /// <summary>
        /// Creates a compound record from a fat record; this is essentially the inverse of ToRecord
        /// </summary>
        /// <param name="R">A fat record to be transformed</param>
        /// <param name="Sig">An array of index values that define the size of a sub-element of the compound record</param>
        /// <returns>A compound record</returns>
        public static CompoundRecord FromRecord(Record R, int[] Sig)
        {

            CompoundRecord cr = new CompoundRecord(Sig.Length);
            int k = 0;

            for (int i = 0; i < Sig.Length; i++)
            {

                List<Cell> c = new List<Cell>();
                for (int j = 0; j < Sig[i]; j++)
                {
                    c.Add(R[k]);
                    k++;
                }
                cr[i] = new Record(c.ToArray());

            }

            return cr;

        }
Esempio n. 3
0
 public Record Evaluate(CompoundRecord WorkData)
 {
     List<Cell> c = new List<Cell>(this.Count);
     for (int i = 0; i < this.Count; i++)
     {
         c.Add(this._cache[i].Evaluate(WorkData[i]));
     }
     return new Record(c.ToArray());
 }
Esempio n. 4
0
 public void Merge(CompoundRecord WorkData, CompoundRecord MergeIntoWorkData)
 {
     for (int i = 0; i < this.Count; i++)
     {
         this._cache[i].Merge(WorkData[i], MergeIntoWorkData[i]);
     }
 }
Esempio n. 5
0
 public void Accumulate(CompoundRecord WorkData)
 {
     for (int i = 0; i < this.Count; i++)
     {
         this._cache[i].Accumulate(WorkData[i]);
     }
 }
Esempio n. 6
0
        public CompoundRecord Initialize()
        {
            
            CompoundRecord cr = new CompoundRecord(this.Count);
            for (int i = 0; i < this.Count; i++)
            {
                cr[i] = this._cache[i].Initialize();
            }
            return cr;

        }