1
2 """Common stuff for classes that use analyzers"""
3
4 from os import path,mkdir
5
7 """This class collects information and methods that are needed for
8 handling analyzers"""
9
11 """@param filename: name of the file that is being analyzed
12 @param analyzer: the analyzer itself"""
13
14 self.analyzer=analyzer
15
16 if 'dir' in dir(self):
17 self.logDir=path.join(self.dir,filename+".analyzed")
18 else:
19 self.logDir=filename+".analyzed"
20
21 if not path.exists(self.logDir):
22 mkdir(self.logDir)
23
24 self.reset()
25
28
30 """@returns: A list with the names of the analyzers"""
31 return self.analyzer.listAnalyzers()
32
34 """@param name: name of the LineAnalyzer to get"""
35 return self.analyzer.getAnalyzer(name)
36
38 """@param name: name of the LineAnalyzer to add
39 @param analyzer: the analyzer to add"""
40 return self.analyzer.addAnalyzer(name,analyzer)
41
43 """Not to be called: calls the analyzer for the current line"""
44 self.analyzer.analyzeLine(line)
45
47 """reset the analyzer"""
48 self.analyzer.setDirectory(self.logDir)
49
51 """Get the name of the directory where the data is written to"""
52 return self.logDir
53
55 """Get the execution time"""
56 return self.analyzer.getTime()
57