Skip to content

Commit 1007b8e

Browse files
committed
refactor(AbstractFastTracking): rename field dico into dictionnary
1 parent 7a3fe2f commit 1007b8e

File tree

8 files changed

+21
-23
lines changed

8 files changed

+21
-23
lines changed

src/main/java/fr/inria/yajta/api/AbstractFastTracking.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
public abstract class AbstractFastTracking implements FastTracking {
99
private int elementCount = 1;
1010

11-
protected BiMap<String, Integer> dico = HashBiMap.create();
12-
public BiMap<String, Integer> getDico() {
13-
return dico;
11+
protected BiMap<String, Integer> dictionary = HashBiMap.create();
12+
public BiMap<String, Integer> getDictionary() {
13+
return dictionary;
1414
}
1515

1616
public File log;
@@ -24,9 +24,9 @@ public void setLogFile(File log) {
2424
public int register(String clazz, String method, String branch) {
2525
String id = clazz + "." + method + "#" + branch;
2626
int r;
27-
if(dico.containsKey(id)) r = dico.get(id);
27+
if(dictionary.containsKey(id)) r = dictionary.get(id);
2828
else {
29-
dico.put(id,elementCount);
29+
dictionary.put(id,elementCount);
3030
r = elementCount;
3131
elementCount++;
3232
}
@@ -37,9 +37,9 @@ public int register(String clazz, String method, String branch) {
3737
public int register(String clazz, String method) {
3838
String id = clazz + "." + method;
3939
int r;
40-
if(dico.containsKey(id)) r = dico.get(id);
40+
if(dictionary.containsKey(id)) r = dictionary.get(id);
4141
else {
42-
dico.put(id,elementCount);
42+
dictionary.put(id,elementCount);
4343
r = elementCount;
4444
elementCount++;
4545
}

src/main/java/fr/inria/yajta/processor/loggers/FastFollower.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ public void setLogFile(File log) {
5050
public void load(MyMap<Long, IdTreeNode> threadLogs, MyMap<Long, Boolean> threadOfftrack, BiMap<String,Integer> dico) {
5151
this.threadLogs = threadLogs;
5252
this.threadOfftrack = threadOfftrack;
53-
this.dico = dico;
53+
this.dictionary = dico;
5454
}
5555

5656
public void offTrack(long thread, int method, int cur) {
57-
BiMap<Integer, String> d = dico.inverse();
57+
BiMap<Integer, String> d = dictionary.inverse();
5858
System.err.println("[OFF TRACK] <" + d.get(method) + "> instead of <" + d.get(cur) + ">");
5959
threadOfftrack.put(thread,true);
6060

src/main/java/fr/inria/yajta/processor/loggers/FastLogger.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public void flush() {
9191
else log = new File("log" + i);
9292
}
9393
try {
94-
BiMap<Integer, String> rdico = dico.inverse();
94+
BiMap<Integer, String> rdico = dictionary.inverse();
9595
IdTreeNode.dico = i -> rdico.get(i);
9696

9797
if(log.exists()) log.delete();

src/main/java/fr/inria/yajta/processor/loggers/FastTie.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import java.util.*;
77

88
public class FastTie extends AbstractFastTracking implements FastTracking {
9-
//Set<Integer> visited = new HashSet<>();
109
Set<Integer> visited = new TreeSet<>();
1110

1211
static FastTie instance;
@@ -17,8 +16,8 @@ public static FastTie getInstance() {
1716
return instance;
1817
}
1918

20-
public void printDico() {
21-
for(Map.Entry<String, Integer> e :dico.entrySet()) {
19+
public void printDictionary() {
20+
for(Map.Entry<String, Integer> e : dictionary.entrySet()) {
2221
System.err.println("M: " + e.getKey() + " -> " + e.getValue());
2322
}
2423
}
@@ -28,7 +27,7 @@ public void stepIn(long thread, int id) {
2827
//System.err.println("[FastTie] step in " + id);
2928
if(visited.contains(id)) return;
3029
visited.add(id);
31-
System.out.println(dico.inverse().get(id) + " is new.");
30+
System.out.println(dictionary.inverse().get(id) + " is new.");
3231
/*ClassLoader cl = FastTie.class.getClassLoader();
3332
try {
3433
System.out.println("path: " + (String) cl.loadClass("spoon.test.main.MainTest").getField("curPath").get(null));

src/test/java/fr/inria/align/treediff/FastRemoteReaderTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void testProduceRemoteTraceThenReadTrace() throws MalformedTrackingClassE
5252

5353
//Check that the logs collected are consistent with what was expected
5454
List<TestFastLogger.Log> logs = TestFastLogger.getInstance().logs;
55-
BiMap<Integer, String> dico = TestFastLogger.getInstance().getDico().inverse();
55+
BiMap<Integer, String> dico = TestFastLogger.getInstance().getDictionary().inverse();
5656

5757

5858
//contract: Every method and each branch is indeed logged (in and out)
@@ -83,7 +83,7 @@ public void testReadTrace() throws InterruptedException {
8383

8484
//Check that the logs collected are consistent with what was expected
8585
List<TestFastLogger.Log> logs = TestFastLogger.getInstance().logs;
86-
BiMap<Integer, String> dico = TestFastLogger.getInstance().getDico().inverse();
86+
BiMap<Integer, String> dico = TestFastLogger.getInstance().getDictionary().inverse();
8787

8888

8989
//contract: Every method and each branch is indeed logged (in and out)

src/test/java/fr/inria/yajta/api/FastTracerTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import fr.inria.yajta.api.loggerimplem.TestFastLogger;
66
import org.junit.Test;
77

8-
import java.io.File;
98
import java.util.ArrayList;
109
import java.util.List;
1110

@@ -32,7 +31,7 @@ public void testProbesInsertion() throws MalformedTrackingClassException {
3231
logs.stream().filter(l -> l.type == TestFastLogger.LOGTYPE.OUT).count()
3332
);
3433

35-
BiMap<Integer, String> dico = TestFastLogger.getInstance().getDico().inverse();
34+
BiMap<Integer, String> dico = TestFastLogger.getInstance().getDictionary().inverse();
3635

3736
//First method logged is "main", "fr.inria.helloworld.App", "main(java.lang.String[])"
3837
assertEquals("fr.inria.helloworldf.App.main(java.lang.String[])", logs.get(0).getElementName(dico));
@@ -52,7 +51,7 @@ public void testBranchProbesInsertion() throws MalformedTrackingClassException {
5251
"main",
5352
logs);
5453

55-
BiMap<Integer, String> dico = TestFastLogger.getInstance().getDico().inverse();
54+
BiMap<Integer, String> dico = TestFastLogger.getInstance().getDictionary().inverse();
5655

5756

5857
//contract: Every method and each branch is indeed logged (in and out)

src/test/java/fr/inria/yajta/processor/loggers/FastFollowerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public void testReadTrace() throws InterruptedException {
2424

2525
//Feed traces to FastTie
2626
MyMap<Long, IdTreeNode> oldLogs = FastLogger.getInstance().exportLogs();
27-
BiMap<String, Integer> oldDico = FastLogger.getInstance().getDico();
27+
BiMap<String, Integer> oldDico = FastLogger.getInstance().getDictionary();
2828

2929
FastFollower follower = new FastFollower();
3030
MyMap<Long, Boolean> threadOfftrack = new MyMap<>();
@@ -56,7 +56,7 @@ public void testDivergentTrace() throws InterruptedException {
5656

5757
//Feed traces to FastTie
5858
MyMap<Long, IdTreeNode> oldLogs = FastLogger.getInstance().exportLogs();
59-
BiMap<String, Integer> oldDico = FastLogger.getInstance().getDico();
59+
BiMap<String, Integer> oldDico = FastLogger.getInstance().getDictionary();
6060

6161
FastFollower follower = new FastFollower();
6262
MyMap<Long, Boolean> threadOfftrack = new MyMap<>();

src/test/java/fr/inria/yajta/processor/loggers/FastTieTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ public void testReadTrace() throws InterruptedException {
2222

2323
//Feed traces to FastTie
2424
Set<Integer> logs = FastTie.getInstance().visited;
25-
BiMap<Integer, String> dico = FastTie.getInstance().getDico().inverse();
25+
BiMap<Integer, String> dico = FastTie.getInstance().getDictionary().inverse();
2626

2727

2828
//contract: Every method and each branch is indeed logged (in and out)
2929
assertTrue(logs.size() == 47);
3030

31-
//contract: As we only log each distinct method once, dico should have the same size as log
31+
//contract: As we only log each distinct method once, dictionary should have the same size as log
3232
assertEquals(logs.size(), dico.size());
3333

3434
}

0 commit comments

Comments
 (0)