Does an open-ended interval implementation exist f

2020-02-06 07:41发布

I've got a classification of certain values in different intervals. Most have the form [20-30], but some are of the form [30-infinite).

Is there an interval class you know of which can represent:

  • an interval which is not closed on both sides (e.g. (0-5) or [0-5) )
  • an interval which closes (or starts) on infinite

3条回答
SAY GOODBYE
2楼-- · 2020-02-06 08:10

Time&Money project seems to have Interval class that you need.

See these files in their svn: interval package.

查看更多
够拽才男人
3楼-- · 2020-02-06 08:18

The Apache-commons-lang project (http://commons.apache.org/lang/) contains classes dealing with ranges (like IntRange - https://commons.apache.org/proper/commons-lang/javadocs/api-2.6/org/apache/commons/lang/math/IntRange.html). I'm not sure it covers all your needs, but it might be worth checking.

查看更多
倾城 Initia
4楼-- · 2020-02-06 08:24

I know of no library classes, but I recall rather trivially writing such classes.

查看更多
登录 后发表回答