Ejemplo n.º 1
0
        public bool TryGetValue(TJoinKey key, out IDimRow <TJoinKey> value)
        {
            IDimRow <TJoinKey> hit;

            if (this.m_dict.TryGetValue(key, out hit))
            {
                hit.LastHitTime = DateTime.UtcNow;
                this.m_rowPriorityQueue.Replace(hit.Handle, hit);
                value = hit;
                return(true);
            }
            else
            {
                value = null;
                return(false);
            }
        }
Ejemplo n.º 2
0
            public override int Compare(IDimRow <TJoinKey> x, IDimRow <TJoinKey> y)
            {
                TimeSpan span = x.LastHitTime - y.LastHitTime;

                if (span.Ticks < 0)
                {
                    return(-1);
                }
                else if (span.Ticks > 0)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            }
Ejemplo n.º 3
0
        public bool TryAdd(TJoinKey key, IDimRow <TJoinKey> row)
        {
            if (this.m_dict.ContainsKey(key))
            {
                return(false);
            }
            else
            {
                this.m_dict.Add(key, row);
                IPriorityQueueHandle <IDimRow <TJoinKey> > handle = null;
                this.m_rowPriorityQueue.Add(ref handle, row);
                row.Handle = handle;

                while (this.m_dict.Count > this.m_sizeLimit)
                {
                    var discardRow = this.m_rowPriorityQueue.DeleteMin();
                    this.m_dict.Remove(discardRow.JoinOn);
                }
                return(true);
            }
        }
Ejemplo n.º 4
0
 protected override void OnSuccessfulLookup(OrderEx input, IDimRow <string> rowInDimTable)
 {
     //what we want is just the key column of the dimension row
     input.ProductKey = rowInDimTable.AutoIncrementKey;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// The function to call when an input item finds a row in the dimension table by joining condition.
 /// Usually the implementation of this method should assign to some fields/properties(e.g. key column) of the input item according to the dimension row.
 /// </summary>
 protected abstract void OnSuccessfulLookup(TIn input, IDimRow <TLookupKey> rowInDimTable);
Ejemplo n.º 6
0
 protected override void OnSuccessfulLookup(Trunk input, IDimRow <byte[]> rowInDimTable)
 {
     Assert.IsTrue(TestUtils.ArrayEqual(input.Pointer, rowInDimTable.JoinOn));
     //Assert.AreEqual("Str" + Encoding.UTF8.GetString(input.Pointer), rowInDimTable["StrValue"]);
     this.Count++;
 }
Ejemplo n.º 7
0
 protected override void OnSuccessfulLookup(Trunk input, IDimRow <string> rowInDimTable)
 {
     Assert.AreEqual(input.Pointer, rowInDimTable.JoinOn);
     //Assert.AreEqual("Str" + input.Pointer, rowInDimTable["StrValue"]);
     this.Count++;
 }