def findVariable(variable, method):
    debug.writeTrace("Find Variable: " + variable)
    #Get a list of all statements in the class to check variable against
    statements = walker.getStatements(method, debug)
    for statement in statements:
        if '=' in statement.getName() and variable in statement.getName():
            debug.writeTrace("Found assignment: " + statement.getName())
            return getVariableType(statement.getName())
    return "ERROR: UNABLE TO DETERMINE VARIABLE TYPE"
def recursionDetect(parent):
    debug.writeTrace("Recursion Detect")
    #Initialise our return array which will hold recursion objects
    recursions = []
    #Get all the methods in the tree
    methods = walker.getMethods(parent, debug)
    for method in methods:
        #For each method we need to analyse the statements inside it
        statements = walker.getStatements(method, debug)
        #TODO:: Oppurtunity to implement threading here
        for statement in statements:
            debug.writeTrace("\tstatement: " + statement.getName() + " #### parent: " + statement.getParent().getName())
            if method.getName() in statement.getName():
                debug.writeTrace(statement.getName() + "\tin method: " + method.getName() + "Line: " + str(method.getLineNo()))
                statementName = statement.getName()
                methodName = method.getName()
                #Create a substring of the method call and parameters
                statementName = statementName[statementName.index(methodName):]
                #TODO:: if a param is a function call this will break
                statementName = statementName[:statementName.index(')')+1]
                #Get the params of the statement and method
                params = method.getParams()
                methodParamTypes = getMethodParamTypes(params)
                params = parse.getParams(statementName)
                statementParamTypes = getStatementParamTypes(params, method)

                #If paramater types match it's a recurisve call
                if statementParamTypes == methodParamTypes:
                    recursions.append(Recursion(statement, method))
                    debug.writeTrace("We found an actual recursion")
                    debug.writeTrace("Method:    " + method.toString() + " | line: " + str(method.getLineNo()))
                    debug.writeTrace("Statement: " + statement.getName().lstrip() + " | line: " + str(statement.getLineNo()))
                else:
                    debug.writeTrace("Not a recursive call")
                debug.writeTrace("Method param types: " + str(methodParamTypes))
                debug.writeTrace("Statement param types: " + str(statementParamTypes))
    return recursions