[V4RB2] Union problem

Ruslan Zasukhin sunshine at public.kherson.ua
Mon Apr 4 16:33:26 CDT 2005


On 4/4/05 4:23 PM, "Kem Tekinay" <ktekinay at mactechnologies.com> wrote:

> On 4/4/05 1:54 AM, Ruslan Zasukhin at sunshine at public.kherson.ua wrote:
> 
>> So you must assign it to Vset.
>> This will work
>> 
>>  dim bs, bs1 as VBitSet
>>  dim set as VSet
>> 
>>  bs = tbl.SelectNoneRecords
>>  bs1 = tbl.fld.FindContains( something )
>>  if bs1 <> nil then
>>     set = bs.Union( bs1 )
> 
> Yes, this does work. Thank you.
> 
> But I still need help with the next part. How do I turn the VSet into a
> VArraySet? I've tried:
> 
>   dim arrSet as VArraySet
> 
>   arrSet = new VArraySet(set) // Wrong parameter
>   arrSet = VArraySet(set) // Compiles, but IllegalCastException at runtime

Hi Kem,

But what is set ?

Where from and HOW you have get it?
As result of search ?
Then I assume this is VBitSet.

So let's check your code:

>   dim arrSet as VArraySet
>   arrSet = new VArraySet(set) // Wrong parameter

This not works because NOT exists constructor of VArraySet that accept Vset.
Exists constructor which access VBitSet.
This is why compiler complains.

I think you can make it working usng
    arrSet = new VArraySet( VBitSet(set) )

>   arrSet = VArraySet(set) // Compiles, but IllegalCastException at runtime

It fails because you have BY FORCE told compiler
That set is VArraySet, but I think in reality it is VBitSet.
This is why you get exception at runtime.


THE BEST WAY is:

    dim bs as VBitSet
    dim as as VArraySet

    bs = fld.Find()     // get result as VBitSet. Do not cast it to Vset.

    as = new ArraySet( bs )

-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the Valentina mailing list