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.90 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.90.1 Interval class: instance creation  (class)
1.90.2 Interval: basic  (instance)
1.90.3 Interval: printing  (instance)
1.90.4 Interval: storing  (instance)
1.90.5 Interval: testing  (instance)


1.90.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.90.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.

do: aBlock
Evaluate the receiver for each element in aBlock

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.90.3 Interval: printing

first
Answer `start'.

increment
Answer `step'.

last
Answer the last value.

printOn: aStream
Print a representation for the receiver on aStream


1.90.4 Interval: storing

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


1.90.5 Interval: testing

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

hash
Answer an hash value for the receiver



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 July, 23 2009 using texi2html