Skip to content

Commit

Permalink
improve
Browse files Browse the repository at this point in the history
Change-Id: Ie99226fbb53fb3827887b76cdc4949cf018c7440
  • Loading branch information
zhoney committed Jun 5, 2019
1 parent b1a8c39 commit 112e831
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ public String get(@Context GraphManager manager,
LOG.debug("Graph [{}] get rays paths from '{}' with " +
"direction '{}', edge label '{}', max depth '{}', " +
"max degree '{}', capacity '{}' and limit '{}'",
graph, sourceV, direction, edgeLabel, depth, degree, limit);
graph, sourceV, direction, edgeLabel, depth, degree,
capacity, limit);

Id source = VertexAPI.checkAndParseVertexId(sourceV);
Directions dir = Directions.convert(EdgeAPI.parseDirection(direction));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ public String get(@Context GraphManager manager,
"direction '{}', edge label '{}', max depth '{}', " +
"source in ring '{}', max degree '{}', capacity '{}' " +
"and limit '{}'",
graph, sourceV, direction, edgeLabel, depth, degree, limit);
graph, sourceV, direction, edgeLabel, depth, sourceInRing,
degree, capacity, limit);

Id source = VertexAPI.checkAndParseVertexId(sourceV);
Directions dir = Directions.convert(EdgeAPI.parseDirection(direction));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public final class ApiVersion {
*
* version 0.10:
* [0.39] Issue-522: Add profile RESTful API
* [0.40] Issue-523: Add sourceInRing args for rings RESTful API
* [0.40] Issue-523: Add source_in_ring args for rings RESTful API
*/

// The second parameter of Version.of() is for IDE running without JAR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ public boolean equals(Object object) {
return false;
}
Node other = (Node) object;
return this.id.equals(other.id) &&
return Objects.equals(this.id, other.id) &&
Objects.equals(this.parent, other.parent);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private List<Path> subGraphPaths(Id sourceV, Directions dir, String label,
return paths;
}

private static boolean multiEdges(List<Edge> edges, Id target) {
private static boolean containsMultiEdges(List<Edge> edges, Id target) {
int count = 0;
for (Edge edge : edges) {
if (((HugeEdge) edge).id().otherVertexId().equals(target)) {
Expand Down Expand Up @@ -175,11 +175,13 @@ public List<Path> forward(Directions direction) {
continue;
}

// Rays found if fake ring like:
// Rays found if it's fake ring like:
// path is pattern: A->B<-A && A is only neighbor of B
if (!this.rings && target.equals(node.parent().id()) &&
neighborCount == 1 && !edges.hasNext() &&
direction == Directions.BOTH) {
boolean uniqueEdge = neighborCount == 1 &&
!edges.hasNext();
boolean bothBack = target.equals(node.parent().id()) &&
direction == Directions.BOTH;
if (!this.rings && bothBack && uniqueEdge) {
paths.add(new Path(null, node.path()));
this.pathCount++;
if (reachLimit()) {
Expand All @@ -197,7 +199,8 @@ public List<Path> forward(Directions direction) {
ringsFound = true;
} else if (direction != Directions.BOTH) {
ringsFound = true;
} else if (multiEdges(edgeList, target)) {
} else if (containsMultiEdges(edgeList,
target)) {
ringsFound = true;
}
}
Expand Down

0 comments on commit 112e831

Please sign in to comment.