if (value.hasPaths()) {
long edgesTraversed = 0l;
if (this.direction.equals(IN) || this.direction.equals(BOTH)) {
for (final Edge e : value.getEdges(IN, this.labels)) {
final FaunusEdge edge = (FaunusEdge) e;
this.edge.reuse(edge.getIdAsLong(), edge.getVertexId(OUT), edge.getVertexId(IN), edge.getLabel());
if (this.pathEnabled) {
final List<List<FaunusElement.MicroElement>> paths = clonePaths(value, new FaunusEdge.MicroEdge(edge.getIdAsLong()));
edge.addPaths(paths, false);
this.edge.addPaths(paths, false);
} else {
edge.getPaths(value, false);
this.edge.getPaths(value, false);
}
this.longWritable.set(edge.getVertexId(OUT));
context.write(this.longWritable, this.holder.set('p', this.edge));
edgesTraversed++;
}
}
if (this.direction.equals(OUT) || this.direction.equals(BOTH)) {
for (final Edge e : value.getEdges(OUT, this.labels)) {
final FaunusEdge edge = (FaunusEdge) e;
this.edge.reuse(edge.getIdAsLong(), edge.getVertexId(OUT), edge.getVertexId(IN), edge.getLabel());
if (this.pathEnabled) {
final List<List<FaunusElement.MicroElement>> paths = clonePaths(value, new FaunusEdge.MicroEdge(edge.getIdAsLong()));
edge.addPaths(paths, false);
this.edge.addPaths(paths, false);
} else {
edge.getPaths(value, false);
this.edge.getPaths(value, false);
}
this.longWritable.set(edge.getVertexId(IN));
context.write(this.longWritable, this.holder.set('p', this.edge));
edgesTraversed++;
}
}