A range of adjacent Enumerable values. Two values of an enumerable type are considered adjacent if their offset is of unit or zero magnitude. Thus, a Range is a list of values where for every integer index where both index and index+1 fall within the indices of the range:

range[index+1].offset(range[index]).magnitude <= 1

A range is always nonempty, containing at least one value. Thus, it is a Sequence.

A sequence of adjacent values may be represented very efficiently in memory, either:

  • via its endpoints, first..last, or
  • via an endpoint and length, first:size.

Furthermore, certain operations are much more efficient than for other lists, assuming that the enumerable type has efficient neighbour and offset functions.

The functions span() and measure(), and corresponding operators .. and : are used to create new instances of Range.

See also span(), measure()

no subtypes hierarchy

coalescedSource Codeshared actual Range<Element> coalesced

Returns the range itself, since a range cannot contain null elements.

decreasingSource Codeshared formal Boolean decreasing

Determines if the range is decreasing, that is, if predecessors occur after successors.

increasingSource Codeshared formal Boolean increasing

Determines if the range is increasing, that is, if successors occur after predecessors.

Inherited Attributes
Attributes inherited from: Object
Attributes inherited from: Collection<Element>
Attributes inherited from: Correspondence<Key,Item>
Attributes inherited from: Iterable<Element,Absent>
Attributes inherited from: List<Element>
Attributes inherited from: [Element+]
Attributes inherited from: Element[]
containsElementSource Codeshared formal Boolean containsElement(Element element)

Determines if this range includes the given value.

includesRangeSource Codeshared formal Boolean includesRange(Range<Element> range)

Determines if this range includes the given range.

shiftedSource Codeshared formal Range<Element> shifted(Integer shift)

Returns a range of the same length and type as this range, with its endpoints shifted by the given number of elements, where:

Inherited Methods
Methods inherited from: Object
Methods inherited from: Category<Element>
Methods inherited from: Collection<Element>
Methods inherited from: Correspondence<Key,Item>
Methods inherited from: Iterable<Element,Absent>
Methods inherited from: List<Element>
Methods inherited from: Ranged<Index,Element,Subrange>
Methods inherited from: Element[]