You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Stephen Colebourne <sc...@btopenworld.com> on 2003/08/28 20:35:59 UTC

[collections] ObservedCollection checkin

First part of ObservedCollection checked in, allowing an event sending
wrapper to be written around a collection.

TODO:
- Validate that the design is OK
- Implement ObservedList subList
- Test List iterators
- Add Bag, SortedSet, SortedBag implementations
- Add Fast event mechansim
- Add Rich event mechanism

Stephen


Re: [collections] ObservedCollection checkin

Posted by Stephen Colebourne <sc...@btopenworld.com>.
I've done various refactorings. What is now checked in is very powerful and
pluggable, but has a simple API.

  ObservedCollection.decorate(Collection, Object)
where Object is a listener, handler or other listening type object.

The listeners are more specific too.

Stephen

----- Original Message -----
From: "Stephen Colebourne" <sc...@btopenworld.com>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Thursday, August 28, 2003 10:28 PM
Subject: Re: [collections] ObservedCollection checkin


> This one is tough. The internals of the Standard event mechanism currently
> rely on one listener for both. It can also get complicated with a single
> addListener method trying to figure out what has been added. Plus there
are
> the masks to consider.
>
> Merging the two into one made implementation easier. But if the user API
> feels wrong then it could be changed.
>
> Stephen
>
> ----- Original Message -----
> From: "Michael Heuer" <he...@acm.org>
> > What about
> >
> > StandardModificationListener
> > {
> >   void modificationOccurred(Evt);
> > }
> > VetoableModificationListener
> > {
> >   void modificationOccurring(Evt) throws ModificationVetoedException;
> > }
> >
> > and
> >
> > ObservedCollection
> > {
> > static ObservedCollection decorate(Collection coll,
> >                                    VetoableModificationListener l) {}
> > static ObservedCollection decorate(Collection coll,
> >                                    StandardModificationListener l) {}
> > }
> >
> > instead of
> >
> > StandardModificationListener
> > {
> >   void modificationOccurred(Evt);
> >   void modificationOccurring(Evt) throws ModificationVetoedException;
> > }
> >
> > and
> >
> > ObservedCollection
> > {
> > static ObservedCollection decorate(Collection coll,
> >                                    StandardModificationListener l) {}
> > static ObservedCollection decoratePostEventsOnly(Collection coll,
> >                                    StandardModificationListener l) {}
> > }
> >
> > ?
> >
> >    michael
> >
> > On Thu, 28 Aug 2003, Stephen Colebourne wrote:
> >
> > > First part of ObservedCollection checked in, allowing an event sending
> > > wrapper to be written around a collection.
> > >
> > > TODO:
> > > - Validate that the design is OK
> > > - Implement ObservedList subList
> > > - Test List iterators
> > > - Add Bag, SortedSet, SortedBag implementations
> > > - Add Fast event mechansim
> > > - Add Rich event mechanism
> > >
> > > Stephen
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>


Re: [collections] ObservedCollection checkin

Posted by Stephen Colebourne <sc...@btopenworld.com>.
This one is tough. The internals of the Standard event mechanism currently
rely on one listener for both. It can also get complicated with a single
addListener method trying to figure out what has been added. Plus there are
the masks to consider.

Merging the two into one made implementation easier. But if the user API
feels wrong then it could be changed.

Stephen

----- Original Message -----
From: "Michael Heuer" <he...@acm.org>
> What about
>
> StandardModificationListener
> {
>   void modificationOccurred(Evt);
> }
> VetoableModificationListener
> {
>   void modificationOccurring(Evt) throws ModificationVetoedException;
> }
>
> and
>
> ObservedCollection
> {
> static ObservedCollection decorate(Collection coll,
>                                    VetoableModificationListener l) {}
> static ObservedCollection decorate(Collection coll,
>                                    StandardModificationListener l) {}
> }
>
> instead of
>
> StandardModificationListener
> {
>   void modificationOccurred(Evt);
>   void modificationOccurring(Evt) throws ModificationVetoedException;
> }
>
> and
>
> ObservedCollection
> {
> static ObservedCollection decorate(Collection coll,
>                                    StandardModificationListener l) {}
> static ObservedCollection decoratePostEventsOnly(Collection coll,
>                                    StandardModificationListener l) {}
> }
>
> ?
>
>    michael
>
> On Thu, 28 Aug 2003, Stephen Colebourne wrote:
>
> > First part of ObservedCollection checked in, allowing an event sending
> > wrapper to be written around a collection.
> >
> > TODO:
> > - Validate that the design is OK
> > - Implement ObservedList subList
> > - Test List iterators
> > - Add Bag, SortedSet, SortedBag implementations
> > - Add Fast event mechansim
> > - Add Rich event mechanism
> >
> > Stephen
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>


Re: [collections] ObservedCollection checkin

Posted by Michael Heuer <he...@acm.org>.
On Thu, 28 Aug 2003, Michael Heuer wrote:

> What about
>
> StandardModificationListener
> {
>   void modificationOccurred(Evt);
> }
> VetoableModificationListener extends StandardModificationListener
> {
>   void modificationOccurring(Evt) throws ModificationVetoedException;
> }

sorry, missed an extends in there.

>
> and
>
> ObservedCollection
> {
> static ObservedCollection decorate(Collection coll,
>                                    VetoableModificationListener l) {}
> static ObservedCollection decorate(Collection coll,
>                                    StandardModificationListener l) {}
> }
>
> instead of
>
> StandardModificationListener
> {
>   void modificationOccurred(Evt);
>   void modificationOccurring(Evt) throws ModificationVetoedException;
> }
>
> and
>
> ObservedCollection
> {
> static ObservedCollection decorate(Collection coll,
>                                    StandardModificationListener l) {}
> static ObservedCollection decoratePostEventsOnly(Collection coll,
>                                    StandardModificationListener l) {}
> }
>
> ?
>
>    michael
>
> On Thu, 28 Aug 2003, Stephen Colebourne wrote:
>
> > First part of ObservedCollection checked in, allowing an event sending
> > wrapper to be written around a collection.
> >
> > TODO:
> > - Validate that the design is OK
> > - Implement ObservedList subList
> > - Test List iterators
> > - Add Bag, SortedSet, SortedBag implementations
> > - Add Fast event mechansim
> > - Add Rich event mechanism
> >
> > Stephen
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>


Re: [collections] ObservedCollection checkin

Posted by Michael Heuer <he...@acm.org>.
What about

StandardModificationListener
{
  void modificationOccurred(Evt);
}
VetoableModificationListener
{
  void modificationOccurring(Evt) throws ModificationVetoedException;
}

and

ObservedCollection
{
static ObservedCollection decorate(Collection coll,
                                   VetoableModificationListener l) {}
static ObservedCollection decorate(Collection coll,
                                   StandardModificationListener l) {}
}

instead of

StandardModificationListener
{
  void modificationOccurred(Evt);
  void modificationOccurring(Evt) throws ModificationVetoedException;
}

and

ObservedCollection
{
static ObservedCollection decorate(Collection coll,
                                   StandardModificationListener l) {}
static ObservedCollection decoratePostEventsOnly(Collection coll,
                                   StandardModificationListener l) {}
}

?

   michael

On Thu, 28 Aug 2003, Stephen Colebourne wrote:

> First part of ObservedCollection checked in, allowing an event sending
> wrapper to be written around a collection.
>
> TODO:
> - Validate that the design is OK
> - Implement ObservedList subList
> - Test List iterators
> - Add Bag, SortedSet, SortedBag implementations
> - Add Fast event mechansim
> - Add Rich event mechanism
>
> Stephen
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>


Re: [collections] ObservedCollection checkin

Posted by Stephen Colebourne <sc...@btopenworld.com>.
The standard for the decorators package was originally laid down as past
tense. Predicated/Transformed/Synchronized etc. But then Unmodifiable is
different.

I'm comfortable with Observed, but wouldn't block a change if that was the
way people want to go.

Stephen

----- Original Message -----
From: "Michael Heuer" <he...@acm.org>
> Just a minor quibble, why past tense (Observed) instead of adjective
> (Observable, Serializable, Unmodifiable, Cursorable, &c.)?
>
>    michael
>
>
> On Thu, 28 Aug 2003, Stephen Colebourne wrote:
>
> > First part of ObservedCollection checked in, allowing an event sending
> > wrapper to be written around a collection.
> >
> > TODO:
> > - Validate that the design is OK
> > - Implement ObservedList subList
> > - Test List iterators
> > - Add Bag, SortedSet, SortedBag implementations
> > - Add Fast event mechansim
> > - Add Rich event mechanism
> >
> > Stephen
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>


Re: [collections] ObservedCollection checkin

Posted by Michael Heuer <he...@acm.org>.
Just a minor quibble, why past tense (Observed) instead of adjective
(Observable, Serializable, Unmodifiable, Cursorable, &c.)?

   michael


On Thu, 28 Aug 2003, Stephen Colebourne wrote:

> First part of ObservedCollection checked in, allowing an event sending
> wrapper to be written around a collection.
>
> TODO:
> - Validate that the design is OK
> - Implement ObservedList subList
> - Test List iterators
> - Add Bag, SortedSet, SortedBag implementations
> - Add Fast event mechansim
> - Add Rich event mechanism
>
> Stephen
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>