Half a year ago a discussion came up with regards to defining a "Cursor" class for ordered collection. This should be done in a way, which makes it possible to use multiple cursors independently of each other, even if they refer to the same ordered collection object.
As promised to come back with a suggestion for a "Cursor" class in the discussion back then, this RFE submits one.
Suggestion: the "Cursor" class should maintain the collection object and a single index object referring to that colleciton object. The "Cursor" should supply the methods:
"collectionObject" returns the collection object for which the cursor object got created.
"index" returns the index value that was returned the last time one of the methods "first", "last", "next", "previous" was run.
"first" and "last" must not have an argument supplied. The message gets forwarded to the "collectionObject" and the return value will be saved in the attribute "index".
"next" and "previous" may supply an index value, if not, then by default the value of "index" is used. The message gets forwarded to the "collectionObject" and the return value will be saved in the attribute "index".
Enclosed please find an implementation of this suggested "Cursor" class. It is excercised as an example against an array object, using two different cursors for it.
In order to be functional for the ordered collection classes, the "Queue" class would need to gain the methods "first", "last", "next", and "previous" as requested in another RFE.