Dave First thing, what you describe is not an array it is a tree There are multiple ways to approach this and there are other factors to consider
1/ Persistence, do you need to persist this structure 2/ Size, Does it have to be an optimal solution or are we talking 100's not 1,000,000 of leaves If it is relatively small I'd use xml & xpath HTH Neven ----- Original Message ----- From: <[EMAIL PROTECTED]> To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]> Sent: Wednesday, August 06, 2003 7:29 AM Subject: [DUG]: Best methods for representing a 3 dimensional array > Morning all, > > > > I need to code a structure that looks like this: > > > > Q1 --- X1 --- F1 > > --- F2 > > --- F3 > > --- X2 ---- F1 > > > > Q2 -- X2 --- F1 > > > > i.e. For every Q (highest level), there can be multiple X's. For every X, > there can be multiple F's (lowest level). I want to create this structure > and then be able to traverse it. E.g. Q1, X1, F1, then Q1, X1, F2, etc. > right through the whole structure. Each Q, X, and F, are purely a string. > > > > I thought about using a multidimensional dynamic array and using Delphi help > could probably get this working. However, I'm new to Windows programming (1+ > yrs) and want to learn OO. I've written a couple of objects recently, so > thought I might try to tackle this as a Q object which has multiple X > objects inside it, and then multiple F objects inside the X objects. > > > > I've started reading about collections and trying some sample code, but > don't know enough to "create a collection within a collection", or even if > that's a correct concept. > > > > Any comments or suggestions? Would a TObjectList be better? Should I just > stick to an array? > > > > TIA > > Dave Jollie > Developer, TOWER NZ IT > > *: 09 368 4259 > *: 09 306 6801 > *: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > *: 46 Parnell Rd, Parnell, Auckland > > > > --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
