Login | Register
My pages Projects Community openCollabNet

Discussions > dev > Re: [gef-dev] Fwd: svn commit: r1186 - trunk/src/org/tigris/gef/base/SelectionManager.java

gef
Discussion topic

Back to topic list

Re: [gef-dev] Fwd: svn commit: r1186 - trunk/src/org/tigris/gef/base/SelectionManager.java

Reply

Author penyaskito
Full name Christian López Espínola
Date 2008-12-16 07:39:09 PST
Message I know this is old now, but for reference.

On Tue, Dec 9, 2008 at 10:44 PM, Dave Thompson <dave at davet dot org> wrote:
> Hi Bob,
>
> Ok, if you like and you are sure that the change is ok, please revert my
> revert...!
>
> Christian: is there any other reason we should be aware of?

It's fine. I learnt something with this :-)


> Dave
>
>
> Bob Tarling wrote:
>>
>> meant to go to list
>>
>>
>> ---------- Forwarded message ----------
>> From: Bob Tarling <bob dot tarling at gmail dot com>
>> Date: 2008/12/9
>> Subject: Re: svn commit: r1186 -
>> trunk/src/org/tigris​/gef/base/SelectionM​anager.java
>> To: Dave Thompson <argouml at davet dot org>
>>
>>
>> The original commit looked fine to me
>>
>> Presumably the confusion was
>>
>> for (int editorIndex = 0; editorIndex < editorCount;
>> ++editorIndex) {
>>
>> }
>>
>> as opposed to
>>
>> for (int editorIndex = 0; editorIndex < editorCount;
>> editorIndex++) {
>>
>> }
>>
>>
>> There is no difference. The editorIndex is set to zero for the first
>> iteration. After an iteration the second part of the for statement
>> checks the condition to loop again. If we loop again the third part of
>> the for loop states what to increment. That increment only happens at
>> the end of the loop
>>
>> So it makes no difference whether ++ is prefix or postfix. The prefix
>> style is a habit of mine from C++ days where it gives some
>> performance. With Java it almost certainly doesn't matter which is
>> used.
>>
>> See - http://java.sun.com/​docs/books/tutorial/​java/nutsandbolts/fo​r.html
>> - the increment only happens after the first iteration.
>>
>> Regards
>>
>> Bob.
>>
>>
>> 2008/12/9 Dave Thompson <argouml at davet dot org>:
>>>
>>> Hi Bob,
>>>
>>> Sorry, the explanatory email exchange was not on the dev list, and I
>>> probably should have made my revert message clearer. Full details below.
>>>
>>> Regards, Dave
>>>
>>> Bob Tarling wrote:
>>>>
>>>> I'm just curious. What was the problem with this?
>>>>
>>>> Bob.
>>>>
>>> Dave Thompson wrote:
>>>>
>>>> Oh crap. You are right. I've reverted my change just in case. I don't
>>>> know a way of specifying the iteration range using the 'cleaner' for
>>>> loop nomenclature, so best stick to the old one for now.
>>>>
>>>> Thanks for noticing!
>>>>
>>>> Dave
>>>>
>>>> Christian López Espínola wrote:
>>>>>
>>>>> Hi Dave!
>>>>>
>>>>> On Tue, Dec 9, 2008 at 9:07 PM, Dave Thompson <argouml at davet dot org>
>>>>> wrote:
>>>>>>
>>>>>> Author: dthompson
>>>>>> Date: 2008-12-09 12:07:58-0800
>>>>>> New Revision: 1185
>>>>>>
>>>>>> Modified:
>>>>>> trunk/src/org/tigris​/gef/base/SelectionM​anager.java
>>>>>>
>>>>>> Log:
>>>>>> Swapped over to generics inside one method, to simplify the code.
>>>>>>
>>>>>> Modified: trunk/src/org/tigris​/gef/base/SelectionM​anager.java
>>>>>> Url:
>>>>>>
>>>>>>
>>>>>> http://gef.tigris.or​g/source/browse/gef/​trunk/src/org/tigris​/gef/base/SelectionM​anager.java?view=dif​f&pathrev=1185​&r1=1184&r2=11​85
>>>>>>
>>>>>>
>>>>>>
>>>>>> ====================​====================​====================​==================
>>>>>>
>>>>>> --- trunk/src/org/tigris​/gef/base/SelectionM​anager.java (original)
>>>>>> +++ trunk/src/org/tigris​/gef/base/SelectionM​anager.java 2008-12-09
>>>>>> 12:07:58-0800
>>>>>> @@ -772,11 +772,9 @@
>>>>>> }
>>>>>>
>>>>>> if (layer != null) {
>>>>>> - List editors = layer.getEditors();
>>>>>> - int editorCount = editors.size();
>>>>>> + List<Editor> editors = layer.getEditors();
>>>>>> Rectangle dirtyRegionScaled = new Rectangle();
>>>>>> - for (int editorIndex = 0; editorIndex < editorCount;
>>>>>> ++editorIndex) {
>>>>>> - Editor editor = (Editor) editors.get(editorIndex);
>>>>>> + for (Editor editor : editors) {
>>>>>
>>>>> Have you seen that it was ++editorIndex? We were not using the first
>>>>> editor in the list.
>>>>> Your works different, so I'm not sure if it was a bug, or we are
>>>>> introducing a bug.
>>>>>
>>>>>
>>>>>> double editorScale = editor.getScale();
>>>>>> dirtyRegionScaled.x = (int) Math.floor(dirtyRegion.x
>>>>>> * editorScale);
>>>>>>
>>>>>> --------------------​--------------------​--------------
>>>>>>
>>>>>>
>>>>>> http://gef.tigris.or​g/ds/viewMessage.do?​dsForumId=5948&d​sMessageId=981833
>>>>>>
>>>>>>
>>>>>> To unsubscribe from this discussion, e-mail:
>>>>>> [commits-unsubscribe​@gef.tigris.org].
>>>>>>
>>>>>
>>>>>
>>>
>>
>> --------------------​--------------------​--------------
>> http://gef.tigris.or​g/ds/viewMessage.do?​dsForumId=429&ds​MessageId=981864
>>
>> To unsubscribe from this discussion, e-mail:
>> [dev-unsubscribe@gef​.tigris.org].
>



--
Cheers,

Christian López Espínola <penyaskito>

« Previous message in topic | 2 of 2 | Next message in topic »

Messages

Show all messages in topic

[gef-dev] Fwd: svn commit: r1186 - trunk/src/org/tigris/gef/base/SelectionManager.java bobtarling Bob Tarling 2008-12-09 13:40:53 PST
         Re: [gef-dev] Fwd: svn commit: r1186 - trunk/src/org/tigris/gef/base/SelectionManager.java penyaskito Christian López Espínola 2008-12-16 07:39:09 PST
Messages per page: