Skip to content

Commit 91f8a3b

Browse files
增强功能,1.44 版本发布
移除 AS 库的所有日志
1 parent 4da4f3a commit 91f8a3b

20 files changed

+26
-185
lines changed

src_code/.idea/misc.xml

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src_code/README-Chinese.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
### 更新日志
1010

11-
* 框架版本:1.42 - 1.43
11+
* 框架版本:1.42 - 1.44
1212
* 移除了日志。增强性能!
1313

14-
### Version update date : 2024-12-25
14+
### Version update date : 2025-01-17

src_code/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
### Update log:
1010

11-
* Framework version: 1.42-1.43
11+
* Framework version: 1.42-1.44
1212
* Removed the log. Enhance performance!
1313

14-
### Version update date : 2024-12-25
14+
### Version update date : 2025-01-17

src_code/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>io.github.BeardedManZhao</groupId>
77
<artifactId>algorithmStar</artifactId>
8-
<version>1.43</version>
8+
<version>1.44</version>
99
<packaging>jar</packaging>
1010
<name>algorithmStar</name>
1111
<description>algorithmStar-java</description>

src_code/src/main/java/io/github/beardedManZhao/algorithmStar/algorithm/OperationAlgorithmManager.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
import io.github.beardedManZhao.algorithmStar.exception.OperationAlgorithmManagementException;
44
import io.github.beardedManZhao.algorithmStar.exception.OperationAlgorithmNotFound;
55
import io.github.beardedManZhao.algorithmStar.utils.DependentAlgorithmNameLibrary;
6-
import org.slf4j.Logger;
7-
import org.slf4j.LoggerFactory;
86

9-
import java.util.Date;
107
import java.util.HashMap;
118

129
/**
@@ -21,13 +18,16 @@ public final class OperationAlgorithmManager implements OperationAlgorithm {
2118
/**
2219
* AS version
2320
*/
24-
public final static float VERSION = 1.43f;
21+
public final static float VERSION = 1.44f;
2522

2623
/**
2724
* 计算组件的日志打印开关,当此处值为false的时候,计算组件中的日志将不会被打印,logger也不会被调用,一般来说,这里为了减少冗余的字符串实例化操作,会设置为false,当需要调试的时候才需要打开此处的数值。
2825
* <p>
2926
* The log printing switch of the calculation component. When the value here is false, the log in the calculation component will not be printed and the logger will not be called. Generally speaking, in order to reduce redundant string instantiation operations, the value here will be set to false. You need to turn on the value here only when debugging is required.
27+
*
28+
* @deprecated 1.44 以及以后的版本中 将不会使用日志功能,此配置将于 1.45 版本中正式移除。
3029
*/
30+
@Deprecated
3131
public static final boolean PrintCalculationComponentLog = false;
3232
/**
3333
* 算法对象存档集合,您可以将算法对象存储到该集合中

src_code/src/main/java/io/github/beardedManZhao/algorithmStar/algorithm/aggregationAlgorithm/BatchAggregation.java

-10
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
import io.github.beardedManZhao.algorithmStar.exception.OperatorOperationException;
55
import io.github.beardedManZhao.algorithmStar.operands.vector.DoubleVector;
66
import io.github.beardedManZhao.algorithmStar.operands.vector.IntegerVector;
7-
import org.slf4j.Logger;
8-
import org.slf4j.LoggerFactory;
97

108
import java.util.concurrent.CountDownLatch;
119

@@ -27,12 +25,10 @@ public abstract class BatchAggregation implements AggregationAlgorithm {
2725
protected final static String DOUBLE_VECTOR_FUNCTION_LOG = "run function => double calculation(DoubleVector doubleVector)";
2826
protected final static String INTS_VECTOR_FUNCTION_LOG = "run function => int[] calculation(boolean Multithreading, IntegerVector... integerVector)";
2927
protected final static String DOUBLES_VECTOR_FUNCTION_LOG = "run function => double[] calculation(boolean Multithreading, DoubleVector... doubleVector)";
30-
protected final Logger logger;
3128
private final String Name;
3229

3330
protected BatchAggregation(String name) {
3431
Name = name;
35-
logger = LoggerFactory.getLogger(name);
3632
}
3733

3834
/**
@@ -46,7 +42,6 @@ protected BatchAggregation(String name) {
4642
* @return 向量中所有元素的聚合结果数值
4743
*/
4844
public int calculation(IntegerVector integerVector) {
49-
logger.info(INT_VECTOR_FUNCTION_LOG);
5045
return calculation(integerVector.toArray());
5146
}
5247

@@ -61,7 +56,6 @@ public int calculation(IntegerVector integerVector) {
6156
* @return 向量中所有元素的聚合结果数值
6257
*/
6358
public double calculation(DoubleVector doubleVector) {
64-
logger.info(DOUBLE_VECTOR_FUNCTION_LOG);
6559
return calculation(doubleVector.toArray());
6660
}
6761

@@ -79,7 +73,6 @@ public double calculation(DoubleVector doubleVector) {
7973
* @return 向量中所有元素的聚合结果数值
8074
*/
8175
public int[] calculation(boolean Multithreading, IntegerVector... integerVector) {
82-
logger.info(INTS_VECTOR_FUNCTION_LOG);
8376
final int[] res = new int[integerVector.length];
8477
if (Multithreading) {
8578
final CountDownLatch countDownLatch = new CountDownLatch(integerVector.length);
@@ -119,7 +112,6 @@ public int[] calculation(boolean Multithreading, IntegerVector... integerVector)
119112
* @return 向量中所有元素的聚合结果数值
120113
*/
121114
public double[] calculation(boolean Multithreading, DoubleVector... doubleVector) {
122-
logger.info(DOUBLES_VECTOR_FUNCTION_LOG);
123115
final double[] res = new double[doubleVector.length];
124116
if (Multithreading) {
125117
final CountDownLatch countDownLatch = new CountDownLatch(doubleVector.length);
@@ -160,7 +152,6 @@ public double[] calculation(boolean Multithreading, DoubleVector... doubleVector
160152
* The result value of the new array after aggregation of each group of data.
161153
*/
162154
public double[] calculation(boolean Multithreading, double[]... doubles) {
163-
logger.info(DOUBLES_FUNCTION_LOG);
164155
double[] res = new double[doubles.length];
165156
if (Multithreading) {
166157
final CountDownLatch countDownLatch = new CountDownLatch(doubles.length);
@@ -202,7 +193,6 @@ public double[] calculation(boolean Multithreading, double[]... doubles) {
202193
* The result value of the new array after aggregation of each group of data.
203194
*/
204195
public int[] calculation(boolean Multithreading, int[]... ints) {
205-
logger.info(INTS_FUNCTION_LOG);
206196
int[] res = new int[ints.length];
207197
if (Multithreading) {
208198
final CountDownLatch countDownLatch = new CountDownLatch(ints.length);

src_code/src/main/java/io/github/beardedManZhao/algorithmStar/algorithm/aggregationAlgorithm/ModularOperation.java

-4
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ public static ModularOperation getInstance(String Name) {
6060
*/
6161
@Override
6262
public int calculation(IntegerVector integerVector) {
63-
logger.info(INT_VECTOR_FUNCTION_LOG);
6463
return integerVector.moduleLength();
6564
}
6665

@@ -76,7 +75,6 @@ public int calculation(IntegerVector integerVector) {
7675
*/
7776
@Override
7877
public double calculation(DoubleVector doubleVector) {
79-
logger.info(DOUBLE_VECTOR_FUNCTION_LOG);
8078
return doubleVector.moduleLength();
8179
}
8280

@@ -92,7 +90,6 @@ public double calculation(DoubleVector doubleVector) {
9290
*/
9391
@Override
9492
public double calculation(double... doubles) {
95-
logger.info(DOUBLE_FUNCTION_LOG);
9693
return calculation(DoubleVector.parse(doubles));
9794
}
9895

@@ -108,7 +105,6 @@ public double calculation(double... doubles) {
108105
*/
109106
@Override
110107
public int calculation(int... ints) {
111-
logger.info(INT_FUNCTION_LOG);
112108
return calculation(IntegerVector.parse(ints));
113109
}
114110
}

src_code/src/main/java/io/github/beardedManZhao/algorithmStar/algorithm/generatingAlgorithm/Dijkstra.java

-8
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
import io.github.beardedManZhao.algorithmStar.operands.route.IntegerConsanguinityRoute;
1111
import io.github.beardedManZhao.algorithmStar.utils.ASClass;
1212
import io.github.beardedManZhao.algorithmStar.utils.DependentAlgorithmNameLibrary;
13-
import org.slf4j.Logger;
14-
import org.slf4j.LoggerFactory;
1513

1614
import java.util.HashMap;
1715
import java.util.LinkedHashMap;
@@ -28,7 +26,6 @@
2826
*/
2927
public class Dijkstra implements GeneratingAlgorithmMany {
3028

31-
protected final Logger logger;
3229
protected final String AlgorithmName;
3330
// 线路记载容器
3431
protected final HashMap<String, DoubleConsanguinityRoute> stringDoubleConsanguinityRouteHashMap = new HashMap<>();
@@ -38,11 +35,9 @@ public class Dijkstra implements GeneratingAlgorithmMany {
3835

3936
protected Dijkstra() {
4037
this.AlgorithmName = "Dijkstra";
41-
this.logger = LoggerFactory.getLogger("Dijkstra");
4238
}
4339

4440
protected Dijkstra(String AlgorithmName) {
45-
this.logger = LoggerFactory.getLogger(AlgorithmName);
4641
this.AlgorithmName = AlgorithmName;
4742
}
4843

@@ -232,9 +227,6 @@ public void addRoute(DoubleConsanguinityRoute doubleConsanguinityRoute) {
232227
String SEName = startingCoordinateName + " -> " + endPointCoordinateName;
233228
// 获取终止点到起始点的名称
234229
String ESName = endPointCoordinateName + " -> " + startingCoordinateName;
235-
if (OperationAlgorithmManager.PrintCalculationComponentLog) {
236-
logger.info("Insert " + SEName + " AND " + ESName + "=> " + trueDistance);
237-
}
238230
// 第一轮分配起始点的周边
239231
EstablishTwoPointConnection(startingCoordinateName, endPointCoordinateName, trueDistance, this.hashMap);
240232
// 第二轮分配终止点的周边,因为该起始点属于终止点的周边

src_code/src/main/java/io/github/beardedManZhao/algorithmStar/algorithm/generatingAlgorithm/Dijkstra2D.java

-8
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
import io.github.beardedManZhao.algorithmStar.operands.route.IntegerConsanguinityRoute2D;
1212
import io.github.beardedManZhao.algorithmStar.utils.ASClass;
1313
import io.github.beardedManZhao.algorithmStar.utils.DependentAlgorithmNameLibrary;
14-
import org.slf4j.Logger;
15-
import org.slf4j.LoggerFactory;
1614

1715
import java.util.HashMap;
1816
import java.util.LinkedHashMap;
@@ -28,7 +26,6 @@
2826
*/
2927
public class Dijkstra2D implements GeneratingAlgorithm2D {
3028

31-
protected final Logger logger;
3229
protected final String AlgorithmName;
3330
// 线路记载容器
3431
protected final HashMap<String, DoubleConsanguinityRoute2D> doubleConsanguinityRoute2DHashMap = new HashMap<>();
@@ -38,11 +35,9 @@ public class Dijkstra2D implements GeneratingAlgorithm2D {
3835

3936
protected Dijkstra2D() {
4037
this.AlgorithmName = "Dijkstra2D";
41-
this.logger = LoggerFactory.getLogger("Dijkstra2D");
4238
}
4339

4440
protected Dijkstra2D(String AlgorithmName) {
45-
this.logger = LoggerFactory.getLogger(AlgorithmName);
4641
this.AlgorithmName = AlgorithmName;
4742
}
4843

@@ -142,9 +137,6 @@ public void addRoute(DoubleConsanguinityRoute2D route) {
142137
String ESName = endPointCoordinateName + " -> " + startingCoordinateName;
143138
// 计算该线路的始末坐标距离
144139
double trueDistance = this.distanceAlgorithm.getTrueDistance(route);
145-
if (OperationAlgorithmManager.PrintCalculationComponentLog) {
146-
logger.info("Insert " + SEName + " AND " + ESName + "=> " + trueDistance);
147-
}
148140
// 第一轮分配起始点的周边
149141
extracted(startingCoordinateName, endPointCoordinateName, trueDistance);
150142
// 第二轮分配终止点的周边,因为该起始点属于终止点的周边

src_code/src/main/java/io/github/beardedManZhao/algorithmStar/algorithm/generatingAlgorithm/DirectionalDijkstra2D.java

-6
Original file line numberDiff line numberDiff line change
@@ -88,17 +88,11 @@ public void addRoute(DoubleConsanguinityRoute2D route) {
8888
if (isForward()) {
8989
// 获取起始点到终止点的名称
9090
String SEName = startingCoordinateName + " -> " + endPointCoordinateName;
91-
if (OperationAlgorithmManager.PrintCalculationComponentLog) {
92-
logger.info("Insert " + SEName + " => " + trueDistance);
93-
}
9491
extracted(startingCoordinateName, endPointCoordinateName, trueDistance);
9592
this.doubleConsanguinityRoute2DHashMap.put(SEName, route);
9693
} else {
9794
// 获取起始点到终止点的名称
9895
String ESName = endPointCoordinateName + " -> " + startingCoordinateName;
99-
if (OperationAlgorithmManager.PrintCalculationComponentLog) {
100-
logger.info("Insert " + ESName + " => " + trueDistance);
101-
}
10296
extracted(endPointCoordinateName, startingCoordinateName, trueDistance);
10397
this.doubleConsanguinityRoute2DHashMap.put(ESName, route);
10498
}

src_code/src/main/java/io/github/beardedManZhao/algorithmStar/algorithm/generatingAlgorithm/ZhaoCoordinateNet.java

+10-32
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import io.github.beardedManZhao.algorithmStar.exception.TargetNotRealizedException;
66
import io.github.beardedManZhao.algorithmStar.operands.route.DoubleConsanguinityRoute;
77
import io.github.beardedManZhao.algorithmStar.utils.ASClass;
8-
import org.slf4j.Logger;
9-
import org.slf4j.LoggerFactory;
108

119
import java.util.ArrayList;
1210
import java.util.HashMap;
@@ -23,17 +21,14 @@
2321
*/
2422
public class ZhaoCoordinateNet implements GeneratingAlgorithm {
2523

26-
protected final Logger logger;
2724
protected final String AlgorithmName;
2825
private final HashMap<String, DoubleConsanguinityRoute> stringDoubleConsanguinityCoordinateHashMap = new HashMap<>();
2926

3027
protected ZhaoCoordinateNet() {
3128
this.AlgorithmName = "ZhaoCoordinateNet";
32-
this.logger = LoggerFactory.getLogger("ZhaoCoordinateNet");
3329
}
3430

3531
protected ZhaoCoordinateNet(String AlgorithmName) {
36-
this.logger = LoggerFactory.getLogger(AlgorithmName);
3732
this.AlgorithmName = AlgorithmName;
3833
}
3934

@@ -87,33 +82,16 @@ public void addRoute(DoubleConsanguinityRoute doubleConsanguinityRoute) {
8782
String endPointCoordinateName = doubleConsanguinityRoute.getEndPointCoordinateName();
8883
// 判断该路线的结束点 是否有和其它点的依赖关系,如果有就在两点血亲坐标之间建立新血亲
8984
List<DoubleConsanguinityRoute> start = getConsanguinity(doubleConsanguinityRoute);
90-
if (OperationAlgorithmManager.PrintCalculationComponentLog) {
91-
for (DoubleConsanguinityRoute consanguinityCoordinate : start) {
92-
String startingCoordinateName1 = consanguinityCoordinate.getStartingCoordinateName();
93-
if (startingCoordinateName1.equals(startingCoordinateName)) {
94-
// 如果是起始点有关联,就生成一个新血亲坐标,旧结束 -> 新结束
95-
String s = consanguinityCoordinate.getEndPointCoordinateName() + " -> " + endPointCoordinateName;
96-
logger.info("Generate Coordinate Path : " + s);
97-
stringDoubleConsanguinityCoordinateHashMap.put(s, DoubleConsanguinityRoute.parse(s, consanguinityCoordinate.getEndPointCoordinate(), doubleConsanguinityRoute.getEndPointCoordinate()));
98-
} else {
99-
// 如果是结束点有关联,就生成一个新血亲坐标,旧起始 -> 新起始
100-
String s = consanguinityCoordinate.getStartingCoordinateName() + " -> " + startingCoordinateName;
101-
logger.info("Generate Coordinate Path : " + s);
102-
stringDoubleConsanguinityCoordinateHashMap.put(s, DoubleConsanguinityRoute.parse(s, consanguinityCoordinate.getStartingCoordinate(), doubleConsanguinityRoute.getStartingCoordinate()));
103-
}
104-
}
105-
} else {
106-
for (DoubleConsanguinityRoute consanguinityCoordinate : start) {
107-
String startingCoordinateName1 = consanguinityCoordinate.getStartingCoordinateName();
108-
if (startingCoordinateName1.equals(startingCoordinateName)) {
109-
// 如果是起始点有关联,就生成一个新血亲坐标,旧结束 -> 新结束
110-
String s = consanguinityCoordinate.getEndPointCoordinateName() + " -> " + endPointCoordinateName;
111-
stringDoubleConsanguinityCoordinateHashMap.put(s, DoubleConsanguinityRoute.parse(s, consanguinityCoordinate.getEndPointCoordinate(), doubleConsanguinityRoute.getEndPointCoordinate()));
112-
} else {
113-
// 如果是结束点有关联,就生成一个新血亲坐标,旧起始 -> 新起始
114-
String s = consanguinityCoordinate.getStartingCoordinateName() + " -> " + startingCoordinateName;
115-
stringDoubleConsanguinityCoordinateHashMap.put(s, DoubleConsanguinityRoute.parse(s, consanguinityCoordinate.getStartingCoordinate(), doubleConsanguinityRoute.getStartingCoordinate()));
116-
}
85+
for (DoubleConsanguinityRoute consanguinityCoordinate : start) {
86+
String startingCoordinateName1 = consanguinityCoordinate.getStartingCoordinateName();
87+
if (startingCoordinateName1.equals(startingCoordinateName)) {
88+
// 如果是起始点有关联,就生成一个新血亲坐标,旧结束 -> 新结束
89+
String s = consanguinityCoordinate.getEndPointCoordinateName() + " -> " + endPointCoordinateName;
90+
stringDoubleConsanguinityCoordinateHashMap.put(s, DoubleConsanguinityRoute.parse(s, consanguinityCoordinate.getEndPointCoordinate(), doubleConsanguinityRoute.getEndPointCoordinate()));
91+
} else {
92+
// 如果是结束点有关联,就生成一个新血亲坐标,旧起始 -> 新起始
93+
String s = consanguinityCoordinate.getStartingCoordinateName() + " -> " + startingCoordinateName;
94+
stringDoubleConsanguinityCoordinateHashMap.put(s, DoubleConsanguinityRoute.parse(s, consanguinityCoordinate.getStartingCoordinate(), doubleConsanguinityRoute.getStartingCoordinate()));
11795
}
11896
}
11997
stringDoubleConsanguinityCoordinateHashMap.put(startingCoordinateName + " -> " + endPointCoordinateName, doubleConsanguinityRoute);

0 commit comments

Comments
 (0)