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); } }
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); } }
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); } }
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; }
/// <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);
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++; }
protected override void OnSuccessfulLookup(Trunk input, IDimRow <string> rowInDimTable) { Assert.AreEqual(input.Pointer, rowInDimTable.JoinOn); //Assert.AreEqual("Str" + input.Pointer, rowInDimTable["StrValue"]); this.Count++; }