fix typo in kd-tree

replace Count() by Count or Length
This commit is contained in:
BobLd
2020-03-03 09:34:23 +00:00
committed by Eliot Jones
parent e477bc8d6d
commit 1e1a33d46e
6 changed files with 14 additions and 14 deletions

View File

@@ -72,7 +72,7 @@
ParallelOptions parallelOptions = new ParallelOptions() { MaxDegreeOfParallelism = maxDegreeOfParallelism };
Parallel.For(0, pages.Count(), parallelOptions, p =>
Parallel.For(0, pages.Count, parallelOptions, p =>
{
var words = pages[p].GetWords(wordExtractor);
var blocks = pageSegmenter.GetBlocks(words);

View File

@@ -200,23 +200,23 @@
public IEnumerable<KdTreeLeaf<Q>> GetLeaves()
{
var leafs = new List<KdTreeLeaf<Q>>();
RecursiveGetLeaves(LeftChild, ref leafs);
RecursiveGetLeaves(RightChild, ref leafs);
return leafs;
var leaves = new List<KdTreeLeaf<Q>>();
RecursiveGetLeaves(LeftChild, ref leaves);
RecursiveGetLeaves(RightChild, ref leaves);
return leaves;
}
private void RecursiveGetLeaves(KdTreeNode<Q> leaf, ref List<KdTreeLeaf<Q>> leafs)
private void RecursiveGetLeaves(KdTreeNode<Q> leaf, ref List<KdTreeLeaf<Q>> leaves)
{
if (leaf == null) return;
if (leaf is KdTreeLeaf<Q> lLeaf)
{
leafs.Add(lLeaf);
leaves.Add(lLeaf);
}
else
{
RecursiveGetLeaves(leaf.LeftChild, ref leafs);
RecursiveGetLeaves(leaf.RightChild, ref leafs);
RecursiveGetLeaves(leaf.LeftChild, ref leaves);
RecursiveGetLeaves(leaf.RightChild, ref leaves);
}
}

View File

@@ -307,7 +307,7 @@
pivot => true, (pivot, candidate) => true,
maxDegreeOfParallelism).ToList();
for (int a = 0; a < groupedIndexes.Count(); a++)
for (int a = 0; a < groupedIndexes.Count; a++)
{
yield return new TextBlock(groupedIndexes[a].Select(i => lines[i]).ToList());
}

View File

@@ -119,7 +119,7 @@
var firstWordBound = words[0].BoundingBox.Normalise();
Projection currentProjection = new Projection(firstWordBound.Left, firstWordBound.Right);
int wordsCount = words.Count();
int wordsCount = words.Length;
for (int i = 1; i < wordsCount; i++)
{

View File

@@ -98,8 +98,8 @@
Func<Letter, Letter, double> maxDistanceFunction, Func<PdfPoint, PdfPoint, double> distMeasure,
int maxDegreeOfParallelism)
{
if (pageLetters == null || pageLetters.Count() == 0) return new List<Word>();
TextDirection textDirection = pageLetters.ElementAt(0).TextDirection;
if (pageLetters == null || pageLetters.Count == 0) return new List<Word>();
TextDirection textDirection = pageLetters[0].TextDirection;
if (pageLetters.Any(x => textDirection != x.TextDirection))
{

View File

@@ -705,7 +705,7 @@
private static PdfPoint[] Intersect(PdfPath.BezierCurve bezierCurve, PdfPoint p1, PdfPoint p2)
{
var ts = IntersectT(bezierCurve, p1, p2);
if (ts == null || ts.Count() == 0) return EmptyArray<PdfPoint>.Instance;
if (ts == null || ts.Length == 0) return EmptyArray<PdfPoint>.Instance;
List<PdfPoint> points = new List<PdfPoint>();
foreach (var t in ts)