From issues-return-67042-archive-asf-public=cust-asf.ponee.io@commons.apache.org Tue Mar 20 09:04:05 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 1AA2B18064A for ; Tue, 20 Mar 2018 09:04:04 +0100 (CET) Received: (qmail 17517 invoked by uid 500); 20 Mar 2018 08:04:03 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 17506 invoked by uid 99); 20 Mar 2018 08:04:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Mar 2018 08:04:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 51836C2B22 for ; Tue, 20 Mar 2018 08:04:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.511 X-Spam-Level: X-Spam-Status: No, score=-109.511 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id SF9C41iIrqef for ; Tue, 20 Mar 2018 08:04:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 89A135F173 for ; Tue, 20 Mar 2018 08:04:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id A4C4FE0D14 for ; Tue, 20 Mar 2018 08:04:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 55330214B6 for ; Tue, 20 Mar 2018 08:04:00 +0000 (UTC) Date: Tue, 20 Mar 2018 08:04:00 +0000 (UTC) From: "Claude Warren (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (LANG-1387) Add Span classes to handle checks for overlaps, containment, equality, etc. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LANG-1387?page=3Dcom.atlassian.= jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D16405= 938#comment-16405938 ]=20 Claude Warren commented on LANG-1387: ------------------------------------- I think that fundamentally they address different issues and use wildly dif= ferent approaches. Range is a class, Span is an interface.=C2=A0 Span is intended to=C2=A0 be = used to extend classes. I see that Range indeed could be implemented with Integer and Long to make = something like the IntSpan and LongSpan interfaces and that Range has use o= utside the realm of Span as it can handle any object that can be/is ordered= . Span however, lets you extend existing objects so that the object knows its= place but is still the object. Consider a collection of buffers, Range would require that the range be som= ehow bound to the buffer while Span can be added to the buffer either by im= plementing a new buffer with the Span interface added or by dynamic proxy.= =C2=A0 With range this is much more complicated. In all cases I think it is possible to implement things that Span allows wi= th extra work and exposed code complexity using Range, just as I am certain= it is possible to implement all the things that Range allows with addition= al code and complexity for Span. Span is intended to be used in situation where you have a known object and = simply want to be able to add positional information to it without the over= head of programmatically associating the object with a position object. It = does not handle the case were you are going to do things like assign object= s to an enumeration (except that an enumeration can be converted into posit= ional Int) nor other objects that have specific order.=C2=A0 Span also shines when you have collections of things and you want to reposi= tion them while retaining their original positional information.=C2=A0 If y= ou have a buffer of text and create spaned buffers that point into the orig= inal buffer and delineate the paragraphs, you can then rearrange the paragr= aph buffers by wrapping them in a spanned buffer but assigning them differe= nt starting positions, this is rather handy for some types of edits. Long and short of it is they are much the same as character array and Strin= g are much the same, you can do many of the same operations with both but t= hey really serve two different uses. =C2=A0 As for putting Span in commons numbers, I have no opinion on the matter.=C2= =A0 If you think it works well there I would be happy to try to move the co= de into that project instead. =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > Add Span classes to handle checks for overlaps, containment, equality, et= c. > -------------------------------------------------------------------------= -- > > Key: LANG-1387 > URL: https://issues.apache.org/jira/browse/LANG-1387 > Project: Commons Lang > Issue Type: Improvement > Components: lang.*, lang.math.* > Affects Versions: 3.7 > Reporter: Claude Warren > Priority: Minor > > This is a contribution of a span class as discussed on the mailing list. > The classes are int and long based and can: > # determine if points are within the span. > # determine if one span contains another span > # determine if two spans overlap > # do not have to have 0 (zero) as the index origin. > # determine the length of the span > # determine the last position in the span. > # determine the first position in the span. > Changes to Number Utils required to detect underflow and overflow calcula= tions. -- This message was sent by Atlassian JIRA (v7.6.3#76005)