Hello folks,
having to entity instances, how do i determine if the two entities are directly or indirectly associated? More specifically: assume we multiple separate graphs of entities. I need to create a method that can tell about two randomly picked entities whether or not they are in the same entity graph.
For example:
Code:
PersonA
- CarA1
- LicenseCarA1
- CarA2
- LicenseCarA2
PersonB
- CarB1
- LicenseCarB1
- CarB2
- LicenseCarB2
Say our method is named "isReachable"
Code:
isReachable(PersonA, LicenseCarA2) -> true
isReachable(PersonA, LicenseCarB2) -> false
What is the most appropriate way to implement such a method?