Class GenericEMFPatternPQuery
- java.lang.Object
-
- org.eclipse.viatra.query.runtime.matchers.psystem.queries.BasePQuery
-
- org.eclipse.viatra.query.patternlanguage.emf.specification.GenericEMFPatternPQuery
-
- All Implemented Interfaces:
InitializablePQuery,PTraceable,PQuery,PQueryHeader
public class GenericEMFPatternPQuery extends BasePQuery implements InitializablePQuery
This is a generic (i.e. not pattern-specific) class for the internal representation of VIATRA queries, for "interpretative" query execution.End users should use {link GenericQuerySpecification} instead.
- No Instantiate:
- This class is not intended to be instantiated by clients
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.viatra.query.runtime.matchers.psystem.queries.PQuery
PQuery.PQueryStatus
-
-
Field Summary
-
Fields inherited from class org.eclipse.viatra.query.runtime.matchers.psystem.queries.BasePQuery
pProblems, status, visibility
-
-
Constructor Summary
Constructors Constructor Description GenericEMFPatternPQuery(Pattern pattern)Initializes a generic query representation for a given pattern.GenericEMFPatternPQuery(Pattern pattern, boolean delayedInitialization)Initializes a generic query specification for a given pattern.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAnnotation(PAnnotation annotation)Adds an annotation to the specification.voidaddError(PProblem problem)Adds a detected error.protected java.util.Set<PBody>doGetContainedBodies()Creates and returns the bodies of the query.booleanequals(java.lang.Object obj)PDisjunctiongetDisjunctBodies()Returns all bodies associated with the query in their canonical form.java.lang.StringgetFullyQualifiedName()Identifies the pattern for which matchers can be instantiated.java.util.List<PParameter>getParameters()Returns a list of parameter descriptionsPatterngetPattern()inthashCode()voidinitializeBodies(java.util.Set<PBody> bodies)Sets up the bodies of the pattern.voidsetStatus(PQuery.PQueryStatus newStatus)Sets the query status.-
Methods inherited from class org.eclipse.viatra.query.runtime.matchers.psystem.queries.BasePQuery
checkMutability, ensureInitialized, getAllAnnotations, getAllReferredQueries, getAnnotationsByName, getDirectReferredQueries, getEvaluationHints, getFirstAnnotationByName, getParameterNames, getPositionOfParameter, getPProblems, getStatus, getTypeGuarantees, getVisibility, isMutable, publishedAs, setBodies, setEvaluationHints, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.viatra.query.runtime.matchers.psystem.queries.PQuery
checkMutability, ensureInitialized, getAllReferredQueries, getDirectReferredQueries, getEvaluationHints, getPProblems, getStatus, getTypeGuarantees, isMutable, publishedAs
-
Methods inherited from interface org.eclipse.viatra.query.runtime.matchers.psystem.queries.PQueryHeader
getAllAnnotations, getAnnotationsByName, getFirstAnnotationByName, getParameter, getParameterNames, getPositionOfParameter, getSimpleName, getVisibility
-
-
-
-
Constructor Detail
-
GenericEMFPatternPQuery
public GenericEMFPatternPQuery(Pattern pattern)
Initializes a generic query representation for a given pattern.Warning: it is not recommended to directly instantiate GenericPQuery instances as they will not reuse previously built specifications- use
SpecificationBuilderinstead.- Parameters:
pattern- the pattern for which the matcher is to be constructed.- Throws:
ViatraQueryRuntimeException- Since:
- 2.0
-
GenericEMFPatternPQuery
public GenericEMFPatternPQuery(Pattern pattern, boolean delayedInitialization)
Initializes a generic query specification for a given pattern.- Parameters:
pattern- the pattern for which matchers are to be constructed.delayedInitialization- true if the query is not created automatically - in this case before use theinitializeBodies(Set)method- Throws:
ViatraQueryRuntimeException- Since:
- 2.0
-
-
Method Detail
-
getPattern
public Pattern getPattern()
- Since:
- 2.0
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getFullyQualifiedName
public java.lang.String getFullyQualifiedName()
Description copied from interface:PQueryHeaderIdentifies the pattern for which matchers can be instantiated.- Specified by:
getFullyQualifiedNamein interfacePQueryHeader
-
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
-
getDisjunctBodies
public PDisjunction getDisjunctBodies()
Description copied from interface:PQueryReturns all bodies associated with the query in their canonical form. If called multiple times, the same set with the same contents will be returned.- Specified by:
getDisjunctBodiesin interfacePQuery- Overrides:
getDisjunctBodiesin classBasePQuery
-
addAnnotation
public void addAnnotation(PAnnotation annotation)
Description copied from interface:InitializablePQueryAdds an annotation to the specification. Only applicable if the pattern is stilluninitialized.- Specified by:
addAnnotationin interfaceInitializablePQuery- Overrides:
addAnnotationin classBasePQuery
-
doGetContainedBodies
protected java.util.Set<PBody> doGetContainedBodies()
Description copied from class:BasePQueryCreates and returns the bodies of the query. If recalled again, a new instance is created.- Specified by:
doGetContainedBodiesin classBasePQuery- Returns:
-
initializeBodies
public void initializeBodies(java.util.Set<PBody> bodies)
Description copied from interface:InitializablePQuerySets up the bodies of the pattern. Only applicable if the pattern is stilluninitialized.- Specified by:
initializeBodiesin interfaceInitializablePQuery
-
setStatus
public final void setStatus(PQuery.PQueryStatus newStatus)
Description copied from interface:InitializablePQuerySets the query status. Only applicable if the pattern is stilluninitialized.- Specified by:
setStatusin interfaceInitializablePQuery- Overrides:
setStatusin classBasePQuery- Parameters:
newStatus- the new status
-
addError
public void addError(PProblem problem)
Description copied from interface:InitializablePQueryAdds a detected error. Only applicable if the pattern is stilluninitialized.- Specified by:
addErrorin interfaceInitializablePQuery- Overrides:
addErrorin classBasePQuery- Parameters:
problem- the new problem
-
-