Changeset View
Changeset View
Standalone View
Standalone View
java/src/main/java/org/softwareheritage/graph/Entry.java
Show First 20 Lines • Show All 134 Lines • ▼ Show 20 Lines | public class QueryHandler { | ||||
public void visit_edges(String direction, String edgesFmt, long srcNodeId) { | public void visit_edges(String direction, String edgesFmt, long srcNodeId) { | ||||
open(); | open(); | ||||
Traversal t = new Traversal(this.graph, direction, edgesFmt); | Traversal t = new Traversal(this.graph, direction, edgesFmt); | ||||
t.visitNodesVisitor(srcNodeId, null, this::writeEdge); | t.visitNodesVisitor(srcNodeId, null, this::writeEdge); | ||||
close(); | close(); | ||||
} | } | ||||
public void visit_paths(String direction, String edgesFmt, | public void visit_paths(String direction, String edgesFmt, long srcNodeId) { | ||||
long srcNodeId) { | |||||
open(); | open(); | ||||
Traversal t = new Traversal(this.graph, direction, edgesFmt); | Traversal t = new Traversal(this.graph, direction, edgesFmt); | ||||
t.visitPathsVisitor(srcNodeId, this::writePath); | t.visitPathsVisitor(srcNodeId, this::writePath); | ||||
close(); | close(); | ||||
} | } | ||||
public void walk(String direction, String edgesFmt, String algorithm, | public void walk(String direction, String edgesFmt, String algorithm, long srcNodeId, long dstNodeId) { | ||||
long srcNodeId, long dstNodeId) { | |||||
open(); | open(); | ||||
Traversal t = new Traversal(this.graph, direction, edgesFmt); | Traversal t = new Traversal(this.graph, direction, edgesFmt); | ||||
for (Long nodeId : t.walk(srcNodeId, dstNodeId, algorithm)) { | for (Long nodeId : t.walk(srcNodeId, dstNodeId, algorithm)) { | ||||
writeNode(nodeId); | writeNode(nodeId); | ||||
} | } | ||||
close(); | close(); | ||||
} | } | ||||
public void walk_type(String direction, String edgesFmt, String algorithm, | public void walk_type(String direction, String edgesFmt, String algorithm, long srcNodeId, String dst) { | ||||
long srcNodeId, String dst) { | |||||
open(); | open(); | ||||
Node.Type dstType = Node.Type.fromStr(dst); | Node.Type dstType = Node.Type.fromStr(dst); | ||||
Traversal t = new Traversal(this.graph, direction, edgesFmt); | Traversal t = new Traversal(this.graph, direction, edgesFmt); | ||||
for (Long nodeId : t.walk(srcNodeId, dstType, algorithm)) { | for (Long nodeId : t.walk(srcNodeId, dstType, algorithm)) { | ||||
writeNode(nodeId); | writeNode(nodeId); | ||||
} | } | ||||
close(); | close(); | ||||
} | } | ||||
public void random_walk(String direction, String edgesFmt, int retries, | public void random_walk(String direction, String edgesFmt, int retries, long srcNodeId, long dstNodeId) { | ||||
long srcNodeId, long dstNodeId) { | |||||
open(); | open(); | ||||
Traversal t = new Traversal(this.graph, direction, edgesFmt); | Traversal t = new Traversal(this.graph, direction, edgesFmt); | ||||
for (Long nodeId : t.randomWalk(srcNodeId, dstNodeId, retries)) { | for (Long nodeId : t.randomWalk(srcNodeId, dstNodeId, retries)) { | ||||
writeNode(nodeId); | writeNode(nodeId); | ||||
} | } | ||||
close(); | close(); | ||||
} | } | ||||
public void random_walk_type(String direction, String edgesFmt, int retries, | public void random_walk_type(String direction, String edgesFmt, int retries, long srcNodeId, String dst) { | ||||
long srcNodeId, String dst) { | |||||
open(); | open(); | ||||
Node.Type dstType = Node.Type.fromStr(dst); | Node.Type dstType = Node.Type.fromStr(dst); | ||||
Traversal t = new Traversal(this.graph, direction, edgesFmt); | Traversal t = new Traversal(this.graph, direction, edgesFmt); | ||||
for (Long nodeId : t.randomWalk(srcNodeId, dstType, retries)) { | for (Long nodeId : t.randomWalk(srcNodeId, dstType, retries)) { | ||||
writeNode(nodeId); | writeNode(nodeId); | ||||
} | } | ||||
close(); | close(); | ||||
} | } | ||||
} | } | ||||
} | } |