Download Restrained re-engineering
Transcript
For the most common types of x-axis value types, time and packets, abstract classes to handle basic functionality are provided. The same concept is also adopted for some y-axis value types, such as header length and compression ratio. By using multiple inheritance10 of x- and y-value type base classes, the process of creating new graph classes is simplified, as they are only required to implement the function paintData(). Providing base classes for y-value types is of course only useful if the program contains more than one graph plotting these y-value types against different x-value types. For some graphs this may not be applicable, in which case a y-value type base class need not be provided. Graph meta-information A graph itself has basic properties such as a name, an x-axis and a y-axis title, axis grading etc. These properties are maintained by an HCSimGraphInfoManager, which acts as the interface to the graph for classes that wish to change or gain access to these properties. By making this interface the only view of a graph that is accessible to these classes, they are independent of the particular type of graph that the interface represents. Plot meta-information One graph can contain several plots, each of which has its own traits such as a label, a color, a line type, line width and other properties. An HCSimPlotInfoManager maintains instances of class HCSimPlotInfo that represent this information. Analogous to class HCSimGraphInfoManager, the references to HCSimPlotInfo objects provided by this manager are the only aspect of this information that is permitted to classes that need access to it. HCSimGraphInfoManager getZoomX() getZoomY() setZoomX() setZoomY() HCSimPlotInfoManager 1..* HCSimPlotInfo <<abstract>> HCSimGraph paintData() paintXAxis() paintYAxis() <<abstract>> HCSimGraphXPacket paintXAxis() getZoomX() setZoomX() <<abstract>> HCSimGraphXTime paintXAxis() getZoomX() setZoomX() HCSimGraphHeaderLength_vs_Packets paintData() <<abstract>> HCSimGraphYHeaderLength <<abstract>> HCSimGraphYCompressionRate paintYAxis() paintYAxis() getZoomY() getZoomY() setZoomY() setZoomY() HCSimGraphCompressionRate_vs_Time paintData() <<abstract>> HCSimGraphYPacketRate paintYAxis() getZoomY() setZoomY() HCSimGraphPacketRate_vs_Time paintData() Figure 26. The class structure of graphs in HC-Sim GUI. 10 Should multiple inheritance not be available in the language of choice, then aggregation could also be used. 38