# Path: SmellDetector/Utilities.py
# def myPrint(msg):
# def reportSmell(outputFile, fileName, smellName, reason):
# def intersection(list1, list2):
# def summation(list1, list2):


import re
import SourceModel.SM_CaseStmt
import SourceModel.SM_Class
import SourceModel.SM_Constants as SMCONSTS
import SourceModel.SM_Define
import SourceModel.SM_Define
import SourceModel.SM_Element
import SourceModel.SM_Exec
import SourceModel.SM_FileResource
import SourceModel.SM_IfStmt
import SourceModel.SM_IncludeResource
import SourceModel.SM_LCOM
import SourceModel.SM_Node
import SourceModel.SM_PackageResource
import SourceModel.SM_ServiceResource
import SourceModel.SM_User
from SmellDetector import Utilities

    def getNoOfPackageDeclarations(self):
        return self.countEntityDeclaration(SMCONSTS.PACKAGE_REGEX, "package")

    def getNoOfServiceDeclarations(self):
        return self.countEntityDeclaration(SMCONSTS.SERVICE_REGEX, "service")

    def getNoOfExecDeclarations(self):
        return self.countEntityDeclaration(SMCONSTS.EXEC_REGEX, "exec")

    def getLinesOfCode(self):
        counter = self.countEntityDeclaration(SMCONSTS.LOC_REGEX, "newLine")
        if counter > 0:
            return counter+1

        if (len(self.fileText) > 0):
            return 1
        return 0

    def getLinesOfCodeWithoutComments(self):
        totalLines = self.getLinesOfCode()
        totalCommentsLines = self.getLinesOfComments()
        return totalLines - totalCommentsLines

    def getLinesOfComments(self):
        counter = self.countEntityDeclaration(SMCONSTS.COMMENT_REGEX, "newLine")
        return counter

    def countEntityDeclaration(self, regEx, entityType):
        compiledRE = re.compile(regEx)

# Path: SmellDetector/Utilities.py
# def myPrint(msg):
# def reportSmell(outputFile, fileName, smellName, reason):
# def intersection(list1, list2):
# def summation(list1, list2):


# Path: SourceModel/SM_File.py
import re
import SourceModel.SM_CaseStmt
import SourceModel.SM_Class
import SourceModel.SM_Constants as SMCONSTS
import SourceModel.SM_Define
import SourceModel.SM_Define
import SourceModel.SM_Element
import SourceModel.SM_Exec
import SourceModel.SM_FileResource
import SourceModel.SM_IfStmt
import SourceModel.SM_IncludeResource
import SourceModel.SM_LCOM
import SourceModel.SM_Node
import SourceModel.SM_PackageResource
import SourceModel.SM_ServiceResource
import SourceModel.SM_User
from SmellDetector import Utilities


    def getNoOfPackageDeclarations(self):
        return self.countEntityDeclaration(SMCONSTS.PACKAGE_REGEX, "package")

    def getNoOfServiceDeclarations(self):
        return self.countEntityDeclaration(SMCONSTS.SERVICE_REGEX, "service")

    def getNoOfExecDeclarations(self):
        return self.countEntityDeclaration(SMCONSTS.EXEC_REGEX, "exec")

    def getLinesOfCode(self):
        counter = self.countEntityDeclaration(SMCONSTS.LOC_REGEX, "newLine")
        if counter > 0:
            return counter+1

        if (len(self.fileText) > 0):
            return 1
        return 0

    def getLinesOfCodeWithoutComments(self):
        totalLines = self.getLinesOfCode()
        totalCommentsLines = self.getLinesOfComments()
        return totalLines - totalCommentsLines

    def getLinesOfComments(self):
        counter = self.countEntityDeclaration(SMCONSTS.COMMENT_REGEX, "newLine")
        return counter

    def countEntityDeclaration(self, regEx, entityType):
        compiledRE = re.compile(regEx)

        Utilities.myPrint("Identified " + entityType + " declarations: " + str(compiledRE.findall(self.fileText)) + \