@Override public OResult next() { OResult current = upstream.next(); current.getVertex().ifPresent(x -> x.moveTo(targetClass, targetCluster)); return current; }
private OVertex asVertex(Object currentFrom) { if (currentFrom instanceof ORID) { currentFrom = ((ORID) currentFrom).getRecord(); } if (currentFrom instanceof OResult) { return ((OResult) currentFrom).getVertex().orElse(null); } if (currentFrom instanceof OVertex) { return (OVertex) currentFrom; } if (currentFrom instanceof OElement) { return ((OElement) currentFrom).asVertex().orElse(null); } return null; }
@Override public boolean tryAdvance(Consumer<? super OVertex> action) { while (hasNext()) { OResult elem = next(); if (elem.isVertex()) { action.accept(elem.getVertex().get()); return true; } } return false; }
public Optional<OrientVertex> getVertex() { return inner.getVertex().map((v) -> graph.elementFactory().wrapVertex(v)); }
private OVertex asVertex(Object currentFrom) { if (currentFrom instanceof ORID) { currentFrom = ((ORID) currentFrom).getRecord(); } if (currentFrom instanceof OResult) { Object from = currentFrom; currentFrom = ((OResult) currentFrom).getVertex() .orElseThrow(() -> new OCommandExecutionException("Invalid vertex for edge creation: " + from.toString())); } if (currentFrom instanceof OVertex) { return (OVertex) currentFrom; } if (currentFrom instanceof OElement) { Object from = currentFrom; return ((OElement) currentFrom).asVertex() .orElseThrow(() -> new OCommandExecutionException("Invalid vertex for edge creation: " + from.toString())); } throw new OCommandExecutionException("Invalid vertex for edge creation: " + currentFrom.toString()); }