public NameToSpecificationMap(Collection<? extends IQuerySpecification<?>> specifications) { this(); for (IQuerySpecification<?> specification : specifications) { map.put(specification.getFullyQualifiedName(), specification); } }
private void forgetSpecificationTransitively(IQuerySpecification<?> specification, Set<IQuerySpecification<?>> forgottenSpecifications) { forgetSpecification(specification); forgottenSpecifications.add(specification); for (IQuerySpecification<?> dependant : dependantQueries.get(specification.getInternalQueryRepresentation())) { if (!forgottenSpecifications.contains(dependant)) { forgetSpecificationTransitively(dependant, forgottenSpecifications); } } dependantQueries.removeAll(specification); }
public BatchTransformationRule(final String rulename, final IQuerySpecification<Matcher> matcher, final ActivationLifeCycle lifecycle, final IMatchProcessor<Match> action) { this(rulename, matcher, lifecycle, action, IncQuerySinglePatternMatchEventFilter.<Match>createFilter(((Match) matcher.newEmptyMatch().toImmutable()))); }
public NameToSpecificationMap(IQuerySpecification<?>... specifications) { this(); for (IQuerySpecification<?> specification : specifications) { map.put(specification.getFullyQualifiedName(), specification); } }
@Override public boolean apply(IQuerySpecification<?> specification) { return specification.getInternalQueryRepresentation().getStatus().equals(status); } });
/** * Initializes a pattern-specification mapping with the contents of an existing {@link IncQueryEngine}. </p> * <p> * <strong>Warning</strong> It is assumed that each query specification in the engine has a unique fqn - if the * assumption fails, the resulting map is unspecified. * * @param engine */ public NameToSpecificationMap(IncQueryEngine engine) { this(); for (IncQueryMatcher<?> matcher : engine.getCurrentMatchers()) { IQuerySpecification<?> specification = matcher.getSpecification(); map.put(specification.getFullyQualifiedName(), specification); } }
private PQuery findCalledPQuery(Pattern patternRef) { IQuerySpecification<?> calledSpecification = patternMap.get(CorePatternLanguageHelper.getFullyQualifiedName(patternRef)); if (calledSpecification == null) { // This should only happen in case of erroneous links, e.g. link to a proxy Pattern or similar // otherwise pattern would be found in the name map (see SpecificationBuilder logic) try { calledSpecification = new GenericQuerySpecification(new GenericEMFPatternPQuery(patternRef, true)); } catch (QueryInitializationException e) { // Cannot happen, as initialization is delayed throw new RuntimeException(e); } } return calledSpecification.getInternalQueryRepresentation(); }
/** * Forgets a specification in the builder. </p> * <p> * <strong>Warning!</strong> Removing a specification does not change any specification created previously, even if * they are referring to the old version of the specification. Only use this if you are sure all dependant queries * are also removed, otherwise use {@link #forgetSpecificationTransitively(IQuerySpecification)} instead. * */ public void forgetSpecification(IQuerySpecification<?> specification) { String fqn = specification.getFullyQualifiedName(); patternMap.remove(fqn); if (specification instanceof GenericQuerySpecification) { patternNameMap.remove(fqn); sanitizer.forgetPattern(((GenericQuerySpecification) specification).getInternalQueryRepresentation().getPattern()); } }