On 9/22/2011 6:12 PM, Jörn Kottmann wrote:
> On 9/22/11 2:17 AM, James Kosin wrote:
>>    public boolean contains(int index) {
>>      return start<= index&&  index<= end;
>>    }
>>
>> The first is okay, but the second definition is a bit odd; since, the
>> end is included as part of the span when using index as an input.  Is
>> this correct?
>>
>
> Good catch, doesn't make sense to me. It should only return true for
> indexes
> which point to elements which are included in the span, right?
>
> Jörn
Yes, that makes better sense... unfortunately, if the user uses the
getStart() and getEnd() methods for a Span and tried to use those
numbers it may add even more confusion; since the getEnd() returns one
past the last index in the span.
Maybe we should refactor the Span class to clarify the proper usage...
or provide better documentation.

James

Reply via email to