| Summary: | Add removeAt() and removeLast() to EolSequence | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Modeling] Epsilon | Reporter: | Antonio Garcia-Dominguez <agarcdomi> | ||||
| Component: | Core | Assignee: | Dimitris Kolovos <dkolovos> | ||||
| Status: | CLOSED FIXED | QA Contact: | |||||
| Severity: | enhancement | ||||||
| Priority: | P3 | ||||||
| Version: | unspecified | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Antonio Garcia-Dominguez
Created attachment 172666 [details]
Adds removeAt and removeLast
I meant "for removing elements to EolSequence by position" in the description. Sorry! 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? 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). 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. 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?
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. Fixed in the latest interim version. Fixed in 0.9.0. |