Class BaseQuerySpecification<Matcher extends ViatraQueryMatcher<? extends IPatternMatch>>
- java.lang.Object
-
- org.eclipse.viatra.query.runtime.api.impl.BaseQuerySpecification<Matcher>
-
- All Implemented Interfaces:
IQuerySpecification<Matcher>,PQueryHeader
- Direct Known Subclasses:
BaseGeneratedEMFQuerySpecification,GenericQuerySpecification
public abstract class BaseQuerySpecification<Matcher extends ViatraQueryMatcher<? extends IPatternMatch>> extends java.lang.Object implements IQuerySpecification<Matcher>
Base implementation of IQuerySpecification.
-
-
Field Summary
Fields Modifier and Type Field Description protected PQuerywrappedPQuery
-
Constructor Summary
Constructors Constructor Description BaseQuerySpecification(PQuery wrappedPQuery)Instantiates query specification for the given internal query representation.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidensureInitializedInternal()java.util.List<PAnnotation>getAllAnnotations()Returns the list of annotations specified for this queryjava.util.List<PAnnotation>getAnnotationsByName(java.lang.String annotationName)Returns the list of annotations with a specified namejava.util.Optional<PAnnotation>getFirstAnnotationByName(java.lang.String annotationName)Returns the first annotation with a specified namejava.lang.StringgetFullyQualifiedName()Identifies the pattern for which matchers can be instantiated.PQuerygetInternalQueryRepresentation()Returns the definition of the query in a format intended for consumption by the query evaluator.MatchergetMatcher(ViatraQueryEngine engine)Initializes the pattern matcher within an existingViatraQueryEngine.java.util.List<java.lang.String>getParameterNames()Return the list of parameter namesjava.util.List<PParameter>getParameters()Returns a list of parameter descriptionsjava.lang.IntegergetPositionOfParameter(java.lang.String parameterName)Returns the index of a named parameterPVisibilitygetVisibility()Returns the visibility information about the query.Matcherinstantiate()For backward compatibility of code generated with previous versions of viatra query, this method has a default implementation returning null, indicating that a matcher can only be created using the old method, which ignores the hints provided by the user.protected abstract Matcherinstantiate(ViatraQueryEngine engine)protected static ViatraQueryExceptionprocessInitializerError(java.lang.ExceptionInInitializerError err)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.viatra.query.runtime.api.IQuerySpecification
getPProblems, getPreferredScopeClass, getStatus, newEmptyMatch, newMatch
-
Methods inherited from interface org.eclipse.viatra.query.runtime.matchers.psystem.queries.PQueryHeader
getParameter, getSimpleName
-
-
-
-
Field Detail
-
wrappedPQuery
protected final PQuery wrappedPQuery
-
-
Constructor Detail
-
BaseQuerySpecification
public BaseQuerySpecification(PQuery wrappedPQuery)
Instantiates query specification for the given internal query representation.
-
-
Method Detail
-
processInitializerError
protected static ViatraQueryException processInitializerError(java.lang.ExceptionInInitializerError err)
- Since:
- 1.6
-
instantiate
protected abstract Matcher instantiate(ViatraQueryEngine engine)
-
instantiate
public Matcher instantiate()
For backward compatibility of code generated with previous versions of viatra query, this method has a default implementation returning null, indicating that a matcher can only be created using the old method, which ignores the hints provided by the user.- Specified by:
instantiatein interfaceIQuerySpecification<Matcher extends ViatraQueryMatcher<? extends IPatternMatch>>- Since:
- 1.4
-
getInternalQueryRepresentation
public PQuery getInternalQueryRepresentation()
Description copied from interface:IQuerySpecificationReturns the definition of the query in a format intended for consumption by the query evaluator.- Specified by:
getInternalQueryRepresentationin interfaceIQuerySpecification<Matcher extends ViatraQueryMatcher<? extends IPatternMatch>>- Returns:
- the internal representation of the query.
-
getMatcher
public Matcher getMatcher(ViatraQueryEngine engine)
Description copied from interface:IQuerySpecificationInitializes the pattern matcher within an existingViatraQueryEngine. If the pattern matcher is already constructed in the engine, only a lightweight reference is created.The match set will be incrementally refreshed upon updates.
- Specified by:
getMatcherin interfaceIQuerySpecification<Matcher extends ViatraQueryMatcher<? extends IPatternMatch>>- Parameters:
engine- the existing VIATRA Query engine in which this matcher will be created.
-
ensureInitializedInternal
protected void ensureInitializedInternal()
-
getAllAnnotations
public java.util.List<PAnnotation> getAllAnnotations()
Description copied from interface:PQueryHeaderReturns the list of annotations specified for this query- Specified by:
getAllAnnotationsin interfacePQueryHeader- Returns:
- a non-null, but possibly empty list of annotations
-
getAnnotationsByName
public java.util.List<PAnnotation> getAnnotationsByName(java.lang.String annotationName)
Description copied from interface:PQueryHeaderReturns the list of annotations with a specified name- Specified by:
getAnnotationsByNamein interfacePQueryHeader- Returns:
- a non-null, but possibly empty list of annotations
-
getFirstAnnotationByName
public java.util.Optional<PAnnotation> getFirstAnnotationByName(java.lang.String annotationName)
Description copied from interface:PQueryHeaderReturns the first annotation with a specified name- Specified by:
getFirstAnnotationByNamein interfacePQueryHeader
-
getFullyQualifiedName
public java.lang.String getFullyQualifiedName()
Description copied from interface:PQueryHeaderIdentifies the pattern for which matchers can be instantiated.- Specified by:
getFullyQualifiedNamein interfacePQueryHeader
-
getParameterNames
public java.util.List<java.lang.String> getParameterNames()
Description copied from interface:PQueryHeaderReturn the list of parameter names- Specified by:
getParameterNamesin interfacePQueryHeader- Returns:
- a non-null, but possibly empty list of parameter names
-
getParameters
public java.util.List<PParameter> getParameters()
Description copied from interface:PQueryHeaderReturns a list of parameter descriptions- Specified by:
getParametersin interfacePQueryHeader- Returns:
- a non-null, but possibly empty list of parameter descriptions
-
getPositionOfParameter
public java.lang.Integer getPositionOfParameter(java.lang.String parameterName)
Description copied from interface:PQueryHeaderReturns the index of a named parameter- Specified by:
getPositionOfParameterin interfacePQueryHeader- Returns:
- the index, or null of no such parameter is available
-
getVisibility
public PVisibility getVisibility()
Description copied from interface:PQueryHeaderReturns the visibility information about the query.- Specified by:
getVisibilityin interfacePQueryHeader- Since:
- 2.0
-
-