I am building a fleet unit gps system and currently and i need to figure out how to link my objects.
Here is the scenario:
- Each fleet unit may have attached one or more gps devices.
- Each fleet unit may have one or more engines.
- Each fleet unit's engine may have one or two fuel flow meters connected to one or two gps devices. Depending on the engine type the fuel flow meter can handle both the forward fuel and backward fuel, but sometimes there needs to be two different fuel flow meters, one for the forward fuel and one for the backward fuel. What makes it even worse is that some gps device models have inputs for the both fuel flow meters but others don't, so when two fuel flow meters are needed there needs to be mounted two different gps devices.
So if i have the following objects:
FleetUnit, GpsDevice, Engine, FuelFlowMeter
I want to find a way to link them without having a circular dependency.
If the FleetUnit object have a list of GpsDevice objects and list of Engine objects and GpsDevice object has a list of FuelFlowMeter and FuelFlowMeter has reference to a GpsDevice object and Engine object, I think there are too many circular dependency and the design is not clean.
Can you suggest me how to handle such scenario where few objects are behaving like a graph?