I have a question on how to set up objects for a given problem
And
A question on how to extract data with the above objects
PROBLEM MODELED BY OBJECTS
I am representing the problem I am solving through a metaphor, that is not perfect but good enough
The metaphor is that of a galaxy which is a collection of solar systems
Each solar system has a sun and a collection of planets
Each planet has relationships to the sun
Thus I thought that
a galaxy is a collection object
containing a collection of solar systems (indexed by number of solar systems)
a solar system is an object
containing independent properties
such as sun ID
collection of planets within that specific solar system
A planet is an object
Having independent properties
ID (integer)
El (double)
Type (string)
Space coordinates of planet = an array of user defined data type (x,y,z)
Do I make SpaceCoordinates an object with properties of x, and y, and z?
And relationship properties (Object or data type?)
DistanceToSun (double)
(satellite data
Possible Numof satellite orbits between planet and sun (integer)
Array of possible orbit IDs (indexed by above possible orbits) (integer)
Array of possible orbit locations (indexed by above possible orbits) of type (x,y,z)
QUESTION #1
Does it appear I have the right idea for defining my objects and collections of objects? Originally it did not seem right that "relationship properties of a planet should be in the planet object. But then i ended up with a planet object and
a relationship object and a collection of planets and a collection of relationship objects. too confusing...so i lumped the relationship properties into the planet object. is there a better way?
In the same vain, I was not sure if, in the relationship properties section of the planet object, I should include the sallite orbit info as just more planet properties or create a user data type or another object that contained the satellite data (ie: number of possible orbits, their id, and their locations in x,y,z coordinates. my gut urges me to lump all the satellite data into an object or data type ( i do not know which is more appropriate). Am i thinking poorly? my mind can't quite get there.
Question #2
So If I set up the above as objects and collections, I believe that I have no problem until I get to
Planet object space coordinates. I do not know how to address the data type, The following is
As far as I can get:
Planet.spacecoordinates(?).value if I did this correctly, I would get the x value
And if the ? changed the y and z values
The exact same problem occurs for me when I am trying to extract orbit locations out of the array of possible orbit locations.
Any help will be appreciated.
bil
Bookmarks