本文整理汇总了C#中CircularBuffer.PeekRange方法的典型用法代码示例。如果您正苦于以下问题:C# CircularBuffer.PeekRange方法的具体用法?C# CircularBuffer.PeekRange怎么用?C# CircularBuffer.PeekRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CircularBuffer
的用法示例。
在下文中一共展示了CircularBuffer.PeekRange方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetValues
public LinearRegressionInputData GetValues(
CircularBuffer<MarketDataPair> data,
int fromIndex)
{
List<MarketDataPair> rangeData = data.PeekRange(fromIndex);
return GetLinearRegressionData(rangeData);
}
示例2: CircularBufferGetPutSkipTest
public void CircularBufferGetPutSkipTest()
{
{
CircularBuffer<int> buffer = new CircularBuffer<int>(3, true);
buffer.Put(1);
buffer.Put(2);
buffer.Put(3);
buffer.Put(4);
int get1 = buffer.Get();
int get2 = buffer.Get();
Assert.AreEqual(get1, 2);
Assert.AreEqual(get2, 3);
}
{
CircularBuffer<int> buffer = new CircularBuffer<int>(3, true);
buffer.Put(1);
buffer.Put(2);
buffer.Put(3);
buffer.Put(4);
buffer.Put(5);
int get1 = buffer.Peek(); // 3
int get2 = buffer.Peek(0); // 3
int get3 = buffer.Peek(1); // 4
int get4 = buffer.Peek(2); // 5
Assert.AreEqual(get1, 3);
Assert.AreEqual(get2, 3);
Assert.AreEqual(get3, 4);
Assert.AreEqual(get4, 5);
List<int> getRange = buffer.PeekRange(0);
Assert.AreEqual(getRange.Count, 3);
Assert.AreEqual(getRange[0], 3);
Assert.AreEqual(getRange[1], 4);
Assert.AreEqual(getRange[2], 5);
}
}