On 11/07/2012 07:23, Wolfgang Laun wrote:
On 11/07/2012, Mark Proctor <mproctor(a)codehaus.org> wrote:
> my mistake, length should not be zero based:
> if ( depth == stack.length - 1 ) {
> // increase the stack if we have used up all space
> int[] newStack = new int[depth * 3 ];
> System.arraycopy( stack, 0, newStack, 0, stack.length);
> stack = newStack;
> }
What do you mean by "length should not be zero based"?
first one was
this:
System.arraycopy( stack, 0, newStack, 0, stack.length -1);
my repeated one is this:
System.arraycopy( stack, 0, newStack, 0, stack.length);
Ther is no need to do the -1.
Mark
Sorry, this just repeats your earlier version. This allocates a new
array with triplicated lenght (not length-1 - but that's no problem)
and copies the old into the new.
stack = Arrays.copyOf( stack, stack.length * 3 );
What's wrong with this?
It's jdk1.6, that method does not exist in jdk1.5
Mark
-W
>
> On 11/07/2012 00:18, Mark Proctor wrote:
>> ok I think I see what you mean, it's overwriting the array it's
>> copying from. have updated it, and running tests now:
>> if ( depth == stack.length - 1 ) {
>> // increase the stack if we have used up all space
>> int[] newStack = new int[depth * 3 ];
>> System.arraycopy( stack, 0, newStack, 0,
>> stack.length-1 );
>> stack = newStack;
>> }
>>
>> Mark
>> On 11/07/2012 00:04, Mark Proctor wrote:
>>> Wolfgang,
>>>
>>> Not sure what you mean, I just checked the src, line 150:
>>>
https://github.com/droolsjbpm/drools/blob/c00d45712f1cf2027ebda9e7df41567...
>>>
>>>
>>>
>>> public void recurse() {
>>> if ( depth == stack.length - 1 ) {
>>> // increase the stack if we have used up all space
>>> stack = new int[depth * 3 ];
>>> stack = Arrays.copyOf( stack, stack.length * 3 );
>>> } The comment doesn't exist there to remove. Mark
>>>
>>>
>>>
>>> On 07/07/2012 07:05, Wolfgang Laun wrote:
>>>> Removing the line marked with //>>> helps.
>>>>
>>>> public void recurse() {
>>>>
>>>> if ( depth == stack.length - 1 ) {
>>>> // increase the stack if we have used up all space
>>>> //>>> stack = new int[depth * 3 ];
>>>> stack = Arrays.copyOf( stack, stack.length * 3 );
>>>> }
>>>>
>>>> Cheers
>>>> Wolfgang
>>> On 07/07/2012, Mark Proctor <mproctor(a)codehaus.org> wrote:
>>>>> I started to write this range indexing class, based on a RBTree
>>>>> implementation that I lifted from the web somewhere. However it's
a
>>>>> bit
>>>>> buggy, and large ranges null pointer. Anyone want to work on making
>>>>> these stable? Once done we can start using them with not/exists
nodes.
>>>>> Standard joins will take a bit more work, due to some integration
>>>>> issues
>>>>> of the tuple structures.
>>>>>
>>>>> The two classes can be found in this commit, just try removing the
>>>>> @Ignore to see the issues, and feel free to add more range tests.
>>>>>
https://github.com/droolsjbpm/drools/commit/c789459c431763581db02653fb7bf...
>>>>>
>>>>>
>>>>> drools-core/src/main/java/org/drools/core/util/RBTree.java
>>>>> drools-core/src/test/java/org/drools/core/util/RBTreeTest.java
>>>>>
>>>>> Mark
>>>>> _______________________________________________
>>>>> rules-dev mailing list
>>>>> rules-dev(a)lists.jboss.org
>>>>>
https://lists.jboss.org/mailman/listinfo/rules-dev
>>>>>
>>>> _______________________________________________
>>>> rules-dev mailing list
>>>> rules-dev(a)lists.jboss.org
>>>>
https://lists.jboss.org/mailman/listinfo/rules-dev
>>>
>>
>
> _______________________________________________
> rules-dev mailing list
> rules-dev(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-dev
>
_______________________________________________
rules-dev mailing list
rules-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev