Commit 39eb8a552d1ca7d4f446fedddaeae53c94f79a13

Authored by 尹本进
1 parent 45b02a76
Exists in develop

handOver注释

src/main/java/com/example/mina/client/experiment/HandoverExperiment.java
... ... @@ -31,24 +31,24 @@ public class HandoverExperiment extends Experiment {
31 31 if (one == null || one.getInList() == null) {
32 32 return;
33 33 }
34   - // 输入端口的个数
  34 + // in port count
35 35 int inSize = one.getInList().size();
36 36 if (inSize < 2) {
37 37 return;
38 38 }
39   - // 循环次数
  39 + // circle count
40 40 Integer count = options.getMaxIterCount();
41 41 if (count == null || count < 1) {
42 42 return;
43 43 }
44 44 Integer step = options.getStep();
45 45 Integer endAttenuation = options.getEndAttenuation();
46   - int dynamicCont = endAttenuation / step;
47 46 if (step == null || step <= 0) {
48 47 return;
49 48 }
  49 + int dynamicCont = endAttenuation / step;
50 50 for (int i = 0; i < count; i++) {
51   - // 输入端口只有 2 个
  51 + // in port count == 2
52 52 if (inSize == 2) {
53 53 for (int k = 0; k <= dynamicCont; k++) {
54 54 int dynamic = step * k;
... ... @@ -73,15 +73,14 @@ public class HandoverExperiment extends Experiment {
73 73 }
74 74 }
75 75 } else {
76   - // 输入端口大于 2
77   - // 行数
  76 + // in port count > 2
78 77 int rowCount = 1 + inSize * dynamicCont;
79   - // 动态衰减值 矩阵
  78 + // dynamic attenuation matrix
80 79 int[][] attenuation = new int[rowCount][inSize];
81   - // 当前动态输入端口指针
  80 + // current dynamic in port index
82 81 int current = 0;
83 82 for (int k = 0; k < rowCount; k++) {
84   - // 动态衰减值
  83 + // dynamic value
85 84 int dynamic = step * (k != 0 && k % dynamicCont == 0 ? dynamicCont : k % dynamicCont);
86 85 for (int j = 0; j < inSize; j++) {
87 86 if (j == current && j != inSize - 1) {
... ... @@ -94,13 +93,11 @@ public class HandoverExperiment extends Experiment {
94 93 attenuation[k][j] = endAttenuation;
95 94 }
96 95 }
97   - // 一轮衰减完成后,当前动态输入端口指针 加 1
98 96 if (k != 0 && k % dynamicCont == 0) {
99 97 current++;
100 98 }
101 99 }
102 100 for (int x = 0; x < rowCount; x++) {
103   - // 当前行 --> 时间点,需要发送的 命令
104 101 List<MatrixCommand> commandList = new ArrayList<>();
105 102 for (int y = 0; y < inSize; y++) {
106 103 int att = attenuation[x][y];
... ... @@ -112,7 +109,6 @@ public class HandoverExperiment extends Experiment {
112 109 }
113 110 }
114 111 commandList.forEach(this::sendCommand);
115   - // 发送完成后,清空集合。
116 112 commandList.clear();
117 113 try {
118 114 Thread.sleep(options.getPeriod() * 1000);
... ...