private bool ContainsMark(LocationTextExtractionStrategy2.ITextChunkLocation baseLocation, LocationTextExtractionStrategy2.ITextChunkLocation markLocation)
 {
     return(baseLocation.GetStartLocation().Get(0) <= markLocation.GetStartLocation().Get(0) && baseLocation.GetEndLocation().Get(0) >= markLocation.GetEndLocation().Get(0) && (float)Math.Abs(baseLocation.DistPerpendicular() - markLocation.DistPerpendicular()) <= 2f);
 }
        private void SortWithMarks(IList <LocationTextExtractionStrategy2.TextChunk> textChunks)
        {
            IDictionary <LocationTextExtractionStrategy2.TextChunk, LocationTextExtractionStrategy2.TextChunkMarks> col = new Dictionary <LocationTextExtractionStrategy2.TextChunk, LocationTextExtractionStrategy2.TextChunkMarks>();
            IList <LocationTextExtractionStrategy2.TextChunk> list = new List <LocationTextExtractionStrategy2.TextChunk>();

            for (int i = 0; i < textChunks.Count; i++)
            {
                LocationTextExtractionStrategy2.ITextChunkLocation location = textChunks[i].GetLocation();
                if (location.GetStartLocation().Equals(location.GetEndLocation()))
                {
                    bool flag = false;
                    for (int j = 0; j < textChunks.Count; j++)
                    {
                        if (i != j)
                        {
                            LocationTextExtractionStrategy2.ITextChunkLocation location2 = textChunks[j].GetLocation();
                            if (!location2.GetStartLocation().Equals(location2.GetEndLocation()) && this.ContainsMark(location2, location))
                            {
                                LocationTextExtractionStrategy2.TextChunkMarks textChunkMarks = col.Get(textChunks[j]);
                                if (textChunkMarks == null)
                                {
                                    textChunkMarks = new LocationTextExtractionStrategy2.TextChunkMarks();
                                    col.Put(textChunks[j], textChunkMarks);
                                }
                                if (i < j)
                                {
                                    textChunkMarks.preceding.Add(textChunks[i]);
                                }
                                else
                                {
                                    textChunkMarks.succeeding.Add(textChunks[i]);
                                }
                                flag = true;
                                break;
                            }
                        }
                    }
                    if (!flag)
                    {
                        list.Add(textChunks[i]);
                    }
                }
                else
                {
                    list.Add(textChunks[i]);
                }
            }
            if (this.rightToLeftRunDirection)
            {
                JavaCollectionsUtil.Sort <LocationTextExtractionStrategy2.TextChunk>(list, new LocationTextExtractionStrategy2.TextChunkComparator(new LocationTextExtractionStrategy2.TextChunkLocationComparator(false)));
            }
            else
            {
                JavaCollectionsUtil.Sort <LocationTextExtractionStrategy2.TextChunk>(list);
            }
            textChunks.Clear();
            foreach (LocationTextExtractionStrategy2.TextChunk current in list)
            {
                LocationTextExtractionStrategy2.TextChunkMarks textChunkMarks2 = col.Get(current);
                if (textChunkMarks2 != null)
                {
                    if (!this.rightToLeftRunDirection)
                    {
                        for (int k = 0; k < textChunkMarks2.preceding.Count; k++)
                        {
                            textChunks.Add(textChunkMarks2.preceding[k]);
                        }
                    }
                    else
                    {
                        for (int l = textChunkMarks2.succeeding.Count - 1; l >= 0; l--)
                        {
                            textChunks.Add(textChunkMarks2.succeeding[l]);
                        }
                    }
                }
                textChunks.Add(current);
                if (textChunkMarks2 != null)
                {
                    if (!this.rightToLeftRunDirection)
                    {
                        for (int m = 0; m < textChunkMarks2.succeeding.Count; m++)
                        {
                            textChunks.Add(textChunkMarks2.succeeding[m]);
                        }
                    }
                    else
                    {
                        for (int n = textChunkMarks2.preceding.Count - 1; n >= 0; n--)
                        {
                            textChunks.Add(textChunkMarks2.preceding[n]);
                        }
                    }
                }
            }
        }