Type Hierarchy:
Satisfied Interfaces: Category, Cloneable<List<Element>>, Collection<Element>, Correspondence<Integer,Element>, Iterable<Element,Nothing>, List<Element>, Ranged<Integer,List<Element>>, Sequence<Element>, Sequential<Element>

Represents the range of totally ordered, ordinal values generated by two endpoints of type Ordinal and Comparable. If the first value is smaller than the last value, the range is increasing. If the first value is larger than the last value, the range is decreasing. If the two values are equal, the range contains exactly one element. The range is always nonempty, containing at least one value.

A range may be produced using the .. operator:

for (i in min..max) { ... }
if (char in 'A'..'Z') { ... }
By: Gavin
Initializer
Range(Element first, Element last)
Parameters:
  • first

    The start of the range.

  • last

    The end of the range.

Attributes
cloneSource Code
shared actual Range<Element> clone

Returns the range itself, since ranges are immutable.

Refined declaration: clone
coalescedSource Code
shared actual Range<Element> coalesced

Returns the range itself, since a Range cannot contain nulls.

Refined declaration: coalesced
decreasingSource Code
shared Boolean decreasing

Determines if the range is decreasing.

firstSource Code
shared actual Element first

The start of the range.

Refined declaration: first
lastSource Code
shared actual Element last

The end of the range.

Refined declaration: last
lastIndexSource Code
shared actual Integer lastIndex

The index of the end of the range.

Refined declaration: lastIndex
restSource Code

The rest of the range, without the start of the range.

Refined declaration: rest
reversedSource Code
shared actual Range<Element> reversed

Reverse this range, returning a new range.

Refined declaration: reversed
sequenceSource Code
shared actual Range<Element> sequence

Returns this range.

Refined declaration: sequence
sizeSource Code
shared actual Integer size

The nonzero number of elements in the range.

Refined declaration: size
stringSource Code
shared actual String string

A developer-friendly string representing the instance. Concatenates the name of the concrete class of the instance with the hash of the instance. Subclasses are encouraged to refine this implementation to produce a more meaningful representation.

Refined declaration: string
Inherited Attributes
Attributes inherited from: Object
Attributes inherited from: Cloneable<Clone>
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[]
Methods
bySource Code

Produce an Iterable containing every stepth element of this iterable object. If the step size is 1, the Iterable contains the same elements as this iterable object. The step size must be greater than zero. The expression

(0..10).by(3)

results in an iterable object with the elements 0, 3, 6, and 9 in that order.

Refined declaration: by
containsSource Code
shared actual Boolean contains(Object element)

Determines if this range includes the given object.

Refined declaration: contains
containsElementSource Code
shared Boolean containsElement(Element x)

Determines if the range includes the given value.

countSource Code
shared actual Integer count(Boolean selecting(Element element))

Return the number of elements in this Iterable that satisfy the predicate function.

Refined declaration: count
equalsSource Code
shared actual Boolean equals(Object that)

Determines if two ranges are the same by comparing their endpoints.

Refined declaration: equals
getSource Code

The element of the range that occurs n values after the start of the range. Note that this operation is inefficient for large ranges.

Refined declaration: get
includesSource Code
shared actual Boolean includes(List<Anything> sublist)

Determine if the given list occurs at some index in this list.

Refined declaration: includes
includesRangeSource Code
shared Boolean includesRange(Range<Element> sublist)

Determines if this range includes the given range.

iteratorSource Code
shared actual Iterator<Element> iterator()

An iterator for the elements of the range.

Refined declaration: iterator
occursSource Code
shared actual Boolean occurs(Anything element)

Determines if this range includes the given value.

Refined declaration: occurs
segmentSource Code
shared actual Range<Element>|[] segment(Integer from, Integer length)

Obtain a segment containing the mapped values starting from the given index, with the given length.

Refined declaration: segment
skippingSource Code
shared actual Range<Element>|[] skipping(Integer skip)

Produce an Iterable containing the elements of this iterable object, after skipping the first skip elements. If this iterable object does not contain more elements than the specified number of elements, the Iterable contains no elements.

Refined declaration: skipping
spanSource Code
shared actual Range<Element>|[] span(Integer from, Integer to)

Obtain a span containing the mapped values between the two given indices.

Refined declaration: span
spanFromSource Code
shared actual Range<Element>|[] spanFrom(Integer from)

Obtain a span containing the mapped values between the starting index and the end of the receiver.

Refined declaration: spanFrom
spanToSource Code
shared actual Range<Element>|[] spanTo(Integer to)

Obtain a span containing the mapped values between the start of the receiver and the end index.

Refined declaration: spanTo
takingSource Code
shared actual Range<Element>|[] taking(Integer take)

Produce an Iterable containing the first take elements of this iterable object. If the specified number of elements is larger than the number of elements of this iterable object, the Iterable contains the same elements as this iterable object.

Refined declaration: taking
Inherited Methods
Methods inherited from: Category
Methods inherited from: Correspondence<Key,Item>
Methods inherited from: Iterable<Element,Absent>
Methods inherited from: List<Element>
Methods inherited from: Ranged<Index,Span>