Class: AnalyzedClass

Inherits:
Object
  • Object
show all
Defined in:
lib/AnalyzedClass.rb

Instance Method Summary collapse

Constructor Details

#initializeAnalyzedClass

Returns a new instance of AnalyzedClass.



5
6
7
8
9
10
# File 'lib/AnalyzedClass.rb', line 5

def initialize 
	@functions = Array.new
	@variables = Array.new
	@testedFunctions = Array.new
	@numberOfLines = 0
end

Instance Method Details

#addFunction(name, numLines) ⇒ Object



12
13
14
# File 'lib/AnalyzedClass.rb', line 12

def addFunction (name, numLines)
	@functions.push(Function.new(name, numLines))
end

#addTestedFunction(function) ⇒ Object



20
21
22
23
24
# File 'lib/AnalyzedClass.rb', line 20

def addTestedFunction function
	if !(isTestedFunctionInArray function.name)
		@testedFunctions.push(function)
	end
end

#addVariable(variable) ⇒ Object



16
17
18
# File 'lib/AnalyzedClass.rb', line 16

def addVariable variable
	@variables.push(variable)
end

#fileNameObject



81
82
83
# File 'lib/AnalyzedClass.rb', line 81

def fileName
	@fileName
end

#fileName=(fileName) ⇒ Object



85
86
87
# File 'lib/AnalyzedClass.rb', line 85

def fileName=(fileName)
	@fileName = fileName
end

#functionsObject



44
45
46
# File 'lib/AnalyzedClass.rb', line 44

def functions
	@functions
end

#isLineWithTestedFunction(line) ⇒ Object



35
36
37
38
39
40
41
42
# File 'lib/AnalyzedClass.rb', line 35

def isLineWithTestedFunction line
	for function in @testedFunctions
		if line.include? function.name
			return true
		end
	end
	return false
end

#isTestedFunctionInArray(functionName) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/AnalyzedClass.rb', line 26

def isTestedFunctionInArray functionName 
	for function in @testedFunctions
		if function.name == functionName 
			return true
		end
	end
	return false
end

#nameObject



56
57
58
# File 'lib/AnalyzedClass.rb', line 56

def name
	@name
end

#name=(name) ⇒ Object



76
77
78
79
# File 'lib/AnalyzedClass.rb', line 76

def name=(name)
		name = name.strip
 	@name = name
end

#numberOfLinesObject



64
65
66
# File 'lib/AnalyzedClass.rb', line 64

def numberOfLines
	@numberOfLines
end

#numberOfLines=(numberOfLines) ⇒ Object



60
61
62
# File 'lib/AnalyzedClass.rb', line 60

def numberOfLines=(numberOfLines)
	@numberOfLines = numberOfLines
end

#numberOfLinesTestedObject



68
69
70
71
72
73
74
# File 'lib/AnalyzedClass.rb', line 68

def numberOfLinesTested
	count = 0
	for function in @testedFunctions
		count += function.numLines
	end
	return count
end

#testedFunctionsObject



52
53
54
# File 'lib/AnalyzedClass.rb', line 52

def testedFunctions
	@testedFunctions
end

#variablesObject



48
49
50
# File 'lib/AnalyzedClass.rb', line 48

def variables
	@variables
end

#variablesWithTypeObject



89
90
91
92
93
94
95
96
97
# File 'lib/AnalyzedClass.rb', line 89

def variablesWithType
	varsWithType = Array.new
	for vari in @variables
		if vari.type != nil
			varsWithType.push(vari)
		end
	end
	return varsWithType
end