javeme commented on code in PR #1855:
URL:
https://github.com/apache/incubator-hugegraph/pull/1855#discussion_r864425201
##########
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/HugeTraverser.java:
##########
@@ -360,10 +360,9 @@ public static void checkCapacity(long capacity, long
access,
public static void checkSkipDegree(long skipDegree, long degree,
long capacity) {
- E.checkArgument(skipDegree >= 0L &&
- skipDegree <= Query.DEFAULT_CAPACITY ,
- "The skipped degree must be in [0, %s], but got '%s'",
- Query.DEFAULT_CAPACITY, skipDegree);
+ E.checkArgument(skipDegree >= 0L && skipDegree <=
Query.DEFAULT_CAPACITY,
+ "The skipped degree must be in [0, %s], but got '%s'",
Review Comment:
can keep the old alignment style
##########
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/JaccardSimilarTraverser.java:
##########
@@ -41,9 +41,8 @@ public JaccardSimilarTraverser(HugeGraph graph) {
super(graph);
}
-
public double jaccardSimilarity(Id vertex, Id other, Directions dir,
- String label, long degree) {
+ String label, long degree) {
Review Comment:
prefer to keep the old style
##########
hugegraph-core/src/main/java/com/baidu/hugegraph/util/collection/IntMap.java:
##########
@@ -67,7 +72,7 @@ public static final class IntMapBySegments implements IntMap {
private static final int DEFAULT_SEGMENTS = IntSet.CPUS * 100;
private static final Function<Integer, IntMap> DEFAULT_CREATOR =
- size -> new IntMapByFixedAddr(size);
+ size -> new IntMapByFixedAddr(size);
Review Comment:
prefer to keep old style
##########
hugegraph-core/src/main/java/com/baidu/hugegraph/util/Reflection.java:
##########
@@ -55,39 +55,39 @@ public class Reflection {
}
}
- reflectionClazz = reflectionClazzTemp;
+ REFLECTION_CLAZZ = reflectionClazzTemp;
- if (reflectionClazz != null) {
+ if (REFLECTION_CLAZZ != null) {
try {
registerFieldsToFilterMethodTemp =
- reflectionClazz.getMethod("registerFieldsToFilter",
+ REFLECTION_CLAZZ.getMethod("registerFieldsToFilter",
Class.class, String[].class);
} catch (Throwable e) {
LOG.error("Can't find registerFieldsToFilter method", e);
}
try {
registerMethodsToFilterMethodTemp =
- reflectionClazz.getMethod("registerMethodsToFilter",
+ REFLECTION_CLAZZ.getMethod("registerMethodsToFilter",
Review Comment:
also update alignment
##########
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/HugeTraverser.java:
##########
@@ -378,10 +377,9 @@ public static void checkSkipDegree(long skipDegree, long
degree,
}
}
- public static <K, V extends Comparable<? super V>> Map<K, V> topN(
- Map<K, V> map,
- boolean
sorted,
- long limit) {
+ public static <K, V extends Comparable<? super V>> Map<K, V> topN(Map<K,
+ V> map, boolean sorted, long limit) {
Review Comment:
can we don't wrap a line inside a parameter
##########
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/OltpTraverser.java:
##########
@@ -38,9 +38,7 @@
import com.baidu.hugegraph.iterator.FilterIterator;
import com.baidu.hugegraph.util.Consumers;
-
-public abstract class OltpTraverser extends HugeTraverser
- implements AutoCloseable {
+public abstract class OltpTraverser extends HugeTraverser implements
AutoCloseable {
Review Comment:
prefer to keep the old style
##########
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/optimize/TraversalUtil.java:
##########
@@ -902,7 +904,10 @@ private static Number predicateNumber(String value) {
value = JsonUtil.fromJson(value, String.class);
}
return DateUtil.parse(value).getTime();
- } catch (Exception ignored) {}
+ } catch (Exception ignored) {
+ // @todo
Review Comment:
"TODO: improve to throw a exception here"
##########
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/ShortestPathTraverser.java:
##########
@@ -177,8 +177,7 @@ public PathSet forward(boolean all) {
Id target = edge.id().otherVertexId();
PathSet paths = this.record.findPath(target,
- t -> !this.superNode(t, this.direction),
- all, false);
+ t -> !this.superNode(t, this.direction), all, false);
Review Comment:
prefer to keep the old style
##########
hugegraph-core/src/main/java/com/baidu/hugegraph/util/Reflection.java:
##########
@@ -55,39 +55,39 @@ public class Reflection {
}
}
- reflectionClazz = reflectionClazzTemp;
+ REFLECTION_CLAZZ = reflectionClazzTemp;
- if (reflectionClazz != null) {
+ if (REFLECTION_CLAZZ != null) {
try {
registerFieldsToFilterMethodTemp =
- reflectionClazz.getMethod("registerFieldsToFilter",
+ REFLECTION_CLAZZ.getMethod("registerFieldsToFilter",
Class.class, String[].class);
} catch (Throwable e) {
LOG.error("Can't find registerFieldsToFilter method", e);
}
try {
registerMethodsToFilterMethodTemp =
- reflectionClazz.getMethod("registerMethodsToFilter",
+ REFLECTION_CLAZZ.getMethod("registerMethodsToFilter",
Class.class, String[].class);
} catch (NoSuchMethodException e) {
LOG.error("Can't find registerMethodsToFilter method", e);
}
}
- registerFieldsToFilterMethod = registerFieldsToFilterMethodTemp;
- registerMethodsToFilterMethod = registerMethodsToFilterMethodTemp;
+ REGISTER_FILEDS_TO_FILTER_METHOD = registerFieldsToFilterMethodTemp;
+ REGISTER_METHODS_TO_FILTER_MOTHOD = registerMethodsToFilterMethodTemp;
}
public static void registerFieldsToFilter(Class<?> containingClass,
String... fieldNames) {
- if (registerFieldsToFilterMethod == null) {
+ if (REGISTER_FILEDS_TO_FILTER_METHOD == null) {
throw new NotSupportException(
"Reflection.registerFieldsToFilter()");
}
try {
- registerFieldsToFilterMethod.setAccessible(true);
- registerFieldsToFilterMethod.invoke(reflectionClazz,
+ REGISTER_FILEDS_TO_FILTER_METHOD.setAccessible(true);
+ REGISTER_FILEDS_TO_FILTER_METHOD.invoke(REFLECTION_CLAZZ,
Review Comment:
also update alignment
##########
hugegraph-core/src/main/java/com/baidu/hugegraph/util/Reflection.java:
##########
@@ -98,14 +98,14 @@ public static void registerFieldsToFilter(Class<?>
containingClass,
public static void registerMethodsToFilter(Class<?> containingClass,
String... methodNames) {
- if (registerMethodsToFilterMethod == null) {
+ if (REGISTER_METHODS_TO_FILTER_MOTHOD == null) {
throw new NotSupportException(
"Reflection.registerMethodsToFilterMethod()");
}
try {
- registerMethodsToFilterMethod.setAccessible(true);
- registerMethodsToFilterMethod.invoke(reflectionClazz,
+ REGISTER_METHODS_TO_FILTER_MOTHOD.setAccessible(true);
+ REGISTER_METHODS_TO_FILTER_MOTHOD.invoke(REFLECTION_CLAZZ,
Review Comment:
also update alignment
##########
hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/ShortestPathTraverser.java:
##########
@@ -217,8 +216,7 @@ public PathSet backward(boolean all) {
Id target = edge.id().otherVertexId();
PathSet paths = this.record.findPath(target,
- t -> !this.superNode(t, opposite),
- all, false);
+ t -> !this.superNode(t, opposite), all,false);
Review Comment:
prefer to keep the old style
##########
hugegraph-core/src/main/java/com/baidu/hugegraph/util/collection/IntSet.java:
##########
@@ -58,7 +61,7 @@ public static final class IntSetBySegments implements IntSet {
private static final int DEFAULT_SEGMENTS = IntSet.CPUS * 100;
private static final Function<Integer, IntSet> DEFAULT_CREATOR =
- size -> new IntSetByFixedAddr4Unsigned(size);
+ size -> new IntSetByFixedAddr4Unsigned(size);
Review Comment:
ditto
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]