Back: Integer-testing functionality Up: Base classes Forward: Interval class-instance creation   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document

1.91 Interval

Defined in namespace Smalltalk
Superclass: ArrayedCollection
Category: Collections-Sequenceable
My instances represent ranges of objects, typically Number type objects. I provide iteration/enumeration messages for producing all the members that my instance represents.

1.91.1 Interval class: instance creation  (class)
1.91.2 Interval: basic  (instance)
1.91.3 Interval: printing  (instance)
1.91.4 Interval: storing  (instance)
1.91.5 Interval: testing  (instance)


1.91.1 Interval class: instance creation

from: startInteger to: stopInteger
Answer an Interval going from startInteger to the stopInteger, with a step of 1

from: startInteger to: stopInteger by: stepInteger
Answer an Interval going from startInteger to the stopInteger, with a step of stepInteger

withAll: aCollection
Answer an Interval containing the same elements as aCollection. Fail if it is not possible to create one.


1.91.2 Interval: basic

at: index
Answer the index-th element of the receiver.

at: index put: anObject
This method should not be called for instances of this class.

collect: aBlock
Evaluate the receiver for each element in aBlock, collect in an array the result of the evaluations.

copyFrom: startIndex to: stopIndex
Not commented.

do: aBlock
Evaluate the receiver for each element in aBlock

isEmpty
Answer whether the receiver is empty.

reverse
Answer a copy of the receiver with all of its items reversed

size
Answer the number of elements in the receiver.

species
Answer `Array'.


1.91.3 Interval: printing

first
Not commented.

increment
Answer `step'.

last
Answer the last value.

printOn: aStream
Print a representation for the receiver on aStream


1.91.4 Interval: storing

storeOn: aStream
Store Smalltalk code compiling to the receiver on aStream


1.91.5 Interval: testing

= anInterval
Answer whether anInterval is the same interval as the receiver

hash
Answer an hash value for the receiver

isExact
Answer whether elements of the receiver are computed using exact arithmetic. This is true as long as the start and step value are exact (i.e. not floating-point).



Back: Interval-storing Up: Interval Forward: Iterable   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document


This document was generated on August, 19 2010 using texi2html