class EdgesQueryIterator implements Iterator<Query> {

    private final List<Id> labels;
    private final Directions directions;
    private final long limit;
    private final Iterator<Id> sources;

    public EdgesQueryIterator(Iterator<Id> sources,
                              Directions directions,
                              List<Id> labels,
                              long limit) {
        this.sources = sources;
        this.labels = labels;
        this.directions = directions;
        // Traverse NO_LIMIT 和 Query.NO_LIMIT 不同
        this.limit = limit < 0 ? Query.NO_LIMIT : limit;
    }

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

    @Override
    public Query next() {<FILL_FUNCTION_BODY>}
}

        Id sourceId = this.sources.next();
        ConditionQuery query = GraphTransaction.constructEdgesQuery(sourceId,
                                                                    this.directions,
                                                                    this.labels);
        if (this.limit != Query.NO_LIMIT) {
            query.limit(this.limit);
            query.capacity(this.limit);
        } else {
            query.capacity(Query.NO_CAPACITY);
        }
        return query;
    
<no_super_class>