Junilu Lacar wrote:No, the way you did it is not normal. In fact, it's quite horrific. You need some kind of data structure to hold all those different but essentially similar things. Like a collection of Sector of objects, each one distinguishable from all the others via a unique identifier.
Junilu Lacar wrote:No, the way you did it is not normal. In fact, it's quite horrific. You need some kind of data structure to hold all those different but essentially similar things. Like a collection of Sector of objects, each one distinguishable from all the others via a unique identifier.
mike Vigor wrote:
Junilu Lacar wrote:No, the way you did it is not normal. In fact, it's quite horrific. You need some kind of data structure to hold all those different but essentially similar things. Like a collection of Sector of objects, each one distinguishable from all the others via a unique identifier.
where are the duplicated codes? I can't see them..
mike Vigor wrote:where are the duplicated codes? I can't see them..
Liutauras Vilda wrote:
mike Vigor wrote:where are the duplicated codes? I can't see them..
mike Vigor wrote:but well these are not the problems why I'm here..now I thinking of a way of generating those sectors for the class fermi so that I don't have to type all those fields
Junilu Lacar wrote: You need some kind of data structure to hold all those different but essentially similar things. Like a collection of Sector of objects, each one distinguishable from all the others via a unique identifier.
All things are lawful, but not all things are profitable.
Knute Snortum wrote:
mike Vigor wrote:but well these are not the problems why I'm here..now I thinking of a way of generating those sectors for the class fermi so that I don't have to type all those fields
Junilu Lacar wrote: You need some kind of data structure to hold all those different but essentially similar things. Like a collection of Sector of objects, each one distinguishable from all the others via a unique identifier.
I would use a Map, something like:
...or maybe even
mike Vigor wrote:this solution is not ideal..with a map of 100 sectors I will have too many things to type..lol..infact I'm now using some couples of loops and mutual esclusion to set the type of the sector...
Not much better. Your String array doesn't represent areas.mike Vigor wrote:. . . ..what do you guys think..now I post is here . . .
That might not be necessary. If you look closely the Sectors are laid out in a grid with up/down jogs depending on whether the letter is odd or even.Campbell Ritchie wrote:You do appear to have a Sector class, but that doesn't relate to other Sectors. Strings don't count. Each Sector should have fields for adjacent Sectors.
Carey Brown wrote:
That might not be necessary. If you look closely the Sectors are laid out in a grid with up/down jogs depending on whether the letter is odd or even.Campbell Ritchie wrote:You do appear to have a Sector class, but that doesn't relate to other Sectors. Strings don't count. Each Sector should have fields for adjacent Sectors.
I wrote:... A more object-oriented API would turn that around into something like:
See line 28 of the sample code I provided. It would allow Sector to implement this without the explicit organization being necessary.Junilu Lacar wrote:
I wrote:... A more object-oriented API would turn that around into something like:
Carey Brown wrote:See line 28 of the sample code I provided. It would allow Sector to implement this without the explicit organization being necessary.
Carey Brown wrote:See line 28 of the sample code I provided. It would allow Sector to implement this without the explicit organization being necessary.
Knute Snortum wrote:I would use a Map, something like:
My cellmate was this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|