implemented calcComplexity