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

org.vertexium.accumulo.GetVertexIdsIterable Maven / Gradle / Ivy

There is a newer version: 4.10.0
Show newest version
package org.vertexium.accumulo;

import org.vertexium.accumulo.iterator.model.EdgeInfo;
import org.vertexium.util.LookAheadIterable;

import java.util.Iterator;

class GetVertexIdsIterable extends LookAheadIterable {
    private final Iterable edgeInfos;
    private final String[] labels;

    public GetVertexIdsIterable(Iterable edgeInfos, String[] labels) {
        this.edgeInfos = edgeInfos;
        this.labels = labels;
    }

    @Override
    protected boolean isIncluded(EdgeInfo edgeInfo, String vertexId) {
        if (labels == null || labels.length == 0) {
            return true;
        }
        for (String label : labels) {
            if (edgeInfo.getLabel().equals(label)) {
                return true;
            }
        }
        return false;
    }

    @Override
    protected String convert(EdgeInfo edgeInfo) {
        return edgeInfo.getVertexId();
    }

    @Override
    protected Iterator createIterator() {
        return edgeInfos.iterator();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy