Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF filter EList
EMF filter EList [message #1271203] Fri, 14 March 2014 13:49 Go to next message
Dennis Melzer is currently offline Dennis MelzerFriend
Messages: 244
Registered: July 2009
Senior Member
Hello,

i want to filter a list with >10.000 objects. Is there a efficient way for emf?

public class AImplCustom extends AImpl
    {

    @Override
    public EList<B> getBs(String type)
        {
        EList<B> bs = new BasicEList<B>();

        for (B b : getBs())
            {
            if (type.equals(b.getType()))
                {
                bs.add(b);
                }
            }

        return bs;
        }

Re: EMF filter EList [message #1271428 is a reply to message #1271203] Sat, 15 March 2014 04:30 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Do you intend to make the list read only? Does it need to be an
EList? You might just use AbstractSequentialList. Google collections
provides lots of convenient classes for filtered list...

On 14/03/2014 2:49 PM, Sir Wayne wrote:
> Hello,
>
> i want to filter a list with >10.000 objects. Is there a efficient way
> for emf?
>
>
> public class AImplCustom extends AImpl
> {
>
> @Override
> public EList<B> getBs(String type)
> {
> EList<B> bs = new BasicEList<B>();
>
> for (B b : getBs())
> {
> if (type.equals(b.getType()))
> {
> bs.add(b);
> }
> }
>
> return bs;
> }
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF filter EList [message #1274328 is a reply to message #1271428] Fri, 21 March 2014 10:00 Go to previous messageGo to next message
Dennis Melzer is currently offline Dennis MelzerFriend
Messages: 244
Registered: July 2009
Senior Member
Thanks for your reply. Yes it is a read only list.
I think a EList is better, because its a own operation in the ecore.
Re: EMF filter EList [message #1274517 is a reply to message #1271428] Fri, 21 March 2014 15:34 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Given it's read only, you can use AbstractSequentialList and also
implement EList (which is just have move throw exceptions)...

On 14/03/2014 9:30 PM, Ed Merks wrote:
> Do you intend to make the list read only? Does it need to be an
> EList? You might just use AbstractSequentialList. Google collections
> provides lots of convenient classes for filtered list...
>
> On 14/03/2014 2:49 PM, Sir Wayne wrote:
>> Hello,
>>
>> i want to filter a list with >10.000 objects. Is there a efficient
>> way for emf?
>>
>>
>> public class AImplCustom extends AImpl
>> {
>>
>> @Override
>> public EList<B> getBs(String type)
>> {
>> EList<B> bs = new BasicEList<B>();
>>
>> for (B b : getBs())
>> {
>> if (type.equals(b.getType()))
>> {
>> bs.add(b);
>> }
>> }
>>
>> return bs;
>> }
>>
>>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Loading Enum from other ecore file
Next Topic:Is it possible to generate @Override annotations in the Impl-Classes?
Goto Forum:
  


Current Time: Thu Mar 28 16:20:47 GMT 2024

Powered by FUDForum. Page generated in 0.02834 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top