1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | function SourcePositionMapper(sourceFilepath) {
|
7 | this.sourceFilePath= sourceFilepath;
|
8 | this.methods = {};
|
9 | this.branches = {};
|
10 | }
|
11 |
|
12 | SourcePositionMapper.prototype.addMethod = function(sourcePosition, index){
|
13 | this.methods[sourcePosition] = index;
|
14 | }
|
15 |
|
16 | SourcePositionMapper.prototype.addBranch = function(sourcePosition, index){
|
17 | this.branches[sourcePosition] = index;
|
18 | }
|
19 |
|
20 | SourcePositionMapper.prototype.getMethodIndex = function (sourcePosition){
|
21 | return this.methods[sourcePosition] != null ? this.methods[sourcePosition] : -1;
|
22 | }
|
23 |
|
24 | SourcePositionMapper.prototype.getBranchIndex = function (sourcePosition){
|
25 | return this.branches[sourcePosition] != null ? this.branches[sourcePosition] : -1;
|
26 | }
|
27 |
|
28 | SourcePositionMapper.prototype.getMethodsPosition = function () {
|
29 | return Object.keys(this.methods) || [];
|
30 | }
|
31 |
|
32 | SourcePositionMapper.prototype.getBranchesPosition = function () {
|
33 | return Object.keys(this.branches) || [];
|
34 | }
|
35 |
|
36 | module.exports = SourcePositionMapper; |
\ | No newline at end of file |