44
55import com .o3smeasures .astvisitors .ClassVisitor ;
66import com .o3smeasures .javamodel .DepthOfInheritanceTreeJavaModel ;
7+ import com .o3smeasures .measures .enumeration .MeasuresEnum ;
78import com .o3smeasures .structures .Measure ;
89
910/**
@@ -20,6 +21,7 @@ public class DepthOfInheritanceTree extends Measure{
2021 private double value ;
2122 private double mean ;
2223 private double max ;
24+ private double min ;
2325 private String classWithMaxValue ;
2426 private boolean isEnable ;
2527
@@ -28,6 +30,7 @@ public DepthOfInheritanceTree(){
2830 this .value = 0d ;
2931 this .mean = 0d ;
3032 this .max = 0d ;
33+ this .min = 0d ;
3134 this .classWithMaxValue = "" ;
3235 this .isEnable = true ;
3336 addApplicableGranularity (Granularity .PACKAGE );
@@ -38,15 +41,15 @@ public DepthOfInheritanceTree(){
3841 */
3942 @ Override
4043 public String getName () {
41- return "Depth of Inheritance Tree" ;
44+ return MeasuresEnum . DIT . getName () ;
4245 }
4346
4447 /**
4548 * @see Measure#getAcronym
4649 */
4750 @ Override
4851 public String getAcronym () {
49- return " DIT" ;
52+ return MeasuresEnum . DIT . getAcronym () ;
5053 }
5154
5255 /**
@@ -62,7 +65,7 @@ public String getDescription() {
6265 */
6366 @ Override
6467 public double getMinValue () {
65- return 0d ;
68+ return min ;
6669 }
6770
6871 /**
@@ -127,7 +130,6 @@ public boolean isEnable() {
127130 @ Override
128131 public void setEnable (boolean isEnable ) {
129132 this .isEnable = isEnable ;
130-
131133 }
132134
133135 /**
@@ -143,6 +145,7 @@ public <T> void measure(T unit) {
143145 setCalculatedValue (Math .abs (ditJavaModel .getDitValue ()));
144146 setMeanValue (getCalculatedValue ());
145147 setMaxValue (getCalculatedValue (), ((ICompilationUnit ) unit ).getElementName ());
148+ setMinValue (getCalculatedValue ());
146149 }
147150
148151 /**
@@ -182,4 +185,10 @@ public void setClassWithMaxValue(String value) {
182185 this .classWithMaxValue = value ;
183186 }
184187
188+ @ Override
189+ public void setMinValue (double value ) {
190+ if (min > value || min == 0d ){
191+ this .min = value ;
192+ }
193+ }
185194}
0 commit comments