On Mar 22, 2006, at 12:13 PM, Mark O'Neill wrote:
Hi Norman,
| > Any help would be appreciated, as always.
| >
| Custom designed structures made from dictionaries of dictionaries ?
| They are fast.
|
| I just wrote a subclass of XML Reader that reads the iTunes
| plist that
| has 1500 tracks into memory in a matter of a couple of seconds into
| dictionaries of dictionaries.
Great! Sounds perfect! But... being new to RB
I haven't yet explored dictionaries,
let alone dictionaries of dictionaries! :)
I looked at the dictionary example that ships with
RB (the key value pair example) but I'm not sure
I exactly understand the point of that example as
all it seems to do is update a listbox, but anyway,
from the help file I can see it's a way of storing
key and value pairs.
Do you mean to use multiple dictionaries - much like
relational databases such as...
DICTIONARY 1 - LINE NUMBERS
key = 1, Value = 1
key = 2, Value = 1
key = 3, Value = 2
...
DICTIONARY 2 - PARAGRAPHS
(referenced from the above dict. values)
key = 1, Value = "the first paragraph which spans 2 lines)
...
etc?
If so, that sounds like a great idea as it would
be easy to extend that data structure by adding
extra dictionaries to represent different things
I needed, such as x, y, font etc - all referenced
from another dictionary.
Is that what you mean Norman?
Sure.
That is roughly what I've done with the iTunes data which if you read
the XML file is a nested hierarchy of data.
The only worry I have with that is that I would have
to do numerous lookups from different dictionaries
if I wanted to get say: the text, x, y, font, style,
page number etc, but if all of that info were in a
database I'd get all the values back with one call.
Thoughts?
You can put just about ANYTHING in a dictionary.
So you could put an instance of an object in the dictionary, and each
object could represent a "style run" of text. This would include x,y,
font, style, etc all in the one object.
Or you could have a dictionary that stores, instead of instances of
objects, more dictionaries. Each of those could have "properties"
(key/value pairs) for x, y , font, style, text, etc.
Your best bet might be to sit down and design what information you need
to keep for each run of text, and then build a set of classes that
represent a "document"
Then, the overall container (the document) MIGHT want to use a
dictionary to hold paragraphs, etc, or not. It might be an array of
objects, or some other storage for holding all the various paragraphs
and other information a document needs to be drawn, saved, printed,
etc.
Does that help ?
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>