I'd rather model InterestGroup and maybe Interest as separate classes.
This would make your design cleare and avoid multi dimensional arrays. If
an InterestGroup has some qualifying name you might even consider storing
InterestGroups in a hash and not as an array.
robert
"Andi Scharfstein" <marsberger / t-online.de> schrieb im Newsbeitrag
news:1653958937.20030418191835 / myrealbox.com...
> Hi,
> I have created a 'Person' class that uses multi-dimensional arrays to
> store information about particular interests of 'Person' objects. I
> don't know by compile time how many interest groups each person is
> going to have, and how many interests there are to each group. So,
> until now I have used a second array (that belongs to the Person
> class) to store meta-information about the interest array, in
> particular, how many interests there are to each interest group.
> E.g., if I had the following interest array:
>
> Interest 1 | Interest 2 | Interest 3
> Sub1 | Sub2 | Sub6
> | Sub3 | Sub7
> | Sub4 |
> | Sub5
>
> there would be a second array of:
> { 1, 4, 2 }
>
> I have implemented the multi-dimensional array as stated on
> http://www.ir.isas.ac.jp/~masa/ruby/mdary.html, like so:
>
> class MDArray < Array
> def [](n)
> self[n] = MDArray.new if super(n) == nil
> super(n)
> end
> end
>
> Now I wonder: is there a more efficient way to keep track of rows and
> columns of this array, i.e., is there some method to extract the
> number of rows a particular column has, and vice versa? Thanks a lot.
>
> --
> Bye: Andi S. mailto:nullpointer / myrealbox.com
>
>