private ORawPair<Iterable<OVertex>, Iterable<OEdge>> getVerticesAndEdges(OVertex srcVertex, ODirection direction,
String... types) {
if (direction == ODirection.BOTH) {
OMultiCollectionIterator<OVertex> vertexIterator = new OMultiCollectionIterator<>();
OMultiCollectionIterator<OEdge> edgeIterator = new OMultiCollectionIterator<>();
ORawPair<Iterable<OVertex>, Iterable<OEdge>> pair1 = getVerticesAndEdges(srcVertex, ODirection.OUT, types);
ORawPair<Iterable<OVertex>, Iterable<OEdge>> pair2 = getVerticesAndEdges(srcVertex, ODirection.IN, types);
vertexIterator.add(pair1.getFirst());
vertexIterator.add(pair2.getFirst());
edgeIterator.add(pair1.getSecond());
edgeIterator.add(pair2.getSecond());
return new ORawPair<>(vertexIterator, edgeIterator);
} else {
Iterable<OEdge> edges1 = srcVertex.getEdges(direction, types);
Iterable<OEdge> edges2 = srcVertex.getEdges(direction, types);
return new ORawPair<>(new OEdgeToVertexIterable(edges1, direction), edges2);
}
}