viatra / EMF-IncQuery

This repository is only kept for historic reasons. All development happens on eclipse.org
http://eclipse.org/viatra
13 stars 4 forks source link

ObservablePatternMatchList #268

Closed balazsgrill closed 12 years ago

balazsgrill commented 12 years ago

An IObservableList implementation which provides read-only access to the result set of an IncQueryMatcher. The elements of the list are instances of IPatternMatch.

balazsgrill commented 12 years ago

@bergmanngabor Of course, the actual list implementation used for cache is arbitrary as long as it implements List<?>. Do you have something specific in your mind?

Another solution is to extend the cache with a hashmap just to store the index of the elements.

bergmanngabor commented 12 years ago

No, I could not figure out a sublinear solution yet.

The match -> index map is not an improvement, because O(n) indices will have to be updated after each deletion.

balazsgrill commented 12 years ago

@bergmanngabor That is true... maybe it's worth trying other org.apache.commons.collections.list.TreeList or other custom implementation. Currently, performance is not crucial for our use-case of this class, but I will try to create some benchmarks if I have some free time.

ujhelyiz commented 12 years ago

We don't want to use apache.commons.collections in our codebase - further external dependency. For this reason, Google Guava (that contains the former Google Collections may be used).

balazsgrill commented 12 years ago

Unfortunately google guava does not provide faster list implementations. I've modified the code to enable clients to exchange the used cache implementation by subclassing the observable list. If the default ArrayList is not appropriate, the clients can use whatever implementation they want, even TreeList. No need to depend to apache collections from IncQuery.

istvanrath commented 12 years ago

I'm not sure the merge was necessarily a good idea (think of Eclipse IP policies). For now, it should stay, but we should discuss this on the next meeting.