Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 317873 - Add removeAt() and removeLast() to EolSequence
Summary: Add removeAt() and removeLast() to EolSequence
Status: CLOSED FIXED
Alias: None
Product: Epsilon
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Dimitris Kolovos CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-24 14:51 EDT by Antonio Garcia-Dominguez CLA
Modified: 2012-02-06 10:59 EST (History)
0 users

See Also:


Attachments
Adds removeAt and removeLast (2.01 KB, patch)
2010-06-24 14:52 EDT, Antonio Garcia-Dominguez CLA
dkolovos: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antonio Garcia-Dominguez CLA 2010-06-24 14:51:42 EDT
Build Identifier: 20100218-1602

It'd be useful to add explicit methods for removing elements to EolSequence. I have tried to use the remove(int) method in the underlying ArrayList, but for some reason it always ends up calling the remove(Object) method of EolCollection.

I have attached a patch which adds these two methods to EolSequence and mentions them in the Epsilon book.

Reproducible: Always
Comment 1 Antonio Garcia-Dominguez CLA 2010-06-24 14:52:10 EDT
Created attachment 172666 [details]
Adds removeAt and removeLast
Comment 2 Antonio Garcia-Dominguez CLA 2010-06-24 14:53:13 EDT
I meant "for removing elements to EolSequence by position" in the description. Sorry!
Comment 3 Dimitris Kolovos CLA 2010-07-20 14:47:11 EDT
I've committed an implementation of the removeAt(int index) operation for instances of java.util.List (includes EolSequence) in the SVN. I'm not sure whether it's worth having a built-in removeLast() operation given that the same effect can be now produced by s.removeAt(s.size() - 1). Any thoughts on this?
Comment 4 Antonio Garcia-Dominguez CLA 2010-07-20 15:08:45 EDT
I agree that removeLast() is not needed anymore. In fact, I'd say that even remove() is not needed, thanks to your removing of object wrapping altogether from Epsilon. After that, I was able to use the regular remove(int) method from List and rewrite my removeLast() calls with l.remove(l.size() - 1).
Comment 5 Antonio Garcia-Dominguez CLA 2010-07-20 15:11:29 EDT
We might want to keep your new remove(int) method for consistency, though. When I read the Epsilon book, it struck me as odd that EolSequence didn't have that operation.
Comment 6 Dimitris Kolovos CLA 2010-07-20 16:37:20 EDT
Thanks for your feedback! I think it makes sense to keep the removeAt(int index) method for a couple of reasons:

Sequence{1,2,3}.remove(1) -> Sequence{2,3} (it thinks 1 is an object, not an index) while Sequence{1,2,3}.removeAt(1) -> Sequence{1,3}. Also the default implementation of EolOrderedSet is a LinkedHashSet (which doesn't implement List) and we want removeAt() to be applicable on these as well. Any thoughts?
Comment 7 Antonio Garcia-Dominguez CLA 2010-07-20 18:03:27 EDT
Oh, right! I forgot about the old remove-element vs remove-index ambiguity in the remove() methods in List. Yes, I agree with you in that removeAt is definitely needed. I think we can safely close this issue, then.
Comment 8 Dimitris Kolovos CLA 2010-09-06 09:31:07 EDT
Fixed in the latest interim version.
Comment 9 Dimitris Kolovos CLA 2010-11-25 08:17:13 EST
Fixed in 0.9.0.