All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dooapp.gaedo.blueprints.VertexLoaderIterable Maven / Gradle / Ivy

There is a newer version: 1.0.16
Show newest version
package com.dooapp.gaedo.blueprints;

import java.util.Iterator;

import com.tinkerpop.blueprints.Vertex;

public class VertexLoaderIterable implements Iterable {
	private class VertexLoaderIterator implements Iterator {

		private Iterator iterator;

		public VertexLoaderIterator(Iterator iterator) {
			this.iterator = iterator;
		}

		@Override
		public boolean hasNext() {
			return iterator.hasNext();
		}

		@Override
		public DataType next() {
			return service.loadObject(iterator.next(), cache);
		}

		@Override
		public void remove() {
			iterator.remove();
		}

	}

	private AbstractBluePrintsBackedFinderService service;
	private Iterable vertices;
	private ObjectCache cache = new ObjectCache();

	public VertexLoaderIterable(AbstractBluePrintsBackedFinderService abstractBluePrintsBackedFinderService,
					Iterable verticesIterable) {
		this.service = abstractBluePrintsBackedFinderService;
		this.vertices = verticesIterable;
	}

	@Override
	public Iterator iterator() {
		return new VertexLoaderIterator(vertices.iterator());
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy