本文整理汇总了C#中Quote.le方法的典型用法代码示例。如果您正苦于以下问题:C# Quote.le方法的具体用法?C# Quote.le怎么用?C# Quote.le使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quote
的用法示例。
在下文中一共展示了Quote.le方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static public void Main(string[] args)
{
Storage db = StorageFactory.Instance.CreateStorage();
db.Open("testkdtree.dbs", pagePoolSize);
int n;
#if USE_GENERICS
MultidimensionalIndex<Quote> index = (MultidimensionalIndex<Quote>)db.Root;
if (index == null) {
index = db.CreateMultidimensionalIndex<Quote>(new string[] { "low", "high", "open", "close", "volume" }, false);
db.Root = index;
}
#else
MultidimensionalIndex index = (MultidimensionalIndex)db.Root;
if (index == null) {
index = db.CreateMultidimensionalIndex(typeof(Quote), new string[] { "low", "high", "open", "close", "volume" }, false);
db.Root = index;
}
#endif
DateTime start = DateTime.Now;
Random r = new Random(2007);
for (int i = 0; i < nRecords; i++) {
Quote q = getRandomQuote(r);
index.Add(q);
}
db.Commit();
Console.WriteLine("Elapsed time for inserting " + nRecords + " records: " + (DateTime.Now - start));
Console.WriteLine("Tree height: " + index.Height);
if (index.Count > 1 && index.Height/Math.Log(index.Count)*Math.Log(2.0) > KD_TREE_OPTIMIZATION_THRESHOLD) {
start = DateTime.Now;
index.Optimize();
Console.WriteLine("New tree height: " + index.Height);
Console.WriteLine("Elapsed time for tree optimization: " + (DateTime.Now - start));
}
start = System.DateTime.Now;
r = new Random(2007);
for (int i = 0; i < nRecords; i++) {
Quote q = getRandomQuote(r);
#if USE_GENERICS
Quote[] result = index.QueryByExample(q);
Debug.Assert(result.Length >= 1);
for (int j = 0; j < result.Length; j++) {
Debug.Assert(q.eq(result[j]));
}
#else
object[] result = index.QueryByExample(q);
Debug.Assert(result.Length >= 1);
for (int j = 0; j < result.Length; j++) {
Debug.Assert(q.eq((Quote)result[j]));
}
#endif
}
Console.WriteLine("Elapsed time for performing " + nRecords + " query by example searches: " + (DateTime.Now - start));
start = System.DateTime.Now;
r = new Random(2007);
Random r2 = new Random(2008);
long total = 0;
for (int i = 0; i < nRecords; i++) {
Quote q = getRandomQuote(r);
Quote min = new Quote();
Quote max = new Quote();
min.low = q.low - (float)MAX_PRICE/EPSILON;
min.high = q.high - (float)MAX_PRICE/EPSILON;
min.open = q.open - (float)MAX_PRICE/EPSILON;
min.close = q.close - (float)MAX_PRICE/EPSILON;
min.volume = q.volume - MAX_VOLUME/EPSILON;
max.low = q.low + (float)MAX_PRICE/EPSILON;
max.high = q.high + (float)MAX_PRICE/EPSILON;
max.open = q.open + (float)MAX_PRICE/EPSILON;
max.close = q.close + (float)MAX_PRICE/EPSILON;
max.volume = q.volume + MAX_VOLUME/EPSILON;
n = 0;
foreach (Quote quote in index.Range(min, max))
{
Debug.Assert(min.le(quote));
Debug.Assert(quote.le(max));
n += 1;
}
Debug.Assert(n >= 1);
total += n;
}
Console.WriteLine("Elapsed time for performing " + nRecords + " range query by example searches: " + (DateTime.Now - start));
start = System.DateTime.Now;
n = 0;
foreach (Quote q in index)
{
n += 1;
}
Debug.Assert(n == nRecords);
Console.WriteLine("Elapsed time for iterating through " + nRecords + " records: " + (DateTime.Now - start));
start = System.DateTime.Now;
n = 0;
//.........这里部分代码省略.........