/** * Constructor. * * @param extendedDataOutput Extended data output * @param configuration Configuration */ public VertexIterator( ExtendedDataOutput extendedDataOutput, ImmutableClassesGiraphConfiguration<I, V, E> configuration) { extendedDataInput = configuration.createExtendedDataInput( extendedDataOutput.getByteArray(), 0, extendedDataOutput.getPos()); this.configuration = configuration; resetEmptyVertex(); }
/** * Moves to the next element in the iteration. */ public void next() { // If the vertex was released, create another one if (vertex == null) { resetEmptyVertex(); } // If the vertex id was released, create another one if (vertex.getId() == null) { vertex.initialize(configuration.createVertexId(), vertex.getValue()); } try { WritableUtils.reinitializeVertexFromDataInput( extendedDataInput, vertex, configuration); } catch (IOException e) { throw new IllegalStateException("next: IOException", e); } }