Paolo;
Do we agree that Iterators and Indexers work on the Items? If so, then so must the Enumerator.
Agreed. But if a Tag is available in the collection it may contain information of interest not in the Item, I don't see any reason why the accessors can't work on Tags also.
If we allow (as I think we've now agreed) an Indexer to return multiple items. Then I could probably substitute an (equivalent) Indexer for every Enumerator (of the type I've previously defined).
(We have so agreed) and yes an equivalent Indexer could be substituted. I see an Enumerator as a specialization of an Indexer, at least in terms of the derived collection, but I'm keeping my thoughts open on this. I havent fully evaluated the possibilities of your
filter concept.
However, you've sparked an idea with the "SELECT DISTINCT". Perhaps the Enumerator should return the Set (unique) of a particular Enumerated Property in the Item. For example:
I have 12 Red pebbles, 6 Green, 2 Blue. The Colour attribute has 8 possible values.
The enumerator would return the Set: Red,Green,Blue - since these were the only values in this collection at this time.
This is a good illustration of the nature of the Enumerator's specialization. It also conforms to my earlier stated specifications which allows an enumeration to be derived, by an enumerator, from any base collection type.
If this isn't what you'd like the Enumerator to do, can you spell it out with an example?
No need, its what I expect of an Enumerator.
I presume that the isIndexable and isIterable would come under the same banner?
That is my view.
I haven't worked out yet whether a Collection is Iterable (by definition).
By definition? In my view, probably not at the CIM level. In the real-world, except for queues at the bank teller's window, few of the parts of a collection are conveniently lined up in a
ordinal fashion.
Just as I assert a required presence of an
Enumerator object for
isEnumerable to be
true, I also assert the required presence of an
Indexer object and
Iterator object. I think of
isEnumerable,
isIndexable and
isIterable a interfaces which define a method which returns a reference to the respective Enumerator, Indexer, or Iterator object that is nested within the collection.
Collections having such access objects implement the appropriate interfaces (note the plurality here).
BTW: I now see
Trees as a specalization of
Linked-lists which in turn is a specalization of a
List. I no longer think of trees as a base collection type.