diff --git a/src/main/java/com/example/mina/client/experiment/HandoverExperiment.java b/src/main/java/com/example/mina/client/experiment/HandoverExperiment.java index 0aa2126..43a8348 100644 --- a/src/main/java/com/example/mina/client/experiment/HandoverExperiment.java +++ b/src/main/java/com/example/mina/client/experiment/HandoverExperiment.java @@ -31,24 +31,24 @@ public class HandoverExperiment extends Experiment { if (one == null || one.getInList() == null) { return; } - // 输入端口的个数 + // in port count int inSize = one.getInList().size(); if (inSize < 2) { return; } - // 循环次数 + // circle count Integer count = options.getMaxIterCount(); if (count == null || count < 1) { return; } Integer step = options.getStep(); Integer endAttenuation = options.getEndAttenuation(); - int dynamicCont = endAttenuation / step; if (step == null || step <= 0) { return; } + int dynamicCont = endAttenuation / step; for (int i = 0; i < count; i++) { - // 输入端口只有 2 个 + // in port count == 2 if (inSize == 2) { for (int k = 0; k <= dynamicCont; k++) { int dynamic = step * k; @@ -73,15 +73,14 @@ public class HandoverExperiment extends Experiment { } } } else { - // 输入端口大于 2 - // 行数 + // in port count > 2 int rowCount = 1 + inSize * dynamicCont; - // 动态衰减值 矩阵 + // dynamic attenuation matrix int[][] attenuation = new int[rowCount][inSize]; - // 当前动态输入端口指针 + // current dynamic in port index int current = 0; for (int k = 0; k < rowCount; k++) { - // 动态衰减值 + // dynamic value int dynamic = step * (k != 0 && k % dynamicCont == 0 ? dynamicCont : k % dynamicCont); for (int j = 0; j < inSize; j++) { if (j == current && j != inSize - 1) { @@ -94,13 +93,11 @@ public class HandoverExperiment extends Experiment { attenuation[k][j] = endAttenuation; } } - // 一轮衰减完成后,当前动态输入端口指针 加 1 if (k != 0 && k % dynamicCont == 0) { current++; } } for (int x = 0; x < rowCount; x++) { - // 当前行 --> 时间点,需要发送的 命令 List commandList = new ArrayList<>(); for (int y = 0; y < inSize; y++) { int att = attenuation[x][y]; @@ -112,7 +109,6 @@ public class HandoverExperiment extends Experiment { } } commandList.forEach(this::sendCommand); - // 发送完成后,清空集合。 commandList.clear(); try { Thread.sleep(options.getPeriod() * 1000); -- libgit2 0.21.2