S
spudtheimpaler
Hi there. I have an array of objects that i will be referring to in my
program, they are sections of a transport system. In the system I am
simulating historically and presently they are labelled alphabetically
of the form AAA or CBA. I am simulating a smaller section and will
currently only be using two characters. Say AA - AZ for one set of
sections, BA - BR for a second, smaller set etc...
Does anyone have any recommendations of good ways of using these
'codes' as the index to an array of such objects. As far as i know
using Java you can only use integers as an index to an array but I may
be mistaken (I think in php and others you can index aray['aa']). Is
there perhaps a way to use integers as the index but miss numbers, or
not do them in order (EG perhaps the letters could be the hex
interpretation of an integer index - though then the first index would
be at 170, and then if i used AAA it would be 2730) if i used this
method how much memory /resources would the empty objects take up (as
in would the empty objects still take up memory or is there a method
for leaving them empty / null and thus taking no / little memory)
I hope I have been clear in what i am looking for, i realise this is
more looking for ideas than help with code but I hope you can still
help.
Kind Regards,
Mitch.
program, they are sections of a transport system. In the system I am
simulating historically and presently they are labelled alphabetically
of the form AAA or CBA. I am simulating a smaller section and will
currently only be using two characters. Say AA - AZ for one set of
sections, BA - BR for a second, smaller set etc...
Does anyone have any recommendations of good ways of using these
'codes' as the index to an array of such objects. As far as i know
using Java you can only use integers as an index to an array but I may
be mistaken (I think in php and others you can index aray['aa']). Is
there perhaps a way to use integers as the index but miss numbers, or
not do them in order (EG perhaps the letters could be the hex
interpretation of an integer index - though then the first index would
be at 170, and then if i used AAA it would be 2730) if i used this
method how much memory /resources would the empty objects take up (as
in would the empty objects still take up memory or is there a method
for leaving them empty / null and thus taking no / little memory)
I hope I have been clear in what i am looking for, i realise this is
more looking for ideas than help with code but I hope you can still
help.
Kind Regards,
Mitch.