org.eclipse.viatra.query.runtime.api.ViatraQueryEngine.getExistingMatcher()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中org.eclipse.viatra.query.runtime.api.ViatraQueryEngine.getExistingMatcher()方法的一些代码示例,展示了ViatraQueryEngine.getExistingMatcher()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ViatraQueryEngine.getExistingMatcher()方法的具体详情如下:
包路径:org.eclipse.viatra.query.runtime.api.ViatraQueryEngine
类名称:ViatraQueryEngine
方法名:getExistingMatcher

ViatraQueryEngine.getExistingMatcher介绍

[英]Access an existing pattern matcher based on a IQuerySpecification.
[中]根据IQuerySpecification访问现有模式匹配器。

代码示例

代码示例来源:origin: org.eclipse.viatra/org.eclipse.viatra.query.runtime

/**
 * Internal method for {@link GenericQuerySpecification}
 * @noreference
 */
static <Matcher extends GenericPatternMatcher> GenericPatternMatcher instantiate(ViatraQueryEngine engine, GenericQuerySpecification<Matcher> querySpecification) {
  // check if matcher already exists
  GenericPatternMatcher matcher = engine.getExistingMatcher(querySpecification);
  if (matcher == null) {
    matcher = engine.getMatcher(querySpecification);
  }     
  return matcher;
}

代码示例来源:origin: org.eclipse.viatra/org.eclipse.viatra.query.patternlanguage.emf

/**
 * Initializes the pattern matcher within an existing VIATRA Query engine.
 * If the pattern matcher is already constructed in the engine, only a
 * light-weight reference is returned. The match set will be incrementally
 * refreshed upon updates.
 * 
 * @param engine
 *            the existing VIATRA Query engine in which this matcher will be
 *            created.
 * @param querySpecification
 *            the query specification for which the matcher is to be
 *            constructed.
 * @throws ViatraQueryRuntimeException
 *             if an error occurs during pattern matcher creation
 */
public static GenericPatternMatcher on(ViatraQueryEngine engine,
    GenericQuerySpecification querySpecification) {
  // check if matcher already exists
  GenericPatternMatcher matcher = engine.getExistingMatcher(querySpecification);
  if (matcher == null) {
    matcher = engine.getMatcher(querySpecification);
  }
  return matcher;
}

相关文章