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