public abstract class EObjectQueryStepBuilderImpl<S,I> extends java.lang.Object implements EObjectQueryStepBuilder<S>, QueryStepBuilderInternal<S,org.eclipse.emf.ecore.EObject>, TraversalTransformer<S,I,org.apache.tinkerpop.gremlin.structure.Vertex>
| Constructor and Description |
|---|
EObjectQueryStepBuilderImpl(TraversalChainElement previous) |
| Modifier and Type | Method and Description |
|---|---|
EObjectQueryStepBuilder<S> |
allReferencingEObjects()
Navigates from an
EObject to all other EObjects that reference it. |
EObjectQueryStepBuilder<S> |
and(QueryStepBuilder<org.eclipse.emf.ecore.EObject,?>... subqueries) |
UntypedQueryStepBuilder<S,java.lang.Object> |
back(java.lang.String stepName)
Exits the current traversal state and goes back to a named step, or a named set.
|
EObjectQueryStepBuilder<S> |
closure(org.eclipse.emf.ecore.EReference eReference,
Direction direction)
Calculates the transitive closure of the current
EObject that is created by repeatedly following the given (outgoing) EReference. |
long |
count()
Counts the number of elements in the current result, and returns that count.
|
EObjectQueryStepBuilder<S> |
distinct()
Eliminates all duplicated values from the current result.
|
EObjectQueryStepBuilder<S> |
eAllContents()
Navigates from an
EObject to its eAllContents. |
EObjectQueryStepBuilder<S> |
eContainer()
Navigates from an
EObject to its eContainer. |
EObjectQueryStepBuilder<S> |
eContents()
Navigates from an
EObject to its eContents. |
UntypedQueryStepBuilder<S,java.lang.Object> |
eGet(org.eclipse.emf.ecore.EAttribute eAttribute)
Performs a
EObject.eGet(EStructuralFeature) operation on all EObjects in the current result and
forwards the result of this method. |
EObjectQueryStepBuilder<S> |
eGet(org.eclipse.emf.ecore.EReference eReference)
Performs a
EObject.eGet(EStructuralFeature) operation on all EObjects in the current result and
forwards the result of this method. |
UntypedQueryStepBuilder<S,java.lang.Object> |
eGet(java.lang.String eStructuralFeatureName)
Performs a
EObject.eGet(EStructuralFeature) operation on all EObjects in the current result and
forwards the result of this method. |
EObjectQueryStepBuilder<S> |
eGetInverse(org.eclipse.emf.ecore.EReference eReference)
Navigates along the incoming
EReferences of the given type and forwards the EObjects on
the other end of the reference. |
EObjectQueryStepBuilder<S> |
eGetInverse(java.lang.String referenceName)
Navigates along the incoming
EReferences with the given name and forwards the EObjects on
the other end of the reference. |
EObjectQueryStepBuilder<S> |
except(java.util.Set<?> elementsToExclude)
Removes all elements in the given set from the stream.
|
EObjectQueryStepBuilder<S> |
except(java.lang.String stepName)
Removes all elements from the given named step from this step.
|
EObjectQueryStepBuilder<S> |
filter(java.util.function.Predicate<org.eclipse.emf.ecore.EObject> predicate)
Applies the given filter predicate to all elements in the current result.
|
<T> UntypedQueryStepBuilder<S,T> |
flatMap(java.util.function.Function<org.eclipse.emf.ecore.EObject,java.util.Iterator<T>> function)
Uses the given function to map each element to an iterator of output elements.
|
TraversalChainElement |
getPrevious() |
EObjectQueryStepBuilder<S> |
has(org.eclipse.emf.ecore.EStructuralFeature eStructuralFeature,
java.lang.Object value)
Filters all EObjects in the result set that have the given feature set to the given value.
|
EObjectQueryStepBuilder<S> |
has(java.lang.String eStructuralFeatureName,
java.lang.Object value)
Filters all EObjects in the result set that have the given feature set to the given value.
|
EObjectQueryStepBuilder<S> |
isInstanceOf(org.eclipse.emf.ecore.EClass eClass)
Filters all
EObjects that are an instance of the given EClass. |
EObjectQueryStepBuilder<S> |
isInstanceOf(org.eclipse.emf.ecore.EClass eClass,
boolean allowSubclasses)
Filters all
EObjects that are an instance of the given EClass. |
EObjectQueryStepBuilder<S> |
isInstanceOf(java.lang.String eClassName)
Filters all
EObjects that are a (direct or indirect) instance of an EClass with the given name. |
EObjectQueryStepBuilder<S> |
isInstanceOf(java.lang.String eClassName,
boolean allowSubclasses)
Filters all
EObjects that are a (direct or indirect) instance of an EClass with the given name. |
EObjectQueryStepBuilder<S> |
limit(long limit)
Limits the number of elements in the result set to the given number.
|
<T> UntypedQueryStepBuilder<S,T> |
map(java.util.function.Function<org.eclipse.emf.ecore.EObject,T> function)
Uses the given function to map each element from the current result set to a new element.
|
EObjectQueryStepBuilder<S> |
named(java.lang.String name)
Assigns the given name to this
QueryStepBuilder. |
EObjectQueryStepBuilder<S> |
not(QueryStepBuilder<org.eclipse.emf.ecore.EObject,?> subquery) |
EObjectQueryStepBuilder<S> |
notNull()
Filters out and discards all
null values from the current result set. |
EObjectQueryStepBuilder<S> |
or(QueryStepBuilder<org.eclipse.emf.ecore.EObject,?>... subqueries) |
EObjectQueryStepBuilder<S> |
orderBy(java.util.Comparator<org.eclipse.emf.ecore.EObject> comparator)
Sorts the current result set by applying the given comparator.
|
EObjectQueryStepBuilder<S> |
orderBy(org.eclipse.emf.ecore.EAttribute eAttribute,
Order order) |
protected QueryStepBuilderInternal<S,org.eclipse.emf.ecore.EObject> |
reifyEObjects() |
void |
setPrevious(TraversalChainElement previous) |
java.util.Iterator<org.eclipse.emf.ecore.EObject> |
toIterator()
Creates an iterator over the elements in this query and returns it.
|
java.util.List<org.eclipse.emf.ecore.EObject> |
toList()
Calculates the result of this query and returns it as a
List. |
java.util.Set<org.eclipse.emf.ecore.EObject> |
toSet()
Calculates the result set of this query and returns it.
|
java.util.stream.Stream<org.eclipse.emf.ecore.EObject> |
toStream()
Converts this query into a
Stream. |
UntypedQueryStepBuilder<S,java.lang.Object> |
union(QueryStepBuilder<org.eclipse.emf.ecore.EObject,?>... subqueries) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclosureidentity, transformTraversalpublic EObjectQueryStepBuilderImpl(TraversalChainElement previous)
public EObjectQueryStepBuilder<S> orderBy(java.util.Comparator<org.eclipse.emf.ecore.EObject> comparator)
QueryStepBuilder
This method requires full resolution of all elements and is therefore non-lazy.
orderBy in interface EObjectQueryStepBuilder<S>orderBy in interface QueryStepBuilder<S,org.eclipse.emf.ecore.EObject>comparator - The comparator to use. Must not be null.null.public EObjectQueryStepBuilder<S> orderBy(org.eclipse.emf.ecore.EAttribute eAttribute, Order order)
orderBy in interface EObjectQueryStepBuilder<S>public EObjectQueryStepBuilder<S> distinct()
QueryStepBuilder
This method is lazy, but requires to keep track of the "already encountered" elements in a set. Therefore, RAM consumption on this method may be high if it is applied on very large result sets.
distinct in interface EObjectQueryStepBuilder<S>distinct in interface QueryStepBuilder<S,org.eclipse.emf.ecore.EObject>null.public <T> UntypedQueryStepBuilder<S,T> map(java.util.function.Function<org.eclipse.emf.ecore.EObject,T> function)
QueryStepBuildermap in interface QueryStepBuilder<S,org.eclipse.emf.ecore.EObject>function - The mapping function to apply. Must not be null. Should be idempotent and side-effect
free.null.public <T> UntypedQueryStepBuilder<S,T> flatMap(java.util.function.Function<org.eclipse.emf.ecore.EObject,java.util.Iterator<T>> function)
QueryStepBuilderflatMap in interface QueryStepBuilder<S,org.eclipse.emf.ecore.EObject>function - The map function to apply. Must not be null. Should be idempotent and side-effect free.null.public java.util.Set<org.eclipse.emf.ecore.EObject> toSet()
QueryStepBuilder
Please note that iterating over the result set via QueryStepBuilder.toIterator() is in general faster
and consumes less RAM than first converting the result into a set.
toSet in interface QueryStepBuilder<S,org.eclipse.emf.ecore.EObject>null. May be empty.public java.util.List<org.eclipse.emf.ecore.EObject> toList()
QueryStepBuilderList.
Please note that iterating over the result via QueryStepBuilder.toIterator() is in general faster and
consumes less RAM than first converting the result into a list.
toList in interface QueryStepBuilder<S,org.eclipse.emf.ecore.EObject>null. May be empty.public java.util.Iterator<org.eclipse.emf.ecore.EObject> toIterator()
QueryStepBuildertoIterator in interface QueryStepBuilder<S,org.eclipse.emf.ecore.EObject>null.public java.util.stream.Stream<org.eclipse.emf.ecore.EObject> toStream()
QueryStepBuilderStream.toStream in interface QueryStepBuilder<S,org.eclipse.emf.ecore.EObject>public long count()
QueryStepBuildercount in interface QueryStepBuilder<S,org.eclipse.emf.ecore.EObject>public EObjectQueryStepBuilder<S> limit(long limit)
QueryStepBuilder
Please note that the order of elements is in general arbitrary. Therefore, usually a QueryStepBuilder.limit(long) is
preceded by a QueryStepBuilder.orderBy(Comparator).
limit in interface EObjectQueryStepBuilder<S>limit in interface QueryStepBuilder<S,org.eclipse.emf.ecore.EObject>limit - The limit to apply. Must not be negative.null.public EObjectQueryStepBuilder<S> notNull()
QueryStepBuildernull values from the current result set.
This is the same as:
query.filter(element -> element != null)
notNull in interface EObjectQueryStepBuilder<S>notNull in interface QueryStepBuilder<S,org.eclipse.emf.ecore.EObject>null.QueryStepBuilder.filter(Predicate)public EObjectQueryStepBuilder<S> has(java.lang.String eStructuralFeatureName, java.lang.Object value)
EObjectQueryStepBuilder
Any EObject that is an instance of an EClass which does not define any EAttribute or
EReference with the given name will be discarded and filtered out.
For determining the feature, EClass.getEStructuralFeature(String) is used per EObject
individually.
The value will be compared via Objects.equals(Object, Object).
has in interface EObjectQueryStepBuilder<S>eStructuralFeatureName - The name of the EStructuralFeature to filter by. Must not be null.value - The value to filter by. May be null.null.public EObjectQueryStepBuilder<S> has(org.eclipse.emf.ecore.EStructuralFeature eStructuralFeature, java.lang.Object value)
EObjectQueryStepBuilder
Any EObject that belongs to an EClass that does not support the given feature will be discarded
and filtered out.
The value will be compared via Objects.equals(Object, Object).
has in interface EObjectQueryStepBuilder<S>eStructuralFeature - The feature to filter by. Must not be null.value - The value to filter by. Must not be null.null.public EObjectQueryStepBuilder<S> isInstanceOf(org.eclipse.emf.ecore.EClass eClass)
EObjectQueryStepBuilderEObjects that are an instance of the given EClass.
This method also considers polymorphism, i.e. instances of Sub-EClasses will pass this filter as well.
This operation is null-safe. Any null values will be discarded and filtered out.
isInstanceOf in interface EObjectQueryStepBuilder<S>eClass - The EClass to filter by. Must not be null.null.public EObjectQueryStepBuilder<S> isInstanceOf(org.eclipse.emf.ecore.EClass eClass, boolean allowSubclasses)
EObjectQueryStepBuilderEObjects that are an instance of the given EClass.
This operation is null-safe. Any null values will be discarded and filtered out.
isInstanceOf in interface EObjectQueryStepBuilder<S>eClass - The EClass to filter by. Must not be null.allowSubclasses - Whether or not subclasses are allowed. If false, any EObject that passes the filter must
be a direct instance of the given EClass. If true, EObjects that pass the filter can be a
direct or transitive instance of the given EClass.null.public EObjectQueryStepBuilder<S> isInstanceOf(java.lang.String eClassName)
EObjectQueryStepBuilderEObjects that are a (direct or indirect) instance of an EClass with the given name.
This operation is null-safe. Any null values will be discarded and filtered out.
isInstanceOf in interface EObjectQueryStepBuilder<S>eClassName - The name of the EClass to search for. Must not be null.null.public EObjectQueryStepBuilder<S> isInstanceOf(java.lang.String eClassName, boolean allowSubclasses)
EObjectQueryStepBuilderEObjects that are a (direct or indirect) instance of an EClass with the given name.
This operation is null-safe. Any null values will be discarded and filtered out.
isInstanceOf in interface EObjectQueryStepBuilder<S>eClassName - The name of the EClass to search for. Must not be null.allowSubclasses - Whether or not subclasses are allowed. If false, any EObject that passes the filter must
be a direct instance of the given EClass. If true, EObjects that pass the filter can be a
direct or transitive instance of the given EClass.null.public UntypedQueryStepBuilder<S,java.lang.Object> eGet(java.lang.String eStructuralFeatureName)
EObjectQueryStepBuilderEObject.eGet(EStructuralFeature) operation on all EObjects in the current result and
forwards the result of this method.
If a given EObject does not have the EStructuralFeature set (i.e.
EObject.eIsSet(EStructuralFeature) returns false), then no value will be passed onwards. In
any other case, the returned value is passed onwards, even if that value is null.
eGet in interface EObjectQueryStepBuilder<S>eStructuralFeatureName - The name of the EStructuralFeature to get the value(s) for. Must not be null.null.public EObjectQueryStepBuilder<S> eGet(org.eclipse.emf.ecore.EReference eReference)
EObjectQueryStepBuilderEObject.eGet(EStructuralFeature) operation on all EObjects in the current result and
forwards the result of this method.
If a given EObject does not have the EStructuralFeature set (i.e.
EObject.eIsSet(EStructuralFeature) returns false), then no value will be passed onwards. In
any other case, the returned value is passed onwards, even if that value is null.
eGet in interface EObjectQueryStepBuilder<S>eReference - The EReference to get the value(s) for. Must not be null.null.public EObjectQueryStepBuilder<S> eGetInverse(org.eclipse.emf.ecore.EReference eReference)
EObjectQueryStepBuilderEReferences of the given type and forwards the EObjects on
the other end of the reference.eGetInverse in interface EObjectQueryStepBuilder<S>eReference - The EReference to follow backwards. Must not be null.null.public EObjectQueryStepBuilder<S> eGetInverse(java.lang.String referenceName)
EObjectQueryStepBuilderEReferences with the given name and forwards the EObjects on
the other end of the reference.eGetInverse in interface EObjectQueryStepBuilder<S>referenceName - The name of the reference to follow backwards. Must not be null.null.public UntypedQueryStepBuilder<S,java.lang.Object> eGet(org.eclipse.emf.ecore.EAttribute eAttribute)
EObjectQueryStepBuilderEObject.eGet(EStructuralFeature) operation on all EObjects in the current result and
forwards the result of this method.
If a given EObject does not have the EStructuralFeature set (i.e.
EObject.eIsSet(EStructuralFeature) returns false), then no value will be passed onwards. In
any other case, the returned value is passed onwards, even if that value is null.
eGet in interface EObjectQueryStepBuilder<S>eAttribute - The EAttribute to get the value(s) for. Must not be null.null.public EObjectQueryStepBuilder<S> eContainer()
EObjectQueryStepBuilderEObject to its eContainer.eContainer in interface EObjectQueryStepBuilder<S>null.public EObjectQueryStepBuilder<S> eContents()
EObjectQueryStepBuilderEObject to its eContents.eContents in interface EObjectQueryStepBuilder<S>null.public EObjectQueryStepBuilder<S> eAllContents()
EObjectQueryStepBuilderEObject to its eAllContents.eAllContents in interface EObjectQueryStepBuilder<S>null.public EObjectQueryStepBuilder<S> allReferencingEObjects()
EObjectQueryStepBuilderEObject to all other EObjects that reference it.
This means walking backwards all EReference instances that have the current EObject as target. This
method will include the eContainer.
allReferencingEObjects in interface EObjectQueryStepBuilder<S>null.public EObjectQueryStepBuilder<S> named(java.lang.String name)
QueryStepBuilderQueryStepBuilder.
Note that only the step is named. When coming back to this step, the query result may be different than it was when it was first reached, depending on the traversal.
named in interface EObjectQueryStepBuilder<S>named in interface QueryStepBuilder<S,org.eclipse.emf.ecore.EObject>name - The name of the step. Must not be null. Must be unique within the query.null.QueryStepBuilder.back(String)public UntypedQueryStepBuilder<S,java.lang.Object> back(java.lang.String stepName)
QueryStepBuilderback in interface QueryStepBuilder<S,org.eclipse.emf.ecore.EObject>stepName - The name of the step to go back to. Must not be null, must refer to a named step.null.QueryStepBuilder.named(String)public EObjectQueryStepBuilder<S> except(java.lang.String stepName)
QueryStepBuilderexcept in interface QueryStepBuilder<S,org.eclipse.emf.ecore.EObject>stepName - The name of the step. Must not be null, must refer to a named step.null.public EObjectQueryStepBuilder<S> except(java.util.Set<?> elementsToExclude)
QueryStepBuilderexcept in interface QueryStepBuilder<S,org.eclipse.emf.ecore.EObject>elementsToExclude - The elements to remove. Must not be null.null.public UntypedQueryStepBuilder<S,java.lang.Object> union(QueryStepBuilder<org.eclipse.emf.ecore.EObject,?>... subqueries)
union in interface QueryStepBuilder<S,org.eclipse.emf.ecore.EObject>public EObjectQueryStepBuilder<S> and(QueryStepBuilder<org.eclipse.emf.ecore.EObject,?>... subqueries)
and in interface QueryStepBuilder<S,org.eclipse.emf.ecore.EObject>public EObjectQueryStepBuilder<S> or(QueryStepBuilder<org.eclipse.emf.ecore.EObject,?>... subqueries)
or in interface QueryStepBuilder<S,org.eclipse.emf.ecore.EObject>public EObjectQueryStepBuilder<S> not(QueryStepBuilder<org.eclipse.emf.ecore.EObject,?> subquery)
not in interface QueryStepBuilder<S,org.eclipse.emf.ecore.EObject>public EObjectQueryStepBuilder<S> filter(java.util.function.Predicate<org.eclipse.emf.ecore.EObject> predicate)
QueryStepBuilderfilter in interface EObjectQueryStepBuilder<S>filter in interface QueryStepBuilder<S,org.eclipse.emf.ecore.EObject>predicate - The predicate to apply. Must not be null. All elements for which the predicate function
returns false will be filtered out and discarded.null.public EObjectQueryStepBuilder<S> closure(org.eclipse.emf.ecore.EReference eReference, Direction direction)
EObjectQueryStepBuilderEObject that is created by repeatedly following the given (outgoing) EReference.
This method is safe to use in models that contain cyclic paths. Every EObject in the closure will only be returned once, even if multiple paths lead to it.
The EObject which is used to start the closure will not be part of the closure.
If an EObject is either of an EClass that does not own the given EReference, or the EObject itself does not have an instance of the EReference, the closure ends at this EObject.
closure in interface EObjectQueryStepBuilder<S>eReference - The EReference to follow repeatedly. Must not be null.direction - The direction to follow when calculating the closure. Must not be null.null.public TraversalChainElement getPrevious()
getPrevious in interface QueryStepBuilderInternal<S,org.eclipse.emf.ecore.EObject>public void setPrevious(TraversalChainElement previous)
setPrevious in interface QueryStepBuilderInternal<S,org.eclipse.emf.ecore.EObject>protected QueryStepBuilderInternal<S,org.eclipse.emf.ecore.EObject> reifyEObjects()