I have a class Track
which holds a set of Point
s and represent person location in time. In order to get this result I run an iterative optimization routine combining different data. In order to do it I extend Point
with a class OptimizedPoint
which holds data for optimization for this point and current value. I also introduce OptimizedTrack which is a collection of OptimizedPoints
and additional data needed for optimization associated with the whole track.
I run an optimization on OptimizedTrack
and at the last iteration, I return to the user clean data (Track
) which only has the result and doesn't have additional data. However, I can not find a way to express with OOP that OptimizedTrack
is somehow an extension of the Track
and introduce common routines for them. F.e getting a length of the track which should be available for both of them as it only uses data which can be found both in OptimizedTrack
and Track
Right now I have such architecture Point{x, y, z}, OptimizedPoint extends Point {additional_data}. Track {array<Point>}, OptimizedTrack {array<OptimizedPoint>, additional_data}
. I don't understand how to express that OptimizedTrack
is an extension of Track as I can not express array<OptimizedPoint>
extens array<Point>
. So I can not introduce a common routine length
which can be calculated for array and therefore also from array.
I do not insist on my current architecture. It's most probably wrong, I only write it here to express the problem I am facing. How would you propose to refactor my architecture in this case?
Aucun commentaire:
Enregistrer un commentaire