I have an abstract class "A" that has a property of an enum type "OutputType", and an abstract method calculation() that needs to do a certin calculation and to output the result in a double[] **according to the OutputType value.
I also have a classes defined as D1,D2,D3...D20, derive from A, Where each Di class implements A's classification() method differently.
The problem is that not all of the OutputType values (the calculation() output types) are supported in every Di
For example:
If OutputType enum values are "Scaled", "NonScaled" and "ConstantLength",
A certin Di can support "Scaled" and "NonScaled" but not support "ConstantLength" and another Di can support all of the operation types,
My question is:
What is the right design pattern to implement this kind of behaiver?
Please avoid the obvious "Throw if the OutputType property recieves a value of a non supported operation" answers.
Aucun commentaire:
Enregistrer un commentaire