commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Heuer <heue...@acm.org>
Subject Re: [collections] Observable next steps
Date Tue, 27 May 2003 19:31:37 GMT

On Sat, 24 May 2003, Stephen Colebourne wrote:

> CollectionChangeEvent:
>  Collection collection - the collection (current reference, ie. after
> change)
>  int numberChanged - the number of elements changing
>  int changeIndex - for Lists, the index where the change starts
>  Object changed - the value/collection being added/removed/changed
>  boolean bulkOperation - true if addAll() etc. or clear()
>  int oldSize - size before change
>  int newSize - size after change
>  boolean sizeChanged - (derived from previous two)

It looks to me that collecting this information may require
synchronization in the decorator -- is that acceptable?

ObservableCollection
  extends AbstractCollectionDecorator

public boolean add(Object object)
{
  // synchronized {

  int oldSize = size();
  boolean returnVal = super.add(object);
  int newSize = size();

  // }

  if (returnVal)
    support.fireElementAdded(oldSize, newSize, object);

  return returnVal;
}

   michael


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message