本文介绍了Java有IndexSet和Range类吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Objective-C Cocoa中,我们有 NSIndexSet 类,通过保存范围数组来有效地存储一系列唯一索引。例如。集合1,2,... 30,57将被存储为范围1-30和57,而不是32个数字的数组。这有助于以简单和快速的方式存储巨大的选择。例如,如果表中的所有行都在1到1百万之间,则索引集会折叠到一个很小的范围,并且很快与之比较和相交。



不幸的是这对Google来说很难。是否有一个类的Java?

解决方案

这似乎是一个有用的类,我不记得标准的实现。 / p>

这里有一些很有用的指针。
















In Objective-C Cocoa we have the NSIndexSet class which stores a series of unique indexes efficiently by keeping an array of ranges. E.g. the set 1, 2, ... 30, 57 would be stored as the ranges 1-30 and 57 rather than an array of 32 numbers. This facilitates huge selections to be stored in a simple and fast way. For example, if all rows between 1 and a million in a table selected, the index set collapses to just a tiny range and is fast to compare and intersect with.

Unfortunately this turns out to be rather hard to Google for. Is there an equivalent class for Java?

解决方案

It seems a useful class, and I don't recall a standard implementation.

Here's a bunch of some -perhaps useful- pointers.

A range intersection algorithm better than O(n)?

http://www.codeproject.com/KB/recipes/rangeset.aspx

http://healpix-rangeset.googlecode.com/svn/trunk/healpix-rangeset/src/org/asterope/healpix/LongRangeSet.java

http://pcj.sourceforge.net/docs/api/bak/pcj/set/IntRangeSet.html

Data structure to build and lookup set of integer ranges

Representing sparse integer sets?

http://www.iis.uni-stuttgart.de/intset/doc/intset/TreeIntegerSet.html

这篇关于Java有IndexSet和Range类吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 21:43