<commit_before>package com.tinkerpop.pipes.transform;

import com.tinkerpop.blueprints.Edge;
import com.tinkerpop.blueprints.Element;
import com.tinkerpop.blueprints.Predicate;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.pipes.AbstractPipe;
import com.tinkerpop.pipes.util.PipeHelper;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * QueryPipe consolidates the fields and methods required for both VertexQueryPipe and GraphQueryPipe.
 *
 * @author <NAME> (http://markorodriguez.com)
 */
public abstract class QueryPipe<S, E extends Element> extends AbstractPipe<S, E> implements TransformPipe<S, E> {

    protected List<HasContainer> hasContainers = new ArrayList<HasContainer>();
    protected List<IntervalContainer> intervalContainers = new ArrayList<IntervalContainer>();
    protected Class<E> elementClass;
    protected int lowRange = 0;
    protected int highRange = Integer.MAX_VALUE;
    protected int count = 0;

    protected Iterator<E> currentIterator = PipeHelper.emptyIterator();

    public void setResultingElementClass(final Class<? extends Element> elementClass) {
        if (!elementClass.equals(Vertex.class) && !elementClass.equals(Edge.class))
            throw new IllegalArgumentException("The provided element class must be either Vertex or Edge");

        this.elementClass = (Class) elementClass;
    }
<commit_msg>Allow subclasses of Vertex and Edge<commit_after>package com.tinkerpop.pipes.transform;

import com.tinkerpop.blueprints.Edge;
import com.tinkerpop.blueprints.Element;
import com.tinkerpop.blueprints.Predicate;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.pipes.AbstractPipe;
import com.tinkerpop.pipes.util.PipeHelper;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * QueryPipe consolidates the fields and methods required for both VertexQueryPipe and GraphQueryPipe.
 *
 * @author <NAME> (http://markorodriguez.com)
 */
public abstract class QueryPipe<S, E extends Element> extends AbstractPipe<S, E> implements TransformPipe<S, E> {

    protected List<HasContainer> hasContainers = new ArrayList<HasContainer>();
    protected List<IntervalContainer> intervalContainers = new ArrayList<IntervalContainer>();
    protected Class<E> elementClass;
    protected int lowRange = 0;
    protected int highRange = Integer.MAX_VALUE;
    protected int count = 0;

    protected Iterator<E> currentIterator = PipeHelper.emptyIterator();

    public void setResultingElementClass(final Class<? extends Element> elementClass) {
        if (!Vertex.class.isAssignableFrom(elementClass) && !Edge.class.isAssignableFrom(elementClass))
            throw new IllegalArgumentException("The provided element class must be either Vertex or Edge");

        this.elementClass = (Class) elementClass;
    }

{'fraction_non_alphanumeric': 0.09346451159522136, 'fraction_numerical': 0.0014054813773717498, 'mean_word_length': 5.006329113924051, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2273444', 'n_tokens_mistral': 820, 'n_tokens_neox': 789, 'n_words': 209}