I writing an application for diffrent geometrical types of fuel tanks.
I have a design problem that only at runtime I will recieve from the end user the exact type of tank to be examined and i dont know how to create/handle an dynamic object on the server side.
simplified example :
A tank can have 3 geometrical types of head : conical, dished and flat. each type of head needs to be checked differently.
I have created a parent class named "head" , that have all the common parameters to all geometrical types of head (diameter, thickness etc.).
Each child class (conical, dished and flat) extends the head and have its own Class variables.
The end user will choose, for example, a tank with conical heads and input all the required parameters and send it to the server for check...
at this stage I am stuck, I dont know how to handle the dynamic data...I got a suggestion to use FACTORY design pattern, but because every class have different Class variables, I dont think that it is the right direction.
best regards
code without constractor and get/set methods
public class Head {
private float headThickness=0;
private float headThicknessTolerance=0;
private ShapeOfHead headShape;
private float knuckleRadius=0;
private int numberOfHeadPieces=4;
private HeadSide headSide;
private Figure8_1WeldingDetails headLongitudinalWeld;
private Figure9_1WeldingDetails headCircumferentialWeld;
private Bracing headBracing;
}
public class DishedHead extends Head{
private float dishedHeadDepth;
}
public class ConicalHead extends Head {
private float conicalHeadHeight;
}
Aucun commentaire:
Enregistrer un commentaire